Solar Powered WiFi Weather Station V1.0




In this Instructable, I am going to show you how to build a Solar powered WiFi Weather Station with a Wemos board. The Wemos D1 Mini Pro have small form-factor and a wide range of plug-and-play shields make it an ideal solution for quickly getting started with programming the ESP8266 SoC. It is an inexpensive way to build the Internet Of Things ( IoT ) and is Arduino compatible.

You can also look at my new version-2.0 Weather Station.

You can buy V2.0 PCB from PCBWay.

You can find all of my projects on

The new Weather Station has the following features:

1. The Weather Station can measure: Temperature, Humidity, Barometric Pressure, Altitude

2. You can monitor the above weather parameters from your Smartphone or from the web ( )

3. The whole circuit along with power supply is put inside a 3D printed enclosure.

4. The range of the device is enhanced by using a 3dBi external antenna. It is around 100 meter.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts and Tools Required

1. Wemos D1 Mini Pro (Amazon / Banggood )

2. TP 4056 Charging Board ( Amazon / Aliexpress )

3. Diode ( Aliexpress )

4. BME 280 sensor ( Aliexpress )

5. Solar Panel ( Banggood )

6. Perforated Board ( Banggood )

7. Screw Terminals ( Banggood )

8. PCB standoffs ( Banggood )

9. Li Ion Battery ( Banggood )

10. AA Battery Holder ( Amazon )

11. 22 AWG wire ( Amazon / Banggood )

12. Super Glue ( Amazon )

13. Duct Tape ( Amazon )

14. 3D printing filament -PLA ( GearBest )

Tools Used :

1.3D Printer ( Anet A8/ Creality CR-10 Mini )

2. Soldering Iron ( Amazon )

3. Glue Gun ( Amazon )

4. Wire Cutter / Stripper ( 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 14450 Li-Ion battery instead of a 18650 battery because of its smaller size. The size is the same as of an AA 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: Measuring the Weather Data

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, BMP280, etc.

In this project, we will use a BMP 280 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 to buy I2C version board.

Step 4: 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 watch this video made by Alex Eames to rotate the zero ohm resistor.

Then snap the antenna SMA connector into the Wemos Pro mini antenna slot.

Step 5: Solder the Headers

Wemos modules come with a variety of headers but you have to solder it according to your requirement.

For this project,

1. Solder the two male headers to the Wemos D1 pro mini board.

2. Solder a 4 pin male header to the BMP 280 module.

After soldering the headers the module will look as shown in the above picture.

Step 6: Adding Headers and Terminals

Next step is soldering the headers to the perforated board.

1. First, place the Wemos board over the perforated board and mark the footprint. Then solder the two row of female headers over the marked position.

2. Then solder a 4 pin female headers as shown in the picture.

3. Solder screw terminals for battery connection.

Step 7: Mount the Charging Board :

Stick a small piece of double-sided tape on the back side of the charging module and then paste it on the perforated board as shown in the picture. During mounting care should be taken to align the board in such a way that the soldering holes will match with the perforated board holes.

Adding terminal for Solar Panel

Solder a screw terminal just near the micro USB port of the charging board.

You can solder this terminal in the earlier step also.

Step 8: Wiring Diagram

First I cut small pieces of different colors wires and strip out the insulation at both ends.

Then I solder the wires according to the Schematic diagram as shown in the above picture.

Wemos -> BME 280

3.3 V - -> Vin


D1 --> SCL

D2 --> SDA

TP4056 Connection

Solar Panel terminal -> + and - near the micro USB port

Battery Terminal -> B+ and B-

5V and GND of Wemos -> Out+ and Out-

Note :The diode connected to the solar panel ( shown in the schematic ) is not required as the TP4056 module have in built diode at the input.

Step 9: Designing the Enclosure

This was the most time-consuming step for me. I have spent around 4 hours to design the enclosure. I used Autodesk Fusion 360 to design it. The enclosure has two parts: Main Body and Front Cover

The main body is basically designed to fit all the components. It can accommodate the following components

1. 50x70mm circuit board

2. AA battery holder

3. 85.5 x 58.5 x 3 mm Solar Panel

4. 3dBi external antenna

Download the .stl files from Thingiverse

Step 10: 3D Printing

After completion of the design, it is time to 3D print the enclosure. In Fusion 360 you can click on the make and slice the model by using a slicer software. I have used Cura to slice the model.

I used an Anet A8 3D printer and 1.75 mm green PLA to print out all the body parts. It took me about 11 hours to print the main body and around 4 hours to print the front cover.

I will highly recommend using another printer for you that is Creality CR - 10. Now a mini version of the CR-10 is also available. The Creality printers are one of my favorite 3D Printer.

As I am new to 3D designing, my design was not optimistic. But I am sure, this enclosure can be made by using lesser material ( less print time ). I will try to improve the design later.

My settings are:

Print Speed : 40 mm/s

Layer Height: 0.2

Fill Density: 15%

Extruder Temperature: 195 deg C

Bed Temp: 55 deg C

Step 11: Installing the Solar Panel and Battery

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.

Then insert the battery holder into the slot at the bottom of the enclosure.

Step 12: Installing the Antenna

Unscrew the nuts and washers in the SMA connector.

Insert the SMA connector into the holes provided in the enclosure. See the image above.

Then tighten the nut along with the washers.

Now install the antenna by properly aligning with the SMA connector.

Step 13: Installing the Circuit Board

Mount the standoffs at 4 corners of the circuit board.

Apply super glue at the 4 slots in the enclosure. Refer to the above picture.

Then align the standoff with the 4 slots and place it. leave some to dry it out.

Step 14: Close the Front Cover

After printing the front cover, it may be not perfectly fit to the main enclosure body.If it is the case, just sand it at the sides by using a sand paper.

Slide the front cover in to the slots in the main body.

To secure it, use duct tape at the bottom.

Step 15: Programming

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

Arduino Code for Blynk App :

Sleep Mode :

The ESP8266 is a pretty power hungry device. If you want your project to run off a battery for more than a few hours, you have two options:

1. Get a huge battery

2. Cleverly put the Thing to sleep.

The best choice is the second option. Before using the deep sleep feature, Wemos D0 pin must be connected to the Reset pin.

Credit: This was suggested by one of the Instructables user " tim Rowledge ".

More Power Saving Option :

The Wemos D1 Mini has a small LED that lights when the board is powered. It consumes a lot of power. So just pull that LED off the board with a pair of pliers. It will drastically drop the sleep current down.

Now the device can run for a long time with a single Li-Ion battery.

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space<br>#include < ESP8266WiFi.h>
#include  <BlynkSimpleEsp8266.h ></p><p>
#include "Seeed_BME280.h"
#include < Wire.h>
BME280 bme280;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "3df5f636c7dc464a457a32e382c4796xx";// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "SSID";
char pass[] = "PASS WORD";
void setup()
  Blynk.begin(auth, ssid, pass);
  Serial.println("Device error!");

void loop()
  //get and print temperatures
  float temp = bme280.getTemperature();
  Serial.print("Temp: ");
  Serial.println("C");//The unit for  Celsius because original arduino don't support speical symbols
  Blynk.virtualWrite(0, temp); // virtual pin 0
  Blynk.virtualWrite(4, temp); // virtual pin 4
  //get and print atmospheric pressure data
  float pressure = bme280.getPressure(); // pressure in Pa
  float p = pressure/100.0 ; // pressure in hPa
  Serial.print("Pressure: ");
  Blynk.virtualWrite(1, p); // virtual pin 1
  //get and print altitude data
  float altitude = bme280.calcAltitude(pressure);
  Serial.print("Altitude: ");
  Blynk.virtualWrite(2, altitude); // virtual pin 2  //get and print humidity data
  float humidity = bme280.getHumidity();
  Serial.print("Humidity: ");
  Blynk.virtualWrite(3, humidity); // virtual pin 3
  ESP.deepSleep(5 * 60 * 1000000); // deepSleep time is defined in microseconds.

Step 16: Install Blynk App and Library

Blynk is an app that allows full control over Arduino, Rasberry, Intel Edison, and much more hardware. It is compatible with both Android and iPhone.Right now the Blynk app is available free of cost.

You can download the app from the following link

1. For Android

2. For Iphone

After downloading the app, installed it on your smartphone.

Then you have to import the library on to your Arduino IDE.

Download the Library

When you run the app for the first time, you need to sign in – to enter an email address and password. Click the “+” at the top-right of the display to create a new project. Then name it.

Select the target hardware " ESP8266 "Then click “E-mail” to send that auth token to yourself – you will need it in the code

Step 17: Make the Dash Board

The Dashboard is consists of different widgets. To add widgets follow the steps below :

Click “Create” to enter the main Dashboard screen.

Next, press “+” again to get the “Widget Box”

Then drag 4 Gauges.

Click on the graphs, it will pop up a settings menu as shown above.

You have to change the name "Temperature", Select the Virtual Pin V1, then change the range from 0 -50. Similarly, do for other parameters.

Finally, drag a graph and repeat the same procedure as in gauge settings. The final dashboard picture is shown in the above picture.

You can change the color also by clicking the circle icon on the right side of the Name.

Step 18: 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 Temperature, Field 2 as Humidity and Field 3 as pressure.

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. Then write your SSID and Password.

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

Required Library: BME280

Credit: This code is not written by me. I got it from the link given in a YouTube video by plukas.

Step 19: Final Test

Place the device on sunlight, the red led on TP 4056 charger module will lit up.

1. Blynk App Monitoring:

Open the Blynk project. If everything is Ok, you will notice the gauge will live and the graph starts to plot the temperature data.

2. ThingSpeak Monitoring :

First, open your Thingspeak Chanel.

Then go to the “Private View” tab or “Public View” tab to see the Data Charts.

Thanks for reading my Instructable.

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

Microcontroller Contest 2017

First Prize in the
Microcontroller Contest 2017

15 People Made This Project!


  • Assistive Tech Contest

    Assistive Tech Contest
  • Reuse Contest

    Reuse Contest
  • Made with Math Contest

    Made with Math Contest

281 Discussions


22 days ago


Is there anyway to add MQTT to this so the data can be sent to Home Assistant?



8 weeks ago

Have created the project and it works for the most part. However, after a couple of minutes the data from the BME280 jumps to a set of values that are not true and they do not change. Temperature gets stuck at 25.43 degrees, pressure at 699hPa, altitude at 3019m (which is out by around 2900m!) and 77% humidity. Once the module starts producing these values it becomes hard stuck until i reset. Has anyone had similar issues?


Reply 5 months ago

Hi what`s the problem, you only need to connect the USB cable to the wemos and your PC!


10 months ago

I dont get...i've got exactly the same parts (just a tiny difference with the mAh of the battery), and my battery is fully charged (i get 3.8v on the meter), but the wemos wont do anything when it's powered by the battery. Just blinks once and then nothing. It's as if it doesnt have enough power to function properly. When i power it up from a usb 5v shield everything works fine.
Measuring the voltage with battery, at the 5v pin i get 3.5v and when i reset the wemos the BME pin reads 3.2v. (I got a cheap multimeter...maybe that's why)
I got 2 of these batteries (
Could it be the mAhs ?
I dont know...i cant think of a solution :/

4 replies

Reply 9 months ago

hmm, mine says 4B2X..crap i guess i got a fake one. I have to find a 500ma one i guess uh?


Reply 8 months ago

Yup :/ I have encountered this too and it's a pain. I will now only buy the Wemos units that have the logo.


Reply 8 months ago

That reddit site you sent was awesome, thank you for that, got lots of info about this problem. Unfortunately lots of people are in the same boat as I am, even with a Wemos logo on the device. I'll have to wait till i find a 100% real wemos either in Aliexpress or Ebay, anything else will cost too much...for a 'cheap' weather station, lol.
It would be cheaper to just buy a normal wifi station.


2 years ago

I love your project and would like to expand on it, adding in a few sensors: rain, wind speed, wind direction, UV, battery voltage. However I'm a total novice when it comes to electronics and am hoping the community can help. I've attached my draft layout, and would really welcome any feedback on what I've got wrong!! Specific questions are as follows:

1. The rain sensor and wind speed will be interrupts based on reed switches. Is it Ok to connect the reed switch directly between GND and a digital pin, or do I need resistors in there somewhere?

2. I've multiplexed the Analog pin to read the wind direction potentiometer, UV sensor and battery monitor. Again, am I resistors missing here?

3. I've proposed a PNP transistor controlled via D2 to turn on/off the voltage monitor, with a 1k resistor - do I need it and if so is 1k sufficient?

4. I've put a momentary switch between D5 and GND which will be used to boot the D1 Mini into WIFI AP config mode to set SSID, add WeatherUnderground API etc.

As you can see from the questions, I know that I don't know much about the resistors, but I'm sure that there are other basic errors that I don't know about!

Thanks in advance for your support.

Weather Station Project_bb.jpg
9 replies

Reply 2 years ago

Its quite ambitious. I suggest you go one step at a time.

Re your questions:

1. no resistors needed, provided you activate the pull-up resistors built in to the ESP8266 (rain on D8 and Wind speed on D7)

2. I think you need to study your multiplexer for the analog voltage input more carefully. Its a bit hard to understand from the picture you provided, but I think you intend to use D2 (for Vcc), D6 (for wind direction) and D7 (for UV level). D6 and D7 will be set Low when not measuring and High when measuring. D2 (for Vcc) will be the reverse, that is Low when measuring and High when not measuring. The emitter of the PNP transistor is connected to Vcc, the base goes to D2 via a 1K resistor, and the collector goes to A0 via a diode.

You need to provide a resistive voltage divider for these measurements, because the analog input can only measure between 0 and 1 Volt. The divider could be (say) 23K and 10K so that 3.3V at the junction of the 3 diodes will translate to 1.0V at pin A0. The values you should use depend on the resistance of your UV sensor, and the pot you are using for wind direction. There are good articles on resistive voltage dividers on the internet.

Also depending on the diodes you use, the voltage drop in the diodes will affect the values you get, which will need to be compensated if you want accurate results.

3. The size of the resistor from D2 to the base of the PNP transistor should be less than the resistance of the above voltage divider, and the minimum current gain of the PNP transistor you are using.

4. No resistor needed as long as you set the internal pull-up. I don;t understand how you will use this input, so I can't comment on the function you intend.

Other comments:

I see your picture has the battery charge controller without undervoltage cut-off.. I think the undervoltage cut-off is a very desirable function to get, to protect your battery from over dischage, which can ruin it.

Good luck and enjoy the journey.


Reply 9 months ago

Dear Farmerkeith, could you tell me why the definition of voltage does not work for me? I connected the pin 5V through the resistance of 100k to A0. The connected cord in the USB, the port monitor shows Voltage - 5.1 volts. And in the Blynk program shows a zero. Zero Blynk shows when the cord is disconnected USB. When I used the sketch for Thingspeak, the power voltage I saw on the site in the field. And in Blynk for some reason does not work.


Reply 9 months ago

Hi ГеннадийБ2 I think your problem is probably in the software. You do not say what software you have loaded. Have you tried using the software that is included in the Version 2.0 Instructable for this project? It includes code for measuring voltage, unlike the V1.0 software which does not have the voltage measurement in it. The V2.0 software should work with the hardware of the V1.0 design and the additional connection you have described.


Reply 9 months ago

I corrected the sketch a little, but maybe I did something wrong. I use this sketch Com port, with USB connected writes this: "Start of solarWiFiWeatherStationESP_21Jan2019
Temperature samples=2 Pressure samples=16 Humidity samples=16 Voltage samples=2
Atm pressure = 762.37 mmPct. Temperature = 24.71 deg C. Humidity = 40.53 %RH. Altitude = -26.22 m.
Voltage = 5.10 V
Going to sleep now for 28.823 seconds.
Time going to sleep=1.178"
When the USB cable is connected to the Wemos board, the Blynk shows 5.1V. As soon as I unplug the USB cable, the readings in Blynk disappear and show 0. And I also noticed that if "volt" is assigned to the 4 virtual port in 51 lines, then Blynk always shows 0, both when the USB cord is turned on and off.


Reply 8 months ago

Hi ГеннадийБ2

I want to be sure you have connected the restart link in the hardware. D0 has to be connected to RST pin. Otherwise the software will run once and then sleep forever. It could be that having the USB connected allows it to restart (I am not at all sure about that). Anyway please check and let me know if that connection is there in your hardware. If it is not, put the link in and see if the problem goes away.

You say you "corrected the sketch a little". Maybe you can tell me what you changed: or try running the original software without any changes and see what it does.

When I look at my copy of this software, it is file PTH.sleep.h in line 45 that there is a line:
Blynk.virtualWrite(4, volt); // virtual pin 4
Is this the "51 lines" you are referring to?
I guess you may have added some lines before this in that file.



Reply 8 months ago

Thank you for trying to help me. I found a solution to my problem. First, I connected A0 through a 200k resistor to TP4056 "Out +". The voltage at this output will not exceed 4.2 volts. Next, I changed the code to see what comes to A0.
pinMode (A0, INPUT);
float raw = analogRead (A0);
float volt = raw;
// volt = volt * 5.1;
and I saw the following: when the output voltage "Out +" was 3.89 volts, the reading on "volt" in Blynk was 785. Then I changed the code again to this:
pinMode (A0 INPUT);
float raw = analogRead (A0);
float volt = raw / 785;
volt = volt * 3.89;
and the value of "volt" resembled the voltage at the output of "Out +". I waited for the sun to shine brightly on the solar panel, and the "volt" value in Blynk showed 4.2 volts. That was what I needed. Why it happens? Probably somewhere on the board are wrong resistance. The most important thing is that everything works now. And Blynk shows almost exact voltage applied to pin 5V. Now I'm interested in, is it possible to simultaneously send data to both Blynk and ThingSpeak?


Reply 8 months ago

Hi ГеннадийБ2i
The solution to you voltage reading is a bit of a puzzle. However I am glad it has come good for you.
One of the things missing in the original code is the line:
pinMode (A0, INPUT);
I had thought this line would be redundant (unnecessary) because the default configuration of pin A0 is as INPUT. However maybe it is needed, perhaps only in some versions of the Arduino IDE. You could check whether your code stops working if you comment out this line.
In the second version of your code, the comma between the A0 and INPUT is missing. That should cause a compile error, so I suspect you did not remove that comma.
Next, a comment on the scaling. Your scale factor from the raw reading to the displayed "volt" value is 3.89/785 which is 0.004955414, while the scale factor in the original code is 5.1/1023 = 0.004985337. The ratio between these is 1.00604, that is there is a 0.6% difference between the scaling factors. So the original code and your new code are scaled almost identically.
It seems to me most likely that the critical line that makes your new code succeed is the pinMode line.
As for your question about sending data to both Blynk and Thingspeak. I think it is definitely possible.
I have not tried to do this, but for a start I have the following suggestions:
Where lines 17 and 18 in the main code currently give you the options of BLYNK and Thingspeak, add a new line such as:
const String App = "BOTH"; // alternatives are lines below
Then change line 51 from
if (App == "BLYNK") { // choose application
if (App == "BLYNK" || App == "BOTH") { // choose application
and then change line 53 from
} else if (App == "Thingspeak") {
if (App == "Thingspeak" || App == "BOTH") {
Note that you have to remove the "else" from this line, and (preferably) break it into 2 lines so that the first "if" statement is terminated and the second one is an independent "if" statement. That way they are both executed if the value of App is "BOTH".

And then over in the PTHsleep.h file, you do a similar thing in the code for the measurementEvent() function.
I am not sure how familiar you are with writing code, but this should get you started at least. Feel free to ask more if you have trouble.


Reply 1 year ago

To Needlerp, one point of correction relating to my earlier reply.

The A0 anlog input of the WeMos D1 Mini Pro has a resistive voltage divider connecting it to the ADC input of the ESP8266 microcontroller.

There is a 220K resistor from A0 to the ADC pin, and a 100K resistor from the ADC pin to Ground. This means that the 1 volt range, and 1 mv lsb sensitivity of the ESP8266 ADC, is transformed into a 3.2 volt range, and 3.2 mv lsb sensitivity.

You also need to take into account the resultant 320K input impedance of the WeMos A0 pin when designing your input voltage circuits.

If you have specific questions I will be happy to help you more.


Reply 2 years ago

Hi Needlerp!

I would like to put this project on WU!

Can you share your code to my understand of this process?



9 months ago

How long do all these parts survive, exposed to the elements like that?