This shows you the differences between two versions of the page.
iothings:laboratoare:2022:lab2 [2022/10/13 16:14] dan.tudose [Resurse] |
iothings:laboratoare:2022:lab2 [2022/10/13 17:00] (current) dan.tudose |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Sparrow ESP32 board bring-up & SPIFFS ===== | + | ===== Lab 2: Sensors & SPIFFS ===== |
In today's lab assignment we will bring up the sensors on the Sparrow ESP32 board and build a logger using the filesystem library and the board's internal Flash. | In today's lab assignment we will bring up the sensors on the Sparrow ESP32 board and build a logger using the filesystem library and the board's internal Flash. | ||
+ | |||
+ | === Bringing up the sensors === | ||
+ | |||
+ | We'll learn how to get data from all the sensors on the board. | ||
+ | |||
+ | == Light Sensor == | ||
+ | |||
+ | |||
+ | {{ :iothings:laboratoare:2022:f7e03b34cc8586c24828e06bdde40887.jpeg?150|}} | ||
+ | |||
+ | The board has an on-board [[https://eu.mouser.com/datasheet/2/239/lite-on_lite-s-a0002515146-1-1749840.pdf | LTR308]] light sensor. It's connected to the ESP32 processor via a I2C bus. You will need to install a [[https://www.arduinolibraries.info/libraries/ltr308-library | driver library]] to get light intensity readings. Go to Sketch > Include Library > Manage Libraries and search for LTR308 and then click on the Install button. | ||
+ | |||
+ | The library comes pre-loaded with an example, you can load it from File > Examples > LTR308 and it should print light intensity reading in the Serial Terminal. | ||
+ | |||
+ | Use the Serial Plotter to graph different illumination levels. | ||
+ | |||
+ | == BME680 Sensor == | ||
+ | |||
+ | {{ :iothings:laboratoare:2022:screenshot_2022-10-13_at_16.58.01.png?150|}} | ||
+ | |||
+ | Next, you'll be bringing up the [[https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/ | BME680]] sensor, which is a highly integrated temperature, pressure, humidity and gas sensor. | ||
+ | Again, you will need to install a [[https://www.arduinolibraries.info/libraries/bme680 | sensor library]] that enables you to interface the sensor on I2C and get readings. | ||
+ | |||
+ | Run the I2CDemo to get sensor readings and plot them in the Serial Plotter. | ||
=== ESP32 Flash Memory === | === ESP32 Flash Memory === | ||
Line 32: | Line 56: | ||
The file system API includes functions like SPIFFS_open() or SPIFFS_write(), but the Arduino IDE provides a file system abstraction API through which we can call functions like fs.open() and fs.write(). The "SPIFFS_test" program in the Arduino IDE is one such example. | The file system API includes functions like SPIFFS_open() or SPIFFS_write(), but the Arduino IDE provides a file system abstraction API through which we can call functions like fs.open() and fs.write(). The "SPIFFS_test" program in the Arduino IDE is one such example. | ||
- | ===== Exerciții ===== | + | ===== Assignments ===== |
+ | |||
+ | === ESP32 personal agenda === | ||
+ | |||
+ | Implement a personal address book that will write and read information on the SPIFFS file system. The input data will be entered by the user through a smartphone that will connect to the ESP32 via Bluetooth. | ||
- | === Agendă personală cu ESP32 === | + | Starting from the "SPIFFS_test" and "SerialToSerialBT" example in the Arduino IDE, we can use the smartphone to send data and commands via Bluetooth to the ESP32. In the main function "loop()" we want to read the message from the phone once, and then be able to write or read to the external memory. |
- | Ne propunem să implementăm o agendă personală care va scrie și citi informațiile pe sistemul de fișiere SPIFFS. Datele de intrare vor fi introduse de utilizator prin intermediul unui smartphone care se va conecta la plăcuta ESP32 prin Bluetooth. | + | {{:iothings:laboratoare:lab2-agenda.png?300|}} |
- | Plecând de la exemplul "SPIFFS_test" și "SerialToSerialBT" din Arduino IDE, putem folosi smartphone-ul pentru a trimite date și comenzi prin Bluetooth către ESP32. În funcția principală "loop()" dorim o dată să citim mesajul de la telefon, iar apoi să putem scrie sau citi către memoria externă. | + | === ESP32 datalogger === |
- | {{:iothings:laboratoare:lab2-agenda.png?200|}} | + | Using the same libraries and apps as the previous exercise, implement a sensor data logger. The data logger periodically reads all sensor values (e.g. once every 30 seconds) and writes them in a file, together with a timestamp. For the timestamp, you could use a library such as [[https://www.arduino.cc/reference/en/libraries/uptime-library/ | uptime]]. |
+ | Use the bluetooth terminal to dump all sensor data. | ||
===== Resources ===== | ===== Resources ===== | ||