This repository contains code to plot temperature data gathered from ESP8266 WiFi sensors on a website. You can use whatever i2c sensor you want to. I happened to have a lot of HTU21D chip thermometers so I used those.
_Figure 1. WeMos D1 mini on a breadboard with the HTU21D board alongside a more compact implementation using the ESP-01. The ESP-01 board can be powered from any USB charger so you can place these "WiFi sensors" wherever you please. The current draw is approximately 20 mA at 5 V_- Arduino sketch to program ESP8266
- Configuration files for NGINX and uwsgi
- Website to receive data from ESP8266 and plot data
Lines of the code containing the text "Update this line" require your attention. These lines contain configuration parameters such as your domain name, password etc. You can find all these lines by issuing grep -r "Update this line" ./
.
It's very easy to try the code without the hassle of setting up NGINX and uwsgi.
- Install Python and
pip install flask peewee
- Install Arduino and prerequisite packages
- Configure
esp8266.ino
with proper WiFi credentials and IP address of the computer you'll use to run the flask server. Upload the code to the ESP8266. - Run
python webserver.py
- You can now see the data arriving in the command prompt and view it at http://127.0.0.1:8080.
- ESP8266, in my case a WeMos D1 mini or ESP-01
- HTU21D breakout board In practice, any i2c sensor will do
You can find the schematic for each ESP8266 device in Figure 2 and 3. All of these parts can be found on eBay.
_Figure 4. Schematic using WeMos D1 mini._ _Figure 4. Schematic using ESP-01._- Web server to host visualization site and to receive data from the ESP8266. I've used NGINX and uwsgi to host a website using the Flask framework on a Debian server in the DigitalOcean cloud.
- Arduino with the following additional libraries to program the ESP8266: a) ESP8266 library b) HTU21D library