How To Read An Analog Sensor With Zerynth (python For Iot)
About the project
In this tutorial we'll see how to read data from a light analog sensor and print them to the serial monitor in a visual way.
Estimated time: 1 hour
Items used in this project
In this tutorial we'll see how to read data from an analog light sensor and then we'll print them to the Serial Monitor in a visual way.
We’ll use Zerynth Studio to program the microcontroller-based board in Python.
Zerynth simplifies and speeds up IoT development allowing programming in Python or hybrid C/Python the most popular 32-bit microcontrollers and connecting them to the leading Cloud Infrastructures like AWS, Google Cloud, Microsoft Azure, IBM Watson, Ubidots, and many more.
- First of all, you need a board. You can select one of the 32-bit microcontroller devices supported by Zerynth. We’ve chosen the ESP32-DevkitC by Espressif (read Zerynth documentation here).
- You also need an Analog LightSensor: we’ve chosen the ALS-PT19 by Adafruit.
Last but not least, you need:
Zerynth Studio, a powerful IDE for embedded programming in Python that enables the IoT. You can download it here.
Connect the analog light sensor to the ESP32-DevkitC as follows:
- Sensor '-' pin to board GND
- Sensor '+' pin to board 3V3
- Sensor 'out' pin to board A4
Check the circuit schematics below for further details!
Clone and uplink the Zerynth example "Analog to Digital Voltage Conversion" as shown in the video. If you want to view the data in a visual way, you can clone and uplink the Zerynth example "Oscilloscope".
Place your hand on the analog sensor to see the brightness data changing and enjoy!