Solar Powered WiFi Weather Station V2.0




This Instructable is a continuation of my earlier weather station project. It was quite popular on the web, people around the globe made their own by following it and given valuable feedback for improvement. By taking consideration of the comments and Q&A section of my earlier project, I decided to make this new version Weather Station. I also made a custom PCB for this project, so anyone with little knowledge on electronics circuit can be made this project. My V-2.0 PCB can also be used for any application in the Arduino platform. Following are the salient features of the new weather station.

This project is also an entry in Hackaday Prize 2019. Please like, follow and share. It will be helpful to me.


1. Connect to Wi-Fi, and upload the data to the web ( Blynk App and Thingspeak)

2. Monitoring Weather parameters like Temperature, Pressure, Humidity, altitude and UV level, etc.

3. Extra ports to add more sensors

4. Remote Battery Status Monitoring

5. Uses a powerful Li-Ion Battery ( 3400 mAh ) and Solar Panel (1W)

6. Independence from the external power source

7.Can be installed in remote sites or geographically challenging environments

8. Being Solar powered, it is an environment-friendly device.

Step 1: Components and Tools Required

Components Used :

1. Wemos D1 Mini Pro (Banggood / Amazon )

2. TP 4056 Charging Board (Banggood / Amazon )

3. BME 280 sensor ( Amazon / Bangood )

4. BMP280 ( Banggood / Amazon )

5. DS18B20 Sensor ( Banggood / Amazon )

6. Switch ( Banggood / Amazon)

7. Screw Terminals ( Banggood)

8. PCB standoffs ( Banggood / Amazon )

9. 18650 Battery ( Aliexpress)

10.18650 Battery Holder ( Banggood / Amazon)

11. Solar Panel ( Banggood )

12. Straight Headers Pin ( Banggood / Amazon )

13. 22 AWG wire ( Banggood / Amazon )

14. Weather Station V2.0 PCB ( PCBWay )

15. Super Glue ( Amazon )

16. 3D printing filament -PLA ( GearBest )

Tools Used :

1. 3D Printer ( Creality CR-10 )

2. Soldering Iron ( Amazon )

3. Glue Gun ( Amazon )

4. Wire Stripper ( Amazon )

5. Wire Cutter ( Amazon )

Step 2: Power Supply

My plan is to deploy the Weather station at a remote place ( my farmhouse).To run the Weather Station continuously, there must be a continuous power supply otherwise the system will not work. The best way to provide continuous power to the circuit is by using a battery. But after some days the battery juice will run out, and it is a really difficult job to go there and charge it. So a solar charging circuit was proposed to user free energy from the sun to charge the batteries and to power the Wemos board. I have used a 18650 Li-Ion battery.

The battery is charged from a Solar panel through a TP4056 charging module. The TP4056 module comes with battery protection chip or without the protection chip. I will recommend buying a module which has a battery protection chip included.

About the TP4056 Battery Charger

The TP4056 module is perfect for charging single cell 3.7V 1 Ah or higher LiPo cells. Based around the TP4056 charger IC and DW01 battery protection IC this module will offer 1000 mA charge current then cut off when charging is finished. Furthermore, when the battery voltage drops below 2.4V the protection IC will cut off the load to protect the cell from under voltage. It also protects against overvoltage and reverse polarity connection.

Step 3: Monitoring Temperature and Humidity by BMP/E280

In the earlier days, weather parameters like ambient temperature, humidity, and barometric pressure were measured with separate analog instruments: thermometer, hygrometer, and barometer. But today the market is flooded with cheap and efficient digital sensors that can be used to measure a variety of environmental parameters. The best examples are sensors like DHT11, DHT 22, BMP180, BMP/E280, etc.

In this project, we will use BMP280 / BME280 sensor.

BMP 280 :

BMP280 is a sophisticated sensor that very accurately measures barometric pressure and temperature with reasonable accuracy. The BME280 is the next-generation of sensors from Bosch and is the upgrade to the BMP085/BMP180/BMP183 - with a low altitude noise of 0.25m and the same fast conversion time. The advantage of this sensor is that it can use either I2C or SPI for communication with the microcontroller. For simple easy wiring, I will suggest buying the I2C version board.

BME280 :

The new BME280 sensor, an environmental sensor with temperature, barometric pressure, and humidity. The BME280 is the next-generation of sensors from Bosch and is the upgrade to the BMP280. This precision sensor from Bosch is the best low-cost sensing solution for measuring humidity with ±3% accuracy, barometric pressure with ±1 hPa absolute accuracy, and temperature with ±1.0°C accuracy. It can be used in both I2C and SPI.

Note: BME280 can measure humidity but BMP280 can't. In the market, BMP280 is also available by the name of BME280. So be sure whether it is a BMP280 or BME280.

Step 4: Additional Ports for More Sensors

The Weather Station V2.0 board have 5 additional ports to hook up more weather sensors. The following additional sensors can easily be hooked up :

1. GY-1145 Sensor: for measuring UV Index

The SI1145 is a sensor with a calibrated UV sensing element that can calculate the UV Index. It can communicate via I2C communication (address 0x60). You can hook up this sensor with I2C port in the board which is located just side to the power switch.

You can read this article to know more about this sensor.

You can buy this sensor from Banggood.

2. HDC1080: for measuring temperature and humidity

The HDC1080 is a digital humidity sensor with an integrated temperature sensor that provides excellent measurement accuracy at very low power. It can also communicate via I2C communication.

You can read this article to know more about this sensor.

You can buy this sensor from Banggood.

3. DS18B20: for measuring temperature

It can measure temperature with a minimal amount of hardware and wiring. These sensors use a digital protocol to send accurate temperature readings directly to your development board without the need of an analog to digital converter or other extra hardware. It uses a one-wire protocol to communicate with the microcontroller. It can be hooked up in port-P2 in the board which is located on the right side of the Wemos board.

You can read this article to know more about this sensor.

Step 5: Using an External Antenna ( 3dBi )

The Wemos D1 mini Pro board have an inbuilt ceramic antenna along with provision for connecting an external antenna to improve the range. Before using the external antenna, you have to reroute the antenna signal from the built-in ceramic antenna, to the external socket. This can be done by rotating the small surface mount (0603) Zero Ohm resistor (sometimes called a link).

You can see the above picture, how I have done this.

You can also watch this video made by Alex Eamesto to rotate the zero ohm resistor. Then snap the antenna SMA connector into the Wemos Pro mini antenna slot.

Step 6: Monitoring Battery Voltage

The weather station is run by a 18650 Li-Ion battery, so it is very important to monitor its status. The max voltage input to the Wemos board is around 3.2~3.3V but a fully charged 18650 battery voltage is 4.2V. So to measure this voltage we have to step down the voltage by using a voltage divider network.

The Wemos D1 mini already has an internal voltage divider that connects the A0 pin to the ADC of the ESP8266 chip. The voltage divider is made up of 220k (R1) and 100k (R2). So, we have to add an external resistance with the inbuilt 220k resistor to read the battery voltage. By using a 100k resistance we can measure the max voltage of the battery, but taking some margin, a 220k resistor is selected. It is named R1 on the PCB board and located just above the battery holder.

To select the voltage divider resistance values, you can use this online calculator.

You can also read this article on battery voltage monitoring.

Step 7: Implimenting Deep Sleep Mode

The heart of the Wemos Board used in our Weather Station is an ESP8266 SOC which is a power hungry chip. Our objective is to run the device by using a 18650 battery but the demand for power usually makes battery operation impractical.

Another problem is that as the device will run continuously, it is quite obvious that the device will experience warming, and therefore the measured temperature will be higher than the ambient temperature.

From the above, it is clear that we have to lower the power consumption of the ESP8266 WiFi chip. To do that, we’ll use the Deep Sleep mode which is the most power efficient option for ESP chip. It allows to put the ESP8266 into hibernation and saves the battery. You can wake up it at regular intervals to make measurements and publish them.

Component Operation mode ----- Sleep mode

1. ESP8266 170 mA -------- 10 uA

2. CH340 12 mA --------- 50 uA

3. Built-in LED 3 mA ----------- 0 uA

4. Voltage monitor 0.006 mA ----- 6 uA


Total185 mA ---- 66 uA

If the sleep-wake cycle is 10 minutes, with a 30 second wake time, the energy consumption budget looks like this:

Wake time 185 mA for 0.5 minutes = 92.5 mA-minutes

Sleep time 0.066 mA for 9.5 minutes = 0.627 mA-minutes

Total in 10 minutes = 93.13 mA-minutes

Thus the average current consumption is 9.3 mA.

Image credit:

Step 8: Selecting the Solar Panel

From the previous step, it is concluded that the average current consumption is 9.3 mA

Charge required for running the device for the whole day = 9.3 mA x 24 Hours = 223.2 mAh

There is no current gain in the linear regulator used in the WeMos, so any current used at 3.3V results in the same current at 3.7V or whatever voltage the battery is at.

The amount of solar insolation varies according to which part of the globe you are located at. To find out the amount of solar insolation in your area, you can use the Global Solar Atlas. By taking consideration into minimum 1 hour of full sunlight, we are going to select the solar panel.

So, our target is to generate 223.2 mAh in 1 hour.

To charge a 3.7V Li-Ion battery, a solar panel of voltage 5 to 6V is adequate.

Required Solar Panel rating = 223.2 mA at a voltage of around 5 to 6 volts.

Solar panel rating = 223.2mA x 5V = 1.1W

Solar Panel Selected : 1W / 5V to 6V

In this project, I have used a 5V,200mA Solar Panel ( 99 x 69 mm)

So a 1W panel should be enough to run the project even in winter in places with a high latitude.

Note: If your location receiving ample amount of sunlight, then a 0.66W solar panel which I have used in my earlier version also work.

Step 9: PCB Design

I have drawn the schematic by using EasyEDA online software after that switched to PCB layout.

All of the components you added in the schematic should be there, stacked on top of each other, ready to be placed and routed. Drag the components by grabbing on its pads. Then place it inside the rectangular border line.

Arrange all the components in such a way that the board occupies minimum space. Smaller the board size, cheaper will be the PCB manufacturing cost. It will be useful if this board has some mounting holes on it so that it can be mounted in an enclosure.

Now you have to route. Routing is the most fun part of this entire process. It’s like solving a puzzle! Using the tracking tool we need to connect all the components. You can use both the top and the bottom layer for avoiding overlap between two different tracks and making the tracks shorter.

You can use the Silk layer to add text to the board. Also, we are able to insert an image file, so I add an image on of my website logo to be printed on the board. At the end using the copper area tool, we need to create the ground area of the PCB.

Now the PCB is ready for manufacturing.

You can order it from PCBWaySign up PCBWay now to get a US $5 coupon. That means your first order is free of cost only you have to pay the shipping charges.

When you place an order, I will get 10% donation from PCBWay for contribution to my work. Your little help may encourage me to do more awesome work in the future. Thank you for your cooperation.

Step 10: PCB Fabrication

Once we are completed the PCB design we just need to click the “Gerber output” button, save the project and we will be able to download the Gerber files which are used to manufacturing the PCB.

Step 11: Assembling the PCB

After receiving the board from the PCB fab house, you have to solder the components.
For Soldering, you will need a decent Soldering Iron, Solder, Nipper.

First I cut the straight male and female headers pin for Wemos Board, TP4056, BMP/E 280 and for all the ports.

Following are the details about the headers :

1. Wemos Board - 2 x 8pins Female

2. BMP280 - 1 x 6pins Female

3. I2C Port - 1 x 4pins

4. Port P1 - 1 x 4pins

5. Port P2- 1 x 3pins

6. Port P3- 1 x 4pins

7. Port P4- 1 x 3 pins

It is good practice to solder the components according to their height. Solder the lesser height components first.

I have started by soldering the resistors, switch and then moved towards the bigger components like headers pin, screw terminal and battery holder.

Step 12: Adding the Modules and Battery

After assembling the header pins, switch and screw terminal, it is time to insert the boards into their respective headers. The headers are clearly labeled on the PCB, so there is no chance of confusion.

First I place the TP4056 board and solder all the pads.

Then I added the Wemos Board and BME280 Sensor.

Finally, I inserted the 18650 battery into the battery holder.

Step 13: Mounting the Standoffs

After adding all the parts, mount the standoffs at 4 corners. I used M3 Brass Hex Standoffs.

Use of standoffs will provide sufficient clearance to the soldering joints and wires from the ground.

Step 14: 3D Printed Enclosure

To give a nice commercial product look, I designed an enclosure for this project. I used Autodesk Fusion 360 to design the enclosure.

The enclosure has two parts:

1. Main Body

2. Cover Lid

The Main Body is basically designed to fit the Weather station V2.0 PCB (85mm* 83mm).

The Cover lid is to cover up the main body opening.

I used my Creality CR-10 printer and 1.75 mm green PLA filament to print the parts. It took me about 11 hours to print the main body and around 3 hours to print the top lid.

My settings are:

Print Speed : 60 mm/s

Layer Height: 0.2mm ( 0.3 also works well)

Fill Density: 25%

Extruder Temperature: 200 deg C

Bed Temp: 60 deg C

Download the STL files from Thingiverse

You can also have a look into the enclosure designed by 3KU_Delta.

Download the STL file of his design from Thingiverse

Step 15: Put the PCB Inside the Enclosure

First, insert the M-F hex standoffs into the four mounting slots in the enclosure.

Then fix the PCB board over the standoffs by aligning its four screw holes at the corner.

After inserting the four standoffs, I have faced difficulty to fix the PCB due to small misalignment. So I am thinking to modify the mounting stand to fix the 3M screw directly instead of hex standoffs.

Step 16: Installing the Components

After mounting the PCB, you have to install the BME280 module and Wemos board.

Then insert the jumper JP2.

Insert the SMA connector into the holes provided in the enclosure. Then tighten the nut along with the washers. Now install the antenna by properly aligning with the SMA connector.

At last, put the 18650 battery inside the battery holder. Make sure you have to insert with the right polarity. The polarity is marked in the battery holder, PCB as well as on the battery.

Step 17: Installing the Solar Panel

Solder a 22 AWG red wire to the positive terminal and black wire to the negative terminal of the Solar panel.

Insert the two wires into the holes in the roof of the main enclosure body.

Use super glue to fix the Solar Panel and press it some time for proper bonding.

Seal the holes from the inside by using hot glue.

Step 18: 3D Printed Stevenson Screen

My earlier enclosure design was a decent looking enclosure but it was not ideal for the weather station. The ideal enclosure for keeping the weather sensors is the Stevenson Screen. A Stevenson screen is an enclosure for weather sensors against rain and direct heat radiation from outside sources, while still allowing air to circulate freely around them.

The Stevenson Screen for Solar Weather Station V2 is designed by my friend Glen. This has a simple wall mount and a 2 part cover to isolate the heat transfer from the solar panel. I really appreciate his work.

You can download the .STL files from Thingiverse

TIP: Spray the fully assembled PCB with Lacquer Spray to protect the board and components, but you do need to put a little tape over the BME280 temp sensor hole to not block it.

Step 19: Interfacing With Blynk App

Step-1: Download the Blynk app

1. For Android

2. For iPhone

Step-2: Get the Auth Token

In order to connect the Blynk App and your hardware, you need an Auth Token.

1. Create a new account in the Blynk App.

2. Press the QR icon on the top menu bar. Create a clone of this Project by scanning the QR code shown above. Once it detected successfully, the whole project will be on your phone immediately.

I've made Sol Weather Station app. You are welcome to try it out!

To start using it: 1. Download Blynk App: or 2. Touch the QR-code icon and point the camera to the code below 3. Enjoy my app!

3. After the project was created, we will send you Auth Token over email.

4. Check your email inbox and find the Auth Token.

Step-3: Preparing Arduino IDE for Wemos Board

To upload the Arduino code to Wemos board, you have to follow this Instructables

Step-4: Arduino Sketch

After installing the above libraries, paste the Arduino code given below.

Enter the auth code from step-1,ssid, and password of your router.

Then upload the code.

Step 20: Uploading Sensor Data to ThingSpeak

First, create an account on ThingSpeak.

Then create a new Channel on your ThingSpeak account.

Find How to Create a New Channel Fill Field 1 as Pressure, Field 2 as Temperature, Field 3 humidity, Field 4 as altitude and Field 5 as Bat Voltage.

In your ThingSpeak account select “Channel” and then “My Channel”.

Click on your channel name.

Click on “API Keys” tab and copy the “Write API Key”

Open the Solar_Weather_Station_ThingSpeak code.

Replace the “WRITE API ”with the copied “Write API Key”.

You can see my live feed.

Currently, I am getting an inconsistent reading for battery voltage, so the field is disabled.

Step 21: Software and Libraries

To use Wemos D1 with the Arduino library, you'll have to use the Arduino IDE with ESP8266 board support. If you haven't already done that yet, you can easily install ESP8266 Board support to your Arduino IDE by following this tutorial by Sparkfun.

Following settings are preferable :

PU Frequency: 80MHz 160MHz

Flash Size: 4M (3M SPIFFS) – 3M File system size 4M (1M SPIFFS) – 1M File system size

Upload Speed: 921600 bps


Before uploading the code install the following libraries :

1. ESP8266

2. BMP280

3. Blynk

You can read this tutorial by Sparkfun to install the Arduino libraries.

In my earlier version, there are two separate codes for Blynk and Thinspeak but in this version, we have written a single piece of code. The user has to only comment out a single line of code for Blynk or Thingspeak. For example, if you are using it for Blynk App, the code should be as below:

   const String App = "BLYNK";         //  alternative is line below
// const String App = "Thingspeak";    //  alternative is line above

Credit: I want to give a lot of credit to Keith Hungerford, who has guided me to make this project more powerful. The software library for BMP280 is also written by him. You can read his Instructable on BMP280 power saving mode.

Note: Before using the deep sleep feature, Wemos D0 pin must be connected to the RST pin. This can be done by shorting the jumper JP2.

Update : 15.05.2019

You can also see excellent work done by 3KUdelta on his GitHub Page. In his V2.3 code, he included the famous Zambretti forecaster. I really appreciate his hard work for the improvement of the project.

The software provides short term forecast in words (4-6 hours) using the famous Zambretti forecast model :

  • 4-6 hour forecast in words
  • Trend in words
  • Temperature
  • Dewpoint
  • Heat Index
  • Humidity
  • Absolute Pressure
  • Relative Pressure
  • Battery Voltage (V)

Step 22: Conclusion

Today I have received the Solar Panel and installed it. I really love the final outcome of the project.

In future, my plan is to add wind and rainfall measuring sensors like this project .

I am thinking to make a DIY kit for this project, but not finding a suitable vendor who can do this for me. Be in touch for more updates.

Update on 15.02.2019 :

Now you can order the PCB from PCBWay
Sign up PCBWay now to get a US $5 coupon. That means your first order is free of cost only you have to pay the shipping charges. When you place an order, I will get 10% donation from PCBWay for contribution to my hard work. Your little help may encourage me to do more awesome work in the future. Thank you for cooperation.

Thanks for reading my Instructable.

If you like my project, don't forget to share it.

Comments and feedback are always welcome.

PCB Contest

First Prize in the
PCB Contest

5 People Made This Project!


  • Backyard Contest

    Backyard Contest
  • Pets Challenge

    Pets Challenge
  • Beauty Tips Contest

    Beauty Tips Contest

169 Discussions


Question 16 days ago

First of all, super project!
I have successfully 3D printed, ordered parts and PCB and assembled.

Now i want to add a moisture sensor, but I cannot figure out how to get it to work by adding readings to serial monitor or thingspeak.

What and where do i need to add some code? Any libraries I need to download?

My sensor:
My thingspeak:

2 answers

Answer 12 hours ago

Hi staxen, The link for the sensor took me to an aliexpress page. Is that correct? It shows the sensor itself (that goes in the ground) plus an electronics module and some connecting wires. Do you have the complete package, or only the sensor itself?
As I understand it, this sensor provides two outputs, one analog (labelled A0) and one digital (labelled D0). The electronics module presumably senses the analog voltage on A0 and applies a threshold to it. Below the threshold D0 will be low, above it will be high. The pot allows you to adjust the point at which the change occurs.
To use the analog output, you really need an ADC input on your microcontroller. The WeMos D1 mini pro used in this project only has 1 ADC input, which is used to measure the battery voltage. You would either need to give up that function, add an external ADC such as an ADS1115, which would connect to the I2C interface.
To use the digital output, that can be connected to one of the ports provided on the PCB, such as Port 2 which gives you access to digital pin D8.
If you let me know what your hardware is going to look like, we can then talk about software.


Reply 8 hours ago

Hi Keith

Thanks for the feedback.

It's correct that the link is for a sensor on the Ali supermarket, I'm planning to use it to meassure soil moisture in the garden.
I think I made a quick fix by using ESP easy as the code for the D1 Mini, and soldering an extra cable on top of the A0 pin, and the ESP easy cannot meassure voltage so thats probably why it seems to work.
I will look into you other suggestions, it would be nice to have both the battery feature and soil moisture on the same setup :)


2 days ago

Hi, is there any chance in next pcb update to add 3V3, GND, TX, RX connector to connect e.g. sigfox modem for sending data to long range?


4 weeks ago

Hiya! Do you think that PCB could be made one-sided? We have a Bantam Mill at my school and I'm thinking about doing this project with a student, haven't totally gone under the hood looking at the PCB yet...

1 reply

Reply 14 days ago

To make a single sided PCB, you normally need to optimise the pattern, and add links using copper wires between areas that can't be joined and need to be. In order to make it possible to add the copper wires, you need to make solder pads with a drill hole so that the wire can be put through and soldered in place. So I think it is quite a big re-design you would need to undertake. Possible? Yes. Easy? No.


Question 7 weeks ago

Hello Community,
I´ve got a question. How can i integrate another sensor - in my case a DS18B20 - into the sketch? Does anyone have an example? I would like to use it with blynk.

Thank you and have a nice day!

2 answers

Answer 5 weeks ago

Hi GerritK4

OK all done and works great, I have used the DS18B20 as a pool temp sensor to go along with my BME280, I`m not using the pressure reading so used the spare gauge to display my pool temperature.

If you look at the code I used D7 as the pin to read the sensor.
You also need to download the Dallas library.
I also shortened the code right down to basics.

Any problems ping me back.

Hope this is of help to anyone else out there, cheers

#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_PIN D7
OneWire oneWire(ONE_WIRE_PIN);
DallasTemperature sensors(&oneWire);
Adafruit_BME280 bme;

void setup() {

Blynk.begin("Blynk code", "WiFi SSID", "WiFi Password");
Adafruit_BME280::FILTER_OFF );
//delayTime = 60000;
void loop() {
void measurementEvent() {


float temperature = bme.readTemperature();
temperature = temperature + -2 ;
float humi = bme.readHumidity();
float pool = (sensors.getTempCByIndex(0));

// Voltage divider R1 = 220k+100k+220k =540k and R2=100k
float calib_factor = 5.28; // change this value to calibrate the battery voltage
unsigned long raw = analogRead(A0);
float volt = raw * calib_factor / 1024;

Blynk.virtualWrite(0, temperature); // virtual pin 0
Blynk.virtualWrite(1, humi); // virtual pin 1
Blynk.virtualWrite(2, pool); // virtual pin 2
Blynk.virtualWrite(3, volt); // virtual pin 3

void goToSleep() {
ESP.deepSleep(5 * 60 * 1000000);


Reply 18 days ago

Thank you for your help. I was very busy in the last weeks and could try it now. If i need help i will ping you.


Question 21 days ago

Hi, what a great project his is!!! And as a newbie tot IoT I dove into the documentations how ever I am running into some problems.

Finally I got i working with Thingspeak but not with Blynk. Though still have some questions.

1. Why is the altitude climbing up from -23 to ...., I live in a place 15 above sealevel. This should be a fixed parameter though?
2. Any tips on how to connect the UV meter GY-1145 and have it read out properly?
3. Any tips on how to connect the external temperature gauge? I want to put this in the sun.
4. I liketo measure the air quality with the MQ-2 gas sensor. any idea how?

Any information that would help me forward is helpful. Kind regards and lots of kudo's to the designer.


5 answers

Answer 20 days ago

Hi kverwater, Re your questions 2, 3 and 4 relating to the GY-1145, an external temperature sensor, and a MQ-2 gas sensor.
The first two are addressed in Step 4. GY-1145 is an I2C device and can easily be connected to the provided I2C port.
You can connect an external digital temperature sensor DS18B20 to port P2.
MQ2 is a lot more complicated/difficult. It depends on how determined you are.
First, MQ2 requires a 5V supply (+- 0.2V), which is not available because this is a battery powered project using a single Lithium cell. Also the power requirement is quite significant and may need significant change in the solar panel and battery capacity. It is not clear to me from the MQ2 data sheet how well the sensor will operate with a low duty cycle.
Assuming you can solve the power supply question, you can get the 5V required using a boost converter module to generate 5V from the 3.7V battery voltage.
The next problem is that the output of the MQ2 is inherently an analog voltage level. Some modules are available with a built-in amplifier and threshold detector, so you can connect them to a digital input on the WeMos. However to get the best information possible from your gas sensor, you need an analog input. Since in this project, the single analog input on the WeMos is allocated to measuring the battery voltage, you either have to re-allocate that to your gas sensor and give up on battery voltage monitoring, or else add an additional ADC device. You can (for example) add an ADS1115, connected to the I2C port, which will give you 4 analog inputs, one of which can be used for the gas sensor.
All these additional components needed to support the MQ2 would need an additional circuit board.
In summary, adding a GY-1145 and DS18B20 is very simple. Adding an MQ2 sensor entails significant complexity but is possible.
I hope this helps.


Reply 20 days ago

Well Keith Thanks a lot for your clear explanation. It sounds logical and since this is my first project, i guess adding the gas sensor is a bit overkill for me at this stage.

So I like to stick with the digital sensors and see if I can get it to work on Blynk. It all works on Thingspeak, so board and periferals are OK.

To get the GY-1145 and DS18B20 to work I need some directions, perhaps you can guide me a bit.
1. To Add the GY-1145 what code to I need to add to the sketch, to programme the i2C properly and what calculation to make to relay to proper UV index? Also, since the ' box' is a semi closed 3D printed box should it be placed outside the box?

2. to add the DS18B20, can i connect it straight to the board or must is used the provided pluggable terminal. In that case the pin-layout is different and need some wires. Also what code is required to have this sensor read properly?

3. For gas monitoring would the BME680 be a possible solution? Or even the Grove - Air Quality Sensor v1.3 which seem to operate on 3.3 V? My aim is to measure air quality as an index, like clean, moderate and polluted..

4. Maybe not a proper question but Thingsspeak is only1 one year free registration and offers not enough flexibility. And having a spare raspberry lying around i was wondering if I could use that as a WeeWX server and read the stream from the Wemos. Any thoughts?

Kind regards,



Reply 19 days ago

Hi Kees / kverwater,
Adafruit have published a library for the GY-1145 (SI-1145) which gives you access to the basic functions. Basically you will need to follow the example and copy the relevant parts of it into your code for this project. Although written for an Arduino Uno or similar, it compiles for the WeMos and I think it will almost certainly work for you.
If you want the UV values to correspond to the real world, it will need to be exposed to it.
To connect the DS18B20 you can use any connector you like, or no connector, so long as the wires are connected the right way. You may be able to use the "pluggable terminal" in your picture, simply by using the pins not according to their labels. However you need to check what the two components are doing, and possibly remove them. If they are for example LED (on the right) and resistor (on the left), they will need to be removed, and assuming the connections then go straight through you can use the 3 pins (right to left) as Vcc, Data, GND as per the PCB. You may need to add a pull-up resistor about 4.7K between data and Vcc.
The software library DallasTemperature.h makes working with the DS18B20 quite easy.
As for gas sensing, yes the BME680 looks like a good prospect. It still has a heater but the power requirement is probably manageable in the solar powered project. It operates on 3.3V so there is no voltage problem. I have not researched the Grove device.
I don't know about WeeWX.
When you get Blynk working you may find it meets all your needs.


Answer 20 days ago

Hi kverwater,
Re your question 1 about altitude: this value is generated by the line of code:
float altitude = bme0.calcAltitude (pressure);
If your device is located at a fixed altitude, this is probably not very useful to you, and you would be better off calculating the "normalised pressure" which is the pressure at mean sea level, based on the current air pressure (measured) and the altitude (known). To do this you could replace the above line with
float normalisedPressure = bme0.calcNormalisedPressure (pressure, altitude);
or in your case:
float normalisedPressure = bme0.calcNormalisedPressure (pressure, 15);
You can get more information about this calculation at
I will have a look at your other questions and reply if I find something useful.


Reply 20 days ago

Thanks, I added the value (15) with the hight of my place of residence plus the height of the building.
Read you library and clear to me now.


Question 22 days ago

Hi, what a great project his is!!! And as a newbie tot IoT I dove into the documentations how ever I am running into some problems.

The Wemos D1 mini pro is working. I played and uploaded the blynk example and it is working. Also installed all libraries as explained and modified the settings.h file with the proper parameters. I even created a 2.4GHz wifi guest network without a space in it.
I Rotated the 0 ohm resistor to properly use the external antenna.

When i upload the v 2.0 code it seems to upload properly since i get no error codes.

I compiled and tested with Thingspeak and Blynk but on both applications i do not receive any readings.
I also had enough fuel to download Blynk so no issues with this.

So I have some questions.

1. How can I check if the Wemos connects properly to my network? What MAC should i see in my routers DHCP? LED blinking??
2. Is there method to connect to the Wemos via Putty or so?
3. Is there any troubleshooting guide available for a newbie?

Any information that would help me forward is helpful. Kind regards and lots of kudo's to the designer.



Question 26 days ago on Step 18

good morning, congratulations for the project, I tried to download the rar file but it gives me a damaged archive. Is it possible to have the file working?
thank you


5 weeks ago

Hi great project.

just completed it a few days ago and its working fine.

However even with the solar panel recharging up the battery, I noticed that the battery level is still dropping and not being maintained.

I took the Wemos board out to check to current consumption, on transmitting data its about 70mA which is correct, and the ESP8266 goes to sleep, however I`m seeing a 4mA battery drain and can only put this down to the onboard voltage regulator and the USB programming chip.

How are you getting such low current readings?, how are you putting these devices into low power mode?

Another issue I have found is that consistently I`m finding the temperature readings to be about 4 degrees higher than they should be, I also tried another BME280 and had the same readings, but if I use the sensors with an Arduino, the readings are correct.

Any ideas on how to solve that issue?

Cheers Alan

2 replies

Reply 5 weeks ago

Hi Topspliff, Can you confirm that you are seeing 4mA current consumption of the WeMos board, even when it is asleep?
The current consumption budget for the WeMos is in Step 7.
The TP4056 charging module should be using 0.05 mA (max 0.1mA).
The BME280 used in single-shot mode will be using 0.0001 mA when asleep.
If your WeMos has a CH340 USB interface IC, it is put to sleep when the processor goes to sleep, and uses 0.05mA when asleep.
The voltage regulator RT9013 has a quiescent current draw of about 0.025 mA.
The ESP8266 processor uses 0.01 mA when asleep.
So during the "sleep" period between reports, the total current consumption should be of the order of 0.135mA.

If you want to dig into why you are getting different temperature numbers with the Wemos and an Arduino Uno or Nano, you probably need to look at the raw temperature reading and the associated calibration parameters that are used to convert into Celsius.


Reply 4 weeks ago

Hi Keith

Apologies I did answer nearly a week ago, just checked and for whatever reason my reply is not here.

Anyway in answer to your question, yes I do confirm the 3.8mA current drain, I actually removed the wemos board from my installation to double check, and can confirm the current used in deep sleep mode.

However having returned back to this post and looking very carefully, I may have found the reason, it being its a slightly different wemos board, although in principle the same, for sure the voltage regulator is different, the one I think you get on the standard ESP8266 dev boards, so this I believe is the issue.

I have ordered the exact same one as in the project details, so will confirm my findings once that is programmed up and in place.

Although currently it does not appear to be an issue, as I live in Jakarta Indonesia where we have a very hot sun currently and this seems to be keeping the battery topped up quite well, at least now as I found out that I had purchased the wrong solar cell so even in full sun it was not pushing out more than 4.4v, so I now have a small step up regulator connected from the solar cell, boosting the voltage up to a clean 5v which then goes into the LiPo charger, seems to work quite well.

Cheers Alan