Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:laboratoare:2022:lab7 [2023/11/20 21:54]
dan.tudose [Sparrow BLE Service]
iothings:laboratoare:2022:lab7 [2023/11/20 22:15] (current)
dan.tudose [Web BLE Application]
Line 220: Line 220:
   ​   ​
   float t = (float)((int8_t)(temp / 100));   float t = (float)((int8_t)(temp / 100));
 +  t += (float)((uint8_t)(temp % 100))/​100.0;​
    
-  float h = (float)((int8_t)(humidity ​/ 1000)); +  float h = (float)((int8_t)(hum / 1000)); 
-  ​ +  ​h += (float)((uint16_t)(hum % 1000)))/1000.0;
-  float p = (float)((int16_t)(pressure / 100));+
    
 +  float p = (float)((int16_t)(pres / 100));
 +  p += (float)((uint8_t)(pres % 100))/​100.0;​
     ​     ​
     //Notify temperature reading     //Notify temperature reading
Line 258: Line 260:
 </​code>​ </​code>​
  
 +Upload the code to your board. After uploading, open the Serial Monitor, and restart the Sparrow by pressing the RST/EN button. ​
 +
 +You should get a //"​Waiting a client connection to notify..."//​ message in the Serial Monitor.
 +
 +Then, go to your smartphone, open the nRF Connect app from Nordic, and start scanning for new devices. You should find a device called **Sparrow_BME680**,​ this is the BLE server name you defined earlier.
 +
 +Connect to it. You’ll see that it displays the Environmental Sensing service with the temperature,​ humidity, and pressure characteristics. Click on the down arrows to activate the notifications.
 +
 +Then, click on the second icon (the one that looks like a " mark) at the left to change the format. You can change to unsigned int for all characteristics. You’ll start seeing the temperature,​ humidity, and pressure values being reported every 10 seconds.
 +
 +===== Web BLE Application =====
 +
 +Follow the tutorial [[https://​randomnerdtutorials.com/​esp32-web-bluetooth/​| here]] to learn how to create a Web application that connects directly to your Sparrow ESP32 board. You can use the web app just like a normal phone application to send and receive information over BLE from your device. ​
 +
 +<note important>​Web BLE is not currently supported by iOS phones </​note>​
 +
 +Build the application in the tutorial and deploy the web page in your GitHub account. ​
 +
 +=== Assignment ===
 +<​note>​ Modify the web page and the BLE app to display the BME680 sensor data (temperature,​ pressure and humidity). </​note>​
iothings/laboratoare/2022/lab7.1700510070.txt.gz · Last modified: 2023/11/20 21:54 by dan.tudose
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0