Trybotics Logo

MicroPython Program:Mini Weather Station

DESCRIPTION

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.

Description:

Hardware:

  • MakePython ESP32
  • DHT11
  • Bread board
  • Jump line
  • USB cable

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

Description:

  1. MakePython ESP32 and DHT11 are plugged into the breadboard.

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

  3. Connect MakePython ESP32 to PC using USB cable, Open device manager (Simply search for "device" in the Windows search box). When expanded, the port section should display something like the above. Make a note of the port number, such as COM19 in my case. If no port appears, try downloading the USB drive: https://www.silabs.com/products/development-tools/...

Description:

Detailed instructions for uPyCraft can be found at this link:

https://www.makerfabs.com/makepython-esp32-starter...

  • Click the link above to open the page
  • Find the MicroPython ESP32 Dev Kit Guidance document
  • Click download to open the document
  • Detailed tutorials are available in the I. MicroPython Development Tools directory

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.

Description:

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:

  • SSID: need to change to your local network name
  • PASSWORD: need to change to your local network 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.

Attachments

Description:

Run main.py, network success, you can see an IP address (mine: 192.168.1.120)

Description:

Open the browser on your PC, type in the IP address you just got (192.168.1.120), and click Enter to confirm.

Description:

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.


YOU MIGHT ALSO LIKE