Introduction: Wemos D1 Mini Temperature/humidity Monitoring

Picture of 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

Picture of 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

Picture of 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

Picture of 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.

Comments

michaela181 made it! (author)2017-03-12

Amazing JOB

Really Good job thanks for sharing with us. see result of your job.

hiroyoki (author)michaela1812017-10-31

Hi michaela does the code work well?

michaela181 made it! (author)hiroyoki2017-10-31

hello yes, the developer's make good work and has worked well. and works since the date of my first comments continually. here is the result of the last 3 months (a measurement every 10 seconds) you can adapt the code for the use of other LCD for me I priced the OLED module + the wemos d1 mini (not pro)

hiroyoki (author)michaela1812017-11-01

Hi Michaela, can you share the info how to use the app blynk? How does the app link up with wemos D1

michaela181 (author)hiroyoki2017-11-01

I will not do all the details sorry but you can find the information on the site

http://www.blynk.cc/getting-started/

and explanations are simple. Developer as comment the code in the .ino file. And google is your friends

hiroyoki (author)michaela1812017-11-05

Thks for the info. Where can i get SFE_MicroOLED.h library for Oled to work? As i encounter error, while uploading.

michaela181 (author)hiroyoki2017-11-05

Hi if the same version of mine. I attach a version of installed version in my pc. I left new comment in one or two days.

hiroyoki (author)michaela1812017-11-05

Yes It is the same as Oled you are having. I tried to find on the web but unable to download. You can send to my mail too. ryosu07@gmail.com

michaela181 (author)hiroyoki2017-11-05

i have send to you the sfe_micro oled. i not have the sketch sorry.

hiroyoki (author)michaela1812017-11-06

Arduino: 1.8.5 (Mac OS X), Board: "WeMos D1 R2 & mini, 80 MHz, 9600, 4M (3M SPIFFS)"

In file included from /Users/hiroyoki/Documents/Arduino/sketch_nov05a/sketch_nov05a.ino:8:0:

/Users/hiroyoki/Documents/Arduino/libraries/SparkFun_Micro_OLED_Arduino_Library-V_1.0.0/src/SFE_MicroOLED.h:37:26: fatal error: avr/pgmspace.h: No such file or directory

#include <avr/pgmspace.h>

^

compilation terminated.

exit status 1

Error compiling for board WeMos D1 R2 & mini.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

Hi Michaela, there is error.

MiroslavS11 (author)hiroyoki2017-11-06

Hi Hiroyoki,

I checked and I was able to compile under Arduino 1.8.3 with SparkFun Micro OLED 1.2.0 library.

I than upgraded all libraries to newest including arduino to 1.8.5 and I was able to compile that example program without errors.

Try installing that SparkFun Micro OLED library from library manager.

I am running that same devices on photo now for more than year and they work OK, hopefully you will manage to compile after you install that library.

Let me know if installing library helped.

Miro

hiroyoki (author)MiroslavS112017-11-07

Arduino: 1.8.5 (Mac OS X), Board: "WeMos D1 R2 & mini, 80 MHz, 115200, 4M (3M SPIFFS)"

Build options changed, rebuilding all

sketch_nov05a:19: error: 'SimpleTimer' does not name a type

SimpleTimer timer; // enable simple timer

^

/Users/hiroyoki/Documents/Arduino/sketch_nov05a/sketch_nov05a.ino: In function 'void setup()':

sketch_nov05a:28: error: 'Blynk' was not declared in this scope

Blynk.begin(auth, ssid, pass); // Connects to wifi and Blynk services

^

sketch_nov05a:38: error: 'timer' was not declared in this scope

timer.setInterval(10000L, sendTemperature); // every 10 seconds run function sendTemperature

^

/Users/hiroyoki/Documents/Arduino/sketch_nov05a/sketch_nov05a.ino: In function 'void sendTemperature()':

sketch_nov05a:51: error: 'Blynk' was not declared in this scope

Blynk.virtualWrite(1, t); // send to Blynk virtual pin 1 temperature value

^

/Users/hiroyoki/Documents/Arduino/sketch_nov05a/sketch_nov05a.ino: In function 'void loop()':

sketch_nov05a:64: error: 'Blynk' was not declared in this scope

Blynk.run(); // run blynk

^

sketch_nov05a:65: error: 'timer' was not declared in this scope

timer.run(); // run timer

^

exit status 1

'SimpleTimer' does not name a type

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

This is the error now i am facing

MiroslavS11 (author)hiroyoki2017-11-08

missing library is called SimpleTimer

hiroyoki (author)MiroslavS112017-11-12

Hi MirolsavS11 i manage to get it work. But i still face problem on OLED as the display is on initially, it is not working but now there is no display on the Oled. Do you know how to test the oled whether is it spoil?

michaela181 (author)hiroyoki2017-11-12

Hello verify the i2c adress. is (chinese oled (mine oled is 0x3D) but with code is 0x3C modify on void setup

michaela181 (author)hiroyoki2017-11-12

Hello hiroyoki you can use other arduino and connect to a4 and a5 or use dedicated Sda Scl on PCB. you can use modified library (this oled is an SSD1306) see here for an test with temp ==>> https://projetsdiy.fr/test-shield-oled-wemos-d1-mi...

verify again you connection with multimeter and Diode continuity test. verify the connection with pin and resold with flux

MiroslavS11 (author)hiroyoki2017-11-07

You are missing as well simple timer library. try install that.

michaela181 (author)hiroyoki2017-11-07

hello i sent to you SimpleTimer and Blynk library. recompile. i hope for you thats work

michaela181 (author)hiroyoki2017-11-06

hello dear friend. it's not my project. and I am not developing. on the other hand I suspect that you do not have any library to compile your proram. I miss you I think the library "pgmspace" or you have add instructions to the code. I do not have the same error but this line indicates that you do not have the required file. you must download a PGMSPACE library.

look on google or here: https://github.com/adafruit/Adafruit_SSD1306/issues/26

and test a different version of arduino first. like the 1.6 or 1.6.3 (I think) because sometimes ardino version can not compile some sketch too old or not updated. also think compiled for the correct card esp8266 having to add the card in the card management menu.

MiroslavS11 (author)michaela1812017-03-13

thanks. have you tried that blynk part as well?

that "bronka" is name of my daughter, attached config was from sensor used in her room:)

hiroyoki (author)2017-11-01

Hi MiroslavS11, i am using mac do u you how to find the com port

turbiny (author)2017-10-04

Do you know how long will it last with battery shield and 60sec refresh?
Or an exapmle with battery spec and refresh rate?

MiroslavS11 (author)turbiny2017-10-04

I put there as well my excel estimates. with 7500 mAh battery and 60s refresh its 11 days only.

sarah9078kmuycxat (author)2017-05-07

Shouldn't timer.run() go inside begin()? It gets called at the set interval once triggered.

Then blynk.run() can go in the function that is triggered by the timer.

michaela181 (author)2017-03-13

Hi the name of your daughter is cool :-) yes the blynk app work great with you instruction. work in 5minute with your job thankx

Swansong (author)2017-01-09

Thanks for sharing :)

About This Instructable

7,651views

29favorites

License:

More by MiroslavS11:Wemos D1 Mini Temperature/humidity Monitoring
Add instructable to: