Solar Powered WiFi Weather Station

182,692

1,264

242

About: I am an Electrical Engineer. I love to harvest Solar Energy and make things by recycling old stuff. I believe, IF YOU TRY YOU MIGHT, IF YOU DON'T YOU WON'T. www.opengreenenergy.com

Intro: Solar Powered WiFi Weather Station

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 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 Internet Of things ( IoT ) and is Arduino compatible.

You can find all of my projects on : https://www.opengreenenergy.com/

The new Weather Station have 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 ( ThingSpeak.com )

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 an 3dBi external antenna .It is around 100 meter.

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 farm house).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 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 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 to buy a module which have 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 over voltage 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 microcontroller. For simple easy wiring, I will suggest to by I2C version board.

Step 4: Using an External Antenna ( 3dBi )

The Wemos D1 mini Pro board have a 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 Eamesto rotate the zero ohm resistor.

Then snap the antenna SMA connector in to the Wemos Pro mini antenna slot.

Step 5: Solder the Headers

Wemos modules come with variety of headers but you have to solder it according 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 foot print.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 a screw terminals for battery connection.

Step 7: Mount the Charging Board :

Stick a small piece of double sided tap 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 colours 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

GND --> GND

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 have 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 design, it is time to 3D print the enclosure.In Fusion 360 you can click on 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 to use 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 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 degC

Bed Temp : 55 degCr

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 in to 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 in to 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 in to 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 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 deepsleep 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 consume 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 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()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Serial.begin(9600);
  if(!bme280.init()){
  Serial.println("Device error!");
  }
}

void loop()
{
  Blynk.run();
  
  //get and print temperatures
  float temp = bme280.getTemperature();
  Serial.print("Temp: ");
  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: ");
  Serial.print(p);
  Serial.println("hPa");
  Blynk.virtualWrite(1, p); // virtual pin 1
  //get and print altitude data
  float altitude = bme280.calcAltitude(pressure);
  Serial.print("Altitude: ");
  Serial.print(altitude);
  Serial.println("m");
  Blynk.virtualWrite(2, altitude); // virtual pin 2  //get and print humidity data
  float humidity = bme280.getHumidity();
  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println("%");
  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 Edision and many more hardware.It is compatible for both Android and IPhone.Right now the Blynk app is available with 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 – so 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 stat to plot the temperature data.

2. ThingSpeak Monitoring :

First open your Thingspeak Chanel.

Then go to “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

10 People Made This Project!

Recommendations

  • Metalworking Contest

    Metalworking Contest
  • Tiny Home Contest

    Tiny Home Contest
  • Fix It! Contest

    Fix It! Contest

242 Discussions

0
None
MarioV98

Question 9 days ago

My batteries (4x 2000 mAh AA's) go flat after about a week and the station obviously stops working. Do I need the more powerful single battery as described above or could there be something else wrong? There was plenty of sun coming to the solar panel btw.

3 more answers
0
None
farmerkeithMarioV98

Answer 9 days ago

Hi MarioV98, I think your problem is that the solar panel is not big enough to keep up with the energy usage of the WeMos. It will not be solved by using a bigger battery, all that will do is make it take longer to go flat. I think you have two options: a) increase the solar panel (eg add a second panel in parallel to the first one); or b) use sleep mode so that the Wemos goes to sleep in between readings, which saves a lot of energy.

There are quite a lot of other discussions about using sleep mode in this project. I suggest you have a look at those, and if you can't figure out what to do please come back for more guidance.

Keith

0
None
MarioV98farmerkeith

Reply 8 days ago

Thank you very much, Keith!

The WeMos does go into sleepmode already - it wakes up every 5 min now. I'll try to increase that to 10 min and see if the batteries 'survive' longer. We don't get a lot of sun here in the Netherlands at the moment so that is definitly a thing.

I do have a second solar panel that is not used at the moment. I'll try that if the increased sleep doesn't help.

Thanks again! :)

0
None
farmerkeithMarioV98

Reply 8 days ago

Ni MarioV98, My guess is that increasing the reporting interval should solve the problem. I am currently using 10 minutes.

According to my interpretation of this web site http://globalsolaratlas.info/?c=38.410558,408.3398... you should need about twice as much solar panel as me for the same reporting interval (I am in Eastern Australia). This web site may not be the best design guide, since it does not show day-to-day variability, but at least it gives a starting point.

Keith

0
None
warhawk8080

Tip 13 days ago

0
None
BartM27

Question 14 days ago

As said: very helpfull instruction!

I made a similar SolarPower setup. All is well (it keeps up sending data to Blynk) until the battery gets too low. After being recharged high enough the Wemos (D1 Mini) doesn't recover?

On the net I found that this is a 'normal behaviour because 'when the battery gets low the esp8266 gets in indeterminate state and sleep/wake up function stops working'?

A solution seems to be to use hardware like the Sparkfun LiPo Fuel Gauge to monitor the battery level and proper reset the Wemos when battery level is high enough.

It confuses me because so many people reports succes projects without using the above Fuel Gauge? Am I missing something (I miss a lot but you know what I mean ;-)

Thanks again!

0
None
BartM27

23 days ago

Thanks for the great great instruction!

I want to use the same setup as described, but I want the Wemos D1 Mini Pro to connect to a JSN-SR04T ultrasonic water sensor to read the level of a watertank.

This sensor is a 5V and not 3.3V as in your instruction. I searched the web but cannot find a proper answer to the simple (?) question how I can get 5V from a 3.3V device as the Wemos D1 Mini Pro can deliver? Thank you!

4 replies
0
None
farmerkeithBartM27

Reply 20 days ago

Hi BartM27, According to the data sheet, JSN-SR04T will work with supply voltages from 3.0 to 5.5V, so you don't need to boost the supply voltage to it. You can simply connect it to the same power rail as the WeMos.

It is possible to provide 5V to the JSN-SR04T but it will make the circuit a lot more complicated and will use more power, so if it is not necessary it is best to avoid it. The solution is to use a boost converter (readily available from vendors on eBay, Aliexpress, etc.) to create 5V from the battery rail, and then insert a resistive divider between the Echo pin of the JSN-SR04T to protect the ESP8266 in the WeMos from the higher pulse voltage coming back from the JSN-SR-04. The trigger pin can be connected directly. If you are using one of the sensors with a combined Echo and Trigger pin, you would need to use a bidirectional level converter for it.

I provide this information to illustrate that it is possible. However I am pretty sure it is not necessary, and direct connection should work without these complications.

Keith

0
None
BartM27farmerkeith

Reply 14 days ago

Great great answer Paul thanks a lot!

I tried the boost converter already and it did the job. But I didn't thought of protecting the ESP8266 by a resistor... It works but it uses more power, indeed.

I will try if the JSN-SR04T with 3.3V...

Thanks again!

0
None
farmerkeithBartM27

Reply 14 days ago

Hi BartM27, There are lots of warnings "out there" about ESP8266 needing to be protected from voltages higher than its ratings. It may be you can get away with direct connection, but to be sure of not having troubles the divider is a good bit of insurance. Usually a 1K resistor to the Echo pin, a 2.2K to ground, with the junction to the ESP8266 pin is what is used.

But really, just running the JSN-SR04T at 3.3V will be much simpler.

Keith

0
None
BartM27farmerkeith

Reply 14 days ago

Thanks Keith!

It is running since a few hours on the 3.3V power now. Everythings seems to be ok. I will keep an eye on it but so far so good. It's a test environment so I can imagine it will have restrictions like not be able to measure the full depth but just a part of it. But as my watertanks is restricted to a depth of 2,5m, it will be ok (I hope)

0
None
JohnG591

5 months ago

I keep getting the error missing wire.h? Am I missing a certain library I am not aware of?

3 replies
0
None
Raul.JohnG591

Reply 15 days ago

Hi.

I have the same problem. I have managed to overcome this ( almost entirely ) putting inside the house, at about 1.5 cm below of the "roof" a second roof made from undulated cardboard with an aluminum foil glued on top of it ( the sensor is another 2 cm below that ). Now the radiated heat from the sun is reflected back up. I only get direct sunlight for about 1.5 hour from 10.00am -11.00am depending on the season so the difference in temperature is about 2-3 degrees C. I dont need a very precise readings in this time frame. I am more interested in having good readings of the humidity in the evening/night.

Hope that helps

PS - The house that i have build has a different shape and I think it's bigger too

thumbnail.jpg
0
None
farmerkeithJohnG591

Reply 5 months ago

Hi JohnG591, Yes you are missing the library wire.h. Normally it is included by default in your IDE, but there is a different version needed for the ESP8266 which you can get from here:

https://github.com/esp8266/Arduino

0
None
JohnG591JohnG591

Reply 5 months ago

Arduino: 1.8.5 (Windows 10), Board: "WeMos D1 R1, 80 MHz, 4M (3M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

C:\Users\Athruz\Desktop\sketch_apr09a\sketch_apr09a\sketch_apr09a.ino:4:19: fatal error: Wire.h: No such file or directory

#include < Wire.h>

^

compilation terminated.

exit status 1

Error compiling for board WeMos D1 R1.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

0
None
MarioV98

Question 4 weeks ago

I got this working... sort of.
The station is connecting to my WiFi and to the Blynk app and the readings I get seem to be accurate. The only problem is; every time I power it on it only sends out 1 burst of data and then never shows up 'online' again. Power section is working fine and the batteries (4x AA) are charged. Is there something I can adjust or add in the code to prevent this from happening?

2 more answers
0
None
TomiRMarioV98

Answer 4 weeks ago

Connect pin D0 and Reset pin togheter

0
None
MarioV98TomiR

Reply 4 weeks ago

Thank you! That was the problem. Works perfectly now :D

0
None
electricbird

3 months ago

Has anyone tried to add wind and rain measurements?

Cool project by the way:)

1 reply