loading

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.

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 ( Banggood )

2. TP 4056 Charging Board ( Amazon / Aliexpress )

3. BMP 280 sensor ( Aliexpress )

4. Solar Panel ( Banggood )

5. Perforated Board ( Banggood )

6. Screw Terminals ( Banggood )

7. PCB standoffs ( Banggood )

8. Li Ion Battery ( Banggood )

9. AA Battery Holder ( Amazon )

10. 22 AWG wire ( Amazon / Banggood )

11. Super Glue ( Amazon )

12. Duct Tape ( Amazon )


Tools Used :

1. Anet A8 3D Printer ( GearBest )

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 colors wires and strip out the insulation at the both ends.

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

Wemos -> BME 280

5V - -> Vin

GND --> GND

SCL --> D1

SDA --> D2

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 :In the beginning , I forgot to solder the diode.Later I solder it near to the Solar panel terminal and connect it as per the wiring diagram.

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.

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 degC

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.

<p>Good project Deba. </p><p>I have a question about the diode in series with the solar panel. I think it is not there in the parts list at the beginning of the project. Later on you said you initially forgot to solder it into the circuit. My question is, whether it is really necessary. I see in the pdf file of the TP4056 it says &quot;No blocking diode is required due to the internal PMOSFET architecture and have prevent to negative Charge Current Circuit.&quot; - which I would interpret as meaning there is no need for a blocking diode to the supply. However I suspect that you first built the circuit without the diode, and found the battery was discharging into the solar panel when it was dark. Is this correct? Thank you, Keith</p>
<p>Thank you Kaith. Happy to see you after long time.</p><p>You are right in some of my module, I noticed that there is no reverse current but in few modules there is some reverse current.So I added a diode later.</p><p>As per data sheet there is no need of using blocking diode at the input.</p>
<p>Noob question: can I use 22 AWG wire on this or will that cause problems?</p>
<p>You can use 22AWG wire.</p>
<p>Hi, I can't find an available solor panel which can match with this project. Do you have an other link? Thx</p>
<p>You can by the Solar panel from the following link also</p><p><a href="http://s.aliexpress.com/YZNjAN7b">http://s.aliexpress.com/YZNjAN7b</a></p>
<p>I'm working on it. You can see on Thingiverse my print :) (it's the only one).</p><p>I have those diode : <a href="https://fr.aliexpress.com/item/7-kinds-10pcs-70pcs-lot-SMD-diode-package-M1-1N4001-M2-1N4002-M4-1N4004-M7-1N4007/32774058057.html?spm=2114.13010608.0.0.oIGQjF" rel="nofollow">https://fr.aliexpress.com/item/7-kinds-10pcs-70pcs...</a></p><p>This is SMD. Will the work too? thx again</p>
<p>Your link is not opening.</p><p>You can buy this schottky diode.It is better than what I have used :)</p><p> <a href="https://goo.gl/KXPQK3">https://goo.gl/KXPQK3</a></p>
<p>THX !! Just ordered all the stuff :)</p><p>Great work</p>
<p>a nother Noob Question: </p><p>Hi if i try to verify the .indo for blynk it comes only errors:</p><p>ok after that i download the library from bme280</p><p><a href="https://github.com/Seeed-Studio/Grove_BME280/blob/master/Seeed_BME280.h" rel="nofollow">https://github.com/Seeed-Studio/Grove_BME280/blob/...<br></a></p><p>it solve one error but after that it comes with </p><p>BlynkProtocol /BlynkWifi /BlynkSimpleEsp8266.h</p><p>all with undefined reference to `BME280...</p><p>i neeed Help :) </p><p></p>
<p>I am still in awe over the housing you made. Looks fantastic<br>nevertheless, i was wondering what your experience with battery life is.<br>For those who want to increase battery life: consider a bare bones esp8266-12 without the CH3040 usb-ttl chip as the latter consumes relatively much current</p>
<p>for some reason I cannot get this to work! I get this error:<br><br>&quot;xtensa-lx106-elf-g++: error: CreateProcess: No such file or directory<br><br>exit status 1</p><p>Error compiling for board WeMos D1 R2&quot;</p><p>Any ideas?</p><p>Thanks</p>
<p>hy friend<br>Congrats on your won..:)<br>I would like to know which 3D printer you use?</p>
<p>Great project. </p><p>Many parts are &quot;out of stock&quot; now but i will try to collect them and create the weather station</p><p>Thx</p>
<p>Nice job. Thanks for sharing, for when the next iteration?</p>
<p>Thank you.I am not sure about the exact day for the iteration.But after completion I will update here.Keep in touch.</p>
<p>Excellent Instructable. Thank you very much.</p>
<p>My pleasure :)</p>
Great project! Congratulations!<br>You connected the battery (3.7V) directly to Weemos 5V pin?
<p>Glad you like it !</p><p>Yes, I have connected directly to the 5V pin</p>
<p>May I suggest you use a LDO voltage regulator and connect it to 3.3v directly on the ESP. Also much better for your lithium battery to stay above 3.3v!</p>
<p>Thank for your valuable suggestion.</p>
<p>I am happy to see the use of duct tape. Real man use ducttape.</p><p>Good combination of electronics, software and enclosure building</p>
<p>Thank You so much.</p>
<p>Congrats on building a useful <em>and</em> pretty weather station! For how long did you use yours so far? I have the feeling the solar cell can't keep up with the power consumption of the ESP8266, especially on cloudy days.</p>
<p>Thanks !</p><p>The ESP8266 is not directly powered from the solar panel.It is powered by a LiIon battery.When there is sun light, the battery will charge by the solar panel.</p>
<p>Great job, cool project! You could make it even more simple to build by using Wemos battery shield: <a href="https://www.wemos.cc/product/battery-shield.html" rel="nofollow"> https://www.wemos.cc/product/battery-shield.html</a><br>It would be also nice to monitor battery voltage (here is nice example how to do it with the shield above: <a href="https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/" rel="nofollow"> https://arduinodiy.wordpress.com/2016/12/25/monit...</a> and maybe wifi signal level - just to have it perfect :)<br>And thanks you for sharing of my youtube video here :-)<br>plukas</p>
<p>In my first iteration, I have used the battery shield.But later I replaced it with the TP4056 as it is cheaper.</p><p>By the way your article is excellent.I will definitely going to implement the battery voltage monitoring in my next revision.</p><p>Thank you.</p>
<p>not bad, dude: nice'n'neat!)</p><p>but instead of 1N4007 you better <br>use some schottky diode, because 1N4007 have 0.7 V drop down and <br>schottky's drop down is usually 0.3 V or even lower - it could help in <br>rainy or winter days at least.<br></p><p>also, it's not good idea to <br>make not waterproof housing - after some months or year, but anyway <br>condensate will oxydize connectors or even board's soldering, and you'll<br> get problems. but first you'll get problems with wi-fi, because it use <br>pretty high frequencies, enough for skin effect. it's better to make <br>sealed housing, and drill a little hole for sensor's hole, and use, for <br>example, thermoglue to seal all the volume and provide atmosphere and <br>sensor's contact.and aware of negative values of temperature - lithium accumulators don't love them and loose their capacity pretty fast.<br><br>except that moments, i really love your design, thanxs maan! ;)</p>
<p>Thank you for your valuable suggestions.</p>
<p>voted4u, good luck! :)</p>
<p>Thank you so much.</p>
<p>Nice, voted you!</p>
<p>Thank You for your support.It means a lot for me.</p>
<p>well explained</p>
<p>Wonderful. I'd love to see how to add a wind meter!</p>
<p>Me too!</p>
<p>This a very, very well done project tutorial. Constructing one is probably beyond my abilities, but you make attempting it very appealing.</p><p>Why did you include altitude when it is a constant for wherever the device is installed? A rain gauge and memory to record readings at time intervals would make this an ideal weather station although at the expense of added components and complexity.</p><p>It would be interesting to hear from you and others about how the addition of a rain gauge might be done or why it is an overreach.</p><p>Thank you for a great Instructable!!!!!</p>
<p>just awesome IBLE</p><p>even with a 3D enclosure, everything can be made, build. and with some tweeks like the nice man <a href="https://www.instructables.com/member/tim%20Rowledge" style="">tim Rowledge</a> said, you got an even more awesomeness IBLE</p>
<p>A few minor suggestions that might make this neat project even better...</p><p>A BME280 adds humidity sensing to the temp &amp; pressure, for not much extra cost over the BMP280.</p><p>By connecting the Wemo's D0 pin to the RST pin you can replace the `delay()` with `ESP.deepSleep()` and use much less power for almost all the time. My sensors use `ESP.deepSleep(10 * 60 * 1000000);` to sleep for 10 minutes and then reboot to do a reading. The `delay()` is a busy loop that uses a surprising amount of power.</p><p>Duct tape is not great for long term outdoor usage, so your front door may come loose and fall out; consider a small twist-latch instead. A nylon or stainless steel screw to hold it would be good too, to avoid it corroding away too quickly.</p>
<p>yes please share the code, wow your awsome,you are complete right, power needs to be as eviciant as possible here</p>
<p>Thank You.</p><p>If you don't mind, can you modify the code what you are telling.</p><p>It will be helpful for all.</p>
Sure.<br>I'm a touch puzzled to notice that the `delay(1000)` at the end of your loop() is commented out. Does the Blynk library force a delay?<br>Anyway, assuming you uncommented that line you would have a busy wait for a second, which uses power as if running normally. If you delete that and replace it with `ESP.deepSleep(10 * 60 * 1000000);` you would have a &quot;go into deep sleep for 10 minutes&quot; which shuts down everything except a tiny countdown clock. When that runs out it tickles the D0 pin and if you have connected that to the RST pin it wakes up the system and reboots. <br>You can see my weather station code at http://wiki.squeak.org/squeak/6573 and download the ESP part of the code with http://wiki.squeak.org/squeak/uploads/6573/ESP8266_SHT30.ino
<p>What happens when it rains? It looks like water would seep in from the sides and short the circuitry.</p>
<p>This design is not waterproof.</p>
That is fantastic! Beautiful project! <br>
<p>Thank You.</p>
<p>Nice instructble.</p><p>Is this case similar to your project?</p><p>http://www.thingiverse.com/thing:704715</p>
<p>Thank You!</p><p>No it is different.My design link is <a href="http://www.thingiverse.com/thing:2282869">http://www.thingiverse.com/thing:2282869</a></p>
<p>Another wonderful project from you. Thanks. </p><p>What do you raise on the farm?</p><p>Fortney</p>

About This Instructable

32,446views

701favorites

License:

Bio: I am an Electrical Engineer.I love to harvest Solar Energy and make things by recycling old stuffs. I believe &quot;&quot;IF YOU TRY YOU MIGHT ... More »
More by deba168:Solar Powered WiFi Weather Station  3 Useful Things From an Old Laptop DIY Mobile Boombox 
Add instructable to: