Reading data from a sensor using MicroPython

Reading sensor data is an essential function of the ESP8266. You can do that using MicroPython. To demonstrate it, we are going to read the temperature and humidity from the DHT11 sensor using MicroPython.

Getting ready

In this tutorial, you will need an ESP8266 board, a USB cable, and a few other components, which include:

Mount the ESP8266 board and the DHT11 sensor onto the breadboard. Connect a 10 kΩ pull up resistor to the DHT11 data pin and connect the pin and GND pin to the 3V pin and GND pin of the ESP8266 board, respectively. Finally, connect the data pin of the DHT11 to GPIO 5 of the ...

Get ESP8266 Internet of Things Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.