Introduction: WEMOS D1 Temp/Humidity IoT

This is a simple assemble, connect, compile project to get you going with an IoT Temperature and Humidity sensor that connects to WiFi and 'reports' your data to the Blynk IoT platform. Making monitoring easy from your smartphone.

Aside from the assembly soldering, this could be completed from the age of 6-7 up fairly easily.

Cost for me was about $15 NZD, or about $10 USD. So very cheap to do if you do need monitoring for temperature and humidity.

Step 1: Grab Your Components

You need:

WEMOS D1 Mini product link

WEMOS SHT30 sensor shield product link

USB micro cable

Soldering iron & solder (for the more permanent item) or jumpers for the boards and maybe a breadboard.

Given the components don't come assembled, soldering them is recommend to make life easier.

With the pins on the devices, have the male pins on top and female pins on the bottom of the board. Then the main processor is more usable for your developments later and the shields can be swapped to suit.

Step 2: Once Assembled Into the Two Components

Once you have assembled the two devices with their pin configurations, plug them together.

Making note of the pin alignment. They should fit together with no hassles.

Step 3: Time to Connect and Program

You will need to use either the web editor or download Arduino IDE to program your device.

Which you can find here:

You will need to install the appropriate board library for your board. This instructable is the best one I found for this: WEMOS - Arduino SoftwareIDE Instructable

Once you have done this you need to track down and load the libraries for:

Wire: (which should be installed with the main Arduino IDE software)

ESP8266WiFi: (which should be an installable library in the library manager in Arduino IDE)

and the Blynk one:

Step 4: Now for the Code.

You will need to have on hand:

  • Your Blynk project API key: Setup your account, project etc on your phone here
  • WiFi SSID (Name of your WiFi network)
  • WiFi Password
  • Blynk Virtual Pin Number for Temperature and another for Humidity, can be sorted later.
  1. Open the attached code in the Arduino IDE software
  2. Edit the Blynk Code replacing the comment including the < & >
  3. Edit the WifiSetup and replace the SSID and Password in a similar way
  4. Plug in your Wemos to your computer with the USB cable.
  5. You will need to select your board and post under tools on the menu. If your board isn't listed you need to go back a few steps and sort your board library so it is available.
  6. Under Sketch on your toolbar, verify and compile. Which should have no errors. (Deal with the errors which are likely to be libraries not loaded correctly)
  7. Upload to your Wemos
  8. Under Tools select Serial monitor.

You should have the LED on the WEMOS flashing every 5 seconds if it is working how it should.

Step 5: Watching What's Going On

With the Serial monitor open, you should now see the WEMOS doing its thing.

On your phone with your Blynk App, you should be able to select options to add the data display to your screen.

This instructable, which is very similar to this project covers, the Blynk app well

Have fun and hopefully, this is a nice simple and useful project for you.

Step 6: Fiddling and Playing

If you want to fiddle, adjusting the timers:

  • For the still alive flash, const long intervalLED = 5000; a lower number here will flash more often than the 5 seconds I've defaulted in the code.
  • As will adjusting the 5-minute sensor reading, const long intervalProg = 300000; where 1000 would read every second.
  • The 'timeElapsedBlynk' routine at the beginning of the loop is to keep the Blynk connection alive, if your intervalProg setting is 10000 or less then this IF statement can be commented out. Blynk will list your device offline if it doesn't 'tick' for longer than about 10 seconds.
  • If you want to run multiple devices into the same Blynk project, ensure you adjust the 'pin' you are writing to, to ensure you don't clash your data. Definable in the two variables above the void setup() routine.
  • I've added in an extra variable to account for the heat generated by the D1 as well as the corresponding impact on humidity. I'm was initially finding about 3.5-4.5 deg C fluctuation against other temperature devices.
  • You can tinker, or to fix it, provide sufficient distance from the processor with wires for either the whole board or carefully snap off the sensor and extend with wires from there to improve accuracy.

  • After a day of side by side testing with the unit as assembled here and another alongside that has extended wires to distance the processor, the temperature fluctuation measured with the Blynk recording on 160 data points is a minimum of 1.212 deg C difference, 2.093 deg C difference, and an average of 1.75 deg C difference. The bulk and the Pareto line on the data is at or around the average of 1.75 deg C.
  • I also found a similar thing with the humidity with this being recorded at 6.115% below the real humidity. And I have added a variable for this too.
  • For my purposes, these quick and dirty manipulations are sufficient for my needs as a degree either way acceptable.