A solar-powered ESP8266 based Weather Station, which can run years without taking power from an external source
RAR Archive - 3.81 kB - 04/19/2019 at 06:36
STL Files for 3D printed Enclosure
Zip Archive - 920.20 kB - 04/19/2019 at 06:20
Only monitoring the weather data ( Temperature, Humidity,Pressure and Altitude ) is not so interesting. So my friend 3KU_Delta thought to implement the forecast algorithm in to the Software.
The only algorithm that fulfill our purpose is the Zambretti algorithm. The Zambretti Forecaster is a weather forecasting tool in the form of a circular slide rule that was introduced by the company Negretti and Zambra in 1920. A more detailed description about the functionality of the Zambretti Forecaster and how to put it into code can be found here. The input parameters of the algorithm are season, sea-level pressure, barometric tendency, hemisphere and wind direction. The algorithm is empirical and created for the northern hemisphere and more specifically Great Britain.
The algorithm conclude, that wind direction has little effect to the final result, which is a good thing because wind direction sensor is still not used . We get the temperature, humidity and station pressure from the sensor, but the relative pressure should be derived from the station pressure. The output of the Zambretti Forecaster is one of 26 different weather conditions.
Now you can see the updated code on GitHub
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.
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 :
You can read thistutorial 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 peace of code. The user have 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
Cedit: I want to give lot of credit to Keith Hungerford, who have 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.
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 asHumidity,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-1: Download the Blynk app
1. For Android
2. For iPhone
Step-2: Get the Auth Token
In order to connect Blynk App and your hardware, you need an Auth Token.
1. Create a new account in 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: http://j.mp/blynk_Android or http://j.mp/blynk_iOS 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.
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 3D 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 good )
Fill Density: 25%
Extruder Temperature: 200 deg C
Bed Temp: 60 deg C
Download the STL files from Thingiverse
After designing the PCB, I have exported the PCB design files known as Gerber files which are used to manufacturing the PCB.
You can order it from PCBWay .
Note : 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.
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.
From the previous step, it is concluded that the average current consumption is 9.3 mA
Required Current for running the device for the whole day = 9.3mA 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 the 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.
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.