It's winter now, but it still feels a little hot, even though I'm only wearing a T-shirt, which makes me want to know the current temperature, so I use the Micropython ESP32 and DHT11 sensors and a simple weather station so you can get the current temperature and humidity in any browser, now I'll share the process with you.
Hardware:
MakePython ESP32 is an ESP32 board with an integrated SSD1306 OLED display, you can get it from this link:
https://www.makerfabs.com/makepython-esp32.html
Software:
uPyCraft IDE
Click this link to download uPyCraft IDE for Windows: https://randomnerdtutorials.com/uPyCraftWindows
MakePython ESP32 and DHT11 are plugged into the breadboard.
DHT11 only needs 3 wires, VCC and GND are connected to 3V3 and GND of ESP32, and DATA is connected to IO14 of ESP32. I used GPIO14 in the experiment, so I connected IO14.
Detailed instructions for uPyCraft can be found at this link:
https://www.makerfabs.com/makepython-esp32-starter...
Of course, this documentation is not just about the uPyCraft instructions, but also includes some MicroPython ESP32 routines and frequently asked questions and error handling.
The code for ssd1306.py was downloaded from the GitHub repository: https://github.com/ckuehnel/MicroPython-on-ESP32 Or download mine.
After downloading ssd1306.py, open the file, and click Save and DownAndRun. "download ok" will be displayed when the download is successful.
After downloading main.py, the following changes need to be made:
1. Change network name and password:
When you're done, click DownAndRun and the MakePython ESP32 connects to WiFi
2. DHT11 data pin:
If DHT11 receives a Pin change on MakePython ESP32, change the number in the Pin() to the Pin you are receiving.
The browser displays the current temperature and humidity, as well as the OLED display on MakePython ESP32.When you refresh the page, the temperature and humidity data will also refresh.
The mini weather station is relatively simple.I will add data from gas sensors, rain sensors, atmospheric pressure sensors and other sensors to enrich the weather station.