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.

Project info

Difficulty: Easy

Platforms: AdafruitEverything ESPZerynth

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Adafruit ALS-PT19 Analog Light Sensor Breakout Adafruit ALS-PT19 Analog Light Sensor Breakout x 1
Everything ESP ESP32S Everything ESP ESP32S x 1

Software apps and online services

Zerynth Studio Zerynth Studio

Story

https://www.youtube.com/watch?v=1Wwk9FB5Ir4

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.

Required Material

  • 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.

Assembling

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!

Programming

Once you have installed Zerynth Studio and created a Zerynth user, you have to register and virtualize the board.

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!

Schematics, diagrams and documents

schematics

Code

Oscilloscope.py

Credits

Leave your feedback...