Introduction: Wemos D1 Mini Temperature/humidity Monitoring
I was looking for cheap and easy way to monitor temperature and humidity for my cottage that will run as well on battery or on power socket. I needed to monitor temperature remotely but I wanted as well possibility for local visual temperature check.
I use Arduino compatible Wemos D1 mini with DHT22, DHT21 and wemos mini OLED shield. I have power socket powered sensors (by USB charger) and battery powered sensors. I use blynk as cloud service for representation of data.
List of material:
wemos D1 mini (aliexpres)
wemos mini OLED shield (aliexpres)
DHT21 temperature/humidity sensor (aliexpres)
DHT22 temprerature/humidity sensor (aliexpres)
some short cables and soldering tools and materials.
Step 1: Soldering of Pins
You will receive Wemos board and shields without soldered pins as you will receive in package 3 different option:
- Male only
- Female only
- Male to Female
I chose to put female pins on main board and all other boards use Male to Female pins. It allows you to stack other shields if you choose so (like relay shield)
When soldering pins, make sure you put male pins to breadboard so they will be strait.
I use Male to Female pins even for OLED shield. Female pins provide than partial mechanical protection to it.
You can use directly wemos D1 mini DHT pro shield with this tutorial, but I used sensor on short cables to not influence the measurement by heat from wemos board or display.
For battery powered sensors, I directly soldered battery holder and DHT temprerature sensor to wemos D1 mini board.
Step 2: Setup Blynk
Install blynk on your phone and create there new project with 2 devices. For each device you will receive individual access codes. I use one device authentication for all indoor devices and one for all outdoor devices. You will need to put that access codes in arduino in next step.
Blynk allows you to use virtual pins for exchanging values between your device and cloud. You can use virtual pin 1 for temperature measurement of your first indoor sensor and pin 3 for temperature measurement of your second indoor sensor. Virtual pin 2 than for humidity measurement of your first indoor sensor and pin 4 for humidity measurement of your second indoor sensor. Important is only to use unique virtual pin id per each device.
You can test various options for representing your measurements in blynk, I use historic graph and small value icon.
For outdoor sensors you can use separate authentication code and similar approach.
Step 3: Stack Together and Configure Wemos D1 Mini Boards
When pins are soldered you can stack board and shields together and configure board by Arduino IDE.
For Wemos D1 mini board you will need as well USB to serial drivers you can find on their webpage.
For simple showing of temperature and humidity on OLED display you can put basic program blynk-example that is attached to this step. Its well commented so you can edit according to your connection. Keep in mind that wemos D1 pin is not IO1 and so on. Here are IO values of its pins. You can find them on wemos site as well.
For DHT22 sensor you should solder 10 kOhm resistor between pins 1 and 2. (link how to connect it). DHT22 can be connected without additional resistor (red on +3.3V, black on ground, yellow on digital input of ESP8266, if itsD2 than its IO4 in arduino code).
Battery powered outside sensors have deepsleep capability. I use Lithium-Thionyl chloride (Li-SOCl2) batteries directly connected to board ground and 3.3 V ports. Their voltages are within ESP8266 specifications and by connecting them directly I save power that will be otherwise consumed by additional power up/down conversions. You can search for SAFT 3,6V primary battery to find vendor, I bought from czech reseller (link)
Use blync-battery-example configuration that is well commented and you can adjust according to your needs.
I have attached excel simplified calculator that was proofed working OK if wifi and internet connection is available. if wifi or internet is down than it can be up to 35 seconds for your device to get to deepsleep and it affects battery life.
You should now get your data readings on OLED display and on mobile phone blynk application.
NOTE: Use Blynk library version 0.4.10 if you get "version.h" error