Table of Contents
Toggle
In this post, I will share how to make a solar powered wifi weather station v2.0. This article 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 into consideration the comments and Q&A section of my earlier project, I decided to make this new version of Weather Station. I also made a custom PCB for this project, so anyone with little knowledge of electronics circuits can be made this project. My V2.0 PCB can also be used for many applications on the Arduino platform. Following are the salient features of the new weather station.
Features:
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.
Components and Tools Required
Update 05.08.2019
Now you can buy the PCB for solar powered wifi weather station v2.0 and all the components in a single Kit from PCBway.
Note: Battery and 3D printed enclosure is not included in the kit.
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 ( Amazon)
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 )
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 use 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 a battery protection chip or without the protection chip. I will recommend buying a module that 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 on the TP4056 charger IC and DW01 battery protection IC this module will offer a 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.
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 an 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.
Additional Ports for More Sensors
The Weather Station V2.0 board has 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 UV Index. It can communicate via I2C communication (address 0x60). You can hook up this sensor with an I2C port in the board which is located just side 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 the 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.
Using an External Antenna ( 3dBi )
The Wemos D1 mini Pro board has an inbuilt ceramic antenna along with a 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.
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 off 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.
Implementing 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 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: http://brainpoweryoutube.blogspot.com/2015/12/the-…
Selecting the Solar Panel
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 a 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
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 an ample amount of sunlight, then a 0.66W solar panel which I have used in my earlier version also works.
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. The smaller the board size, the 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 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 PCBWay.
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.
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.
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.
Mounting the Standoffs
After adding all the parts, mount the standoffs at 4 corners. I used M3 Brass Hex Standoffs.
The use of standoffs will provide sufficient clearance to the soldering joints and wires from the ground.
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.
The 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
Library
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:
1 2 |
const String App = "BLYNK"; // alternative is line below // const String App = "Thingspeak"; // alternative is line above |
Note: Before using the deep sleep feature, the 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)
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, the Wemos D0 pin must be connected to the RST pin. This can be done by shorting the jumper JP2.
Adding Wind Sensors and ESP Home
Update on 05.04.2020
For a weather station, it is very essential to monitor wind speed and direction. The wind speed is measured by anemometer and wind direction is by the wind vane. You can buy the sensors from Sparkfun or Amazon.
My friend honzek from the Czech republic hooked up the wind sensor in Weather Station PCB V2.0 to monitor the wind speed and direction. He also used the 3D-printed Stevenson screen to keep the PCB and other sensors. The outcome of his project is extremely good, you can see the above picture.
I am sharing his work because it will be an inspiration for many more. I would like to give special thanks to honzek for sharing the pictures and Arduino Code.
You can also see the Arduino Code for his project, attached below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
//---------------------------------------------------------------------------------------------------- // Project Name : Solar Powered WiFi Weather Station V2.0 // Authors: Keith Hungerford and Debasish Dutta // Website : www.opengreenenergy.com // This code is derived from the example code of farmerkeith_BMP280.h library // Download the library from https://github.com/farmerkeith/BMP280-library // Main microcontroller (ESP8266) and BME280 both sleep between measurements // BME280 is used in single shot mode ("forced mode") // Measurement read command is delayed, // By repeatedly checking the "measuring" bit of status register (0xF3) until ready // Last updated on 12/02/2019 //// Features : ////////////////////////////////////////////////////////////////////////////////////////////////////// // 1. Connect to Wi-Fi, and upload the data to either Blynk App or Thingspeak // 2. Monitoring Weather parameters like Temperature, Pressure, Humidity and Altitude. // 3. Extra Ports to add more Weather Sensors like UV Index, Light and Rain Guage etc. // 4. Remote Battery Status Monitoring // 5. Using Sleep mode to reduce the energy consumed /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // configuration constants const bool bme280Debug = 0; // controls serial printing // set to 1 to enable printing of BME280 or BMP280 transactions // configure period between reports const long measurementInterval = 30000; // measurement interval in ms // configuration control constant for use of either Blynk or Thingspeak const String App = "BLYNK"; // alternative is line below // const String App = "Thingspeak"; // alternative is line above #include <Wire.h> #include <farmerkeith_BMP280.h> // library, download from https://github.com/farmerkeith/BMP280-library #include <ESP8266WiFi.h> // do we need this? Not when using Blynk #include <ArduinoOTA.h> // #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include <BlynkSimpleEsp8266.h> bme280 bme0 (0, bme280Debug) ; // creates object bme0 of type bme280, base address // unsigned long eventCounter = 0; // to count measurement events // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "XXXX"; // copy it from the mail received from Blynk // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "XXXX"; // WiFi Router ssid char pass[] = "XXXX"; // WiFi Router password // Thingspeak Write API const char* server = "api.thingspeak.com"; const char* api_key = "XXXX"; // API write key #include "PTHsleep.h" // tab file void setup() { Serial.begin(115200); // Serial.begin(9600); // use this if you get errors with the faster rate Serial.println("\nStart of solarWiFiWeatherStationESP_12th Feb2019"); // **************Choose Application********************************** if (App == "BLYNK") // for posting datas to Blynk App { Blynk.begin(auth, ssid, pass); } else if (App == "Thingspeak") // for posting datas to Thingspeak website { WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); } else { WiFi.begin(ssid, pass); Serial.print(App); Serial.println(" is not a valid application"); } //******************************************************************* unsigned long baseEventTime = millis(); // eventCounter = recoverCounter(); // comment out if counter is not required byte temperatureSamples = pow(2, osrs_t - 1); byte pressureSamples = pow(2, osrs_p - 1); byte humiditySamples = pow(2, osrs_h - 1); Serial.print ("Temperature samples="); Serial.print (temperatureSamples); Serial.print (" Pressure samples="); Serial.print (pressureSamples); Serial.print (" Humidity samples="); Serial.println (humiditySamples); // Wire.begin(); // initialise I2C protocol - not needed here since it is in bmp library bme0.begin(osrs_t, osrs_p, 1, 0, 0, 0, osrs_h); // parameters are (osrs_t, osrs_p, mode, t_sb, filter, spi3W_en, osrs_h) // see BME280 data sheet for definitions // this is single shot mode with no filtering measurementEvent(); // eventCounter ++; // saveCounter(eventCounter); // this also puts bme0 to sleep bme0.updateF4Control16xSleep(); // use instead of saveCounter if counter is not required goToSleep(); } // end of void setup() void loop() { } // end of void loop() |
PTHsleep.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
// tab file for functions used by powerSaverPressureAndTemperatureAndHumidity // BME280 configuration settings const byte osrs_t = 2; // setting for temperature oversampling // No. of samples = 2 ^ (osrs_t-1) or 0 for osrs_t==0 const byte osrs_p = 5; // setting for pressure oversampling // No. of samples = 2 ^ (osrs_p-1) or 0 for osrs_p==0 const byte osrs_h = 5; // setting for humidity oversampling // No. of samples = 2 ^ (osrs_h-1) or 0 for osrs_h==0 void measurementEvent() { //*********** Measures Pressure, Temperature, Humidity, Voltage and calculates Altitude // then reports all of these to Blynk or Thingspeak while (bme0.readRegister(0xF3) >> 3); // loop until F3bit 3 ==0, measurement is ready double temperature, pressure; double humidity = bme0.readHumidity (temperature, pressure); // measure pressure, temperature and humidity float altitude = bme0.calcAltitude (pressure); Serial.print("Atm press = "); Serial.print(pressure, 2); // print with 2 decimal places Serial.print(" hPa. Temperature = "); Serial.print(temperature, 2); // print with 2 decimal places Serial.print( " deg C. Humidity = "); Serial.print(humidity, 2); // print with 2 decimal places Serial.print( " %RH. Altitude = "); Serial.print(altitude, 2); // print with 2 decimal places //******Battery Voltage Monitoring********************************************* // 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; Serial.print( " m. \nVoltage = "); Serial.print(volt, 2); // print with 2 decimal places Serial.println (" V"); //******************************************************************************* // code block for uploading data to BLYNK App if (App == "BLYNK") { // choose application Blynk.virtualWrite(0, pressure); // virtual pin 0 Blynk.virtualWrite(1, temperature); // virtual pin 1 Blynk.virtualWrite(2, humidity); // virtual pin 2 Blynk.virtualWrite(3, altitude); // virtual pin 3 Blynk.virtualWrite(4, volt); // virtual pin 4 } //******************************************************************************* // code block for uploading data to Thingspeak website else if (App == "Thingspeak") { // Send data to ThingSpeak WiFiClient client; if (client.connect(server,80)) { Serial.println("Connect to ThingSpeak - OK"); String postStr = ""; postStr+="GET /update?api_key="; postStr+=api_key; postStr+="&field1="; postStr+=String(pressure); postStr+="&field2="; postStr+=String(temperature); postStr+="&field3="; postStr+=String(humidity); postStr+="&field4="; postStr+=String(altitude); postStr+="&field5="; postStr+=String(volt); postStr+=" HTTP/1.1\r\nHost: a.c.d\r\nConnection: close\r\n\r\n"; postStr+=""; client.print(postStr); //******************************************************************************* } while(client.available()){ String line = client.readStringUntil('\r'); Serial.print(line); } } // Serial.print (" Counter= "); // Serial.println (eventCounter); } // end of void measurementEvent() // ----------recover Event counter---------------------------- int recoverCounter() { // read value of counter back from bmp0 byte bme0F4value = bme0.readF4Sleep(); // 0 to 63 byte bme0F5value = bme0.readF5Sleep(); // 0 to 63 return bme0F5value * 64 + bme0F4value; // 0 to 4095 if (bme280Debug) { Serial.print ("bme0F4,F5values from bme0 Registers 0xF4,F5 ="); Serial.print (bme0F4value); Serial.print (" "); Serial.println (bme0F5value); } // end of if (bme280Debug) } // end of void recoverCounter() void saveCounter(int counter) { // write value of counter into bme0 bme0.updateF4ControlSleep(counter & 0x3F); // store eventCounter bme0.updateF5ConfigSleep((counter / 64) & 0x3F); // store eventCounter // this also puts bme0 to sleep if (bme280Debug) { Serial.print ("saved counter to bme0F4,F5 as "); Serial.print (counter & 0x3F); Serial.print (", "); Serial.println ((counter / 64) & 0x3F); } // end of if (bme280Debug) } // end of void saveCounter() void goToSleep() { // calculate required sleep time and go to sleep long sleepTime = measurementInterval - millis(); // in milliseconds if (sleepTime < 100) sleepTime = 100; // set minimum sleep of 0.1 second // Serial.print ("This is report cycle No. "); // Serial.println(eventCounter); Serial.print (" Going to sleep now for "); Serial.print((float)sleepTime / 1000, 3); Serial.println (" seconds."); Serial.print (" Time going to sleep="); Serial.print ((float)millis() / 1000, 3); // Serial.print (" Event elapsed Time="); // Serial.println((float)(millis()-baseEventTime)/1000,3); Serial.println(); ESP.deepSleep(sleepTime * 5000); // convert to microseconds } // end of void goToSleep() |
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 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.
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.
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 as 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 the “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.
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.
Download the .STL files from Thingiverse
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: 100%
Extruder Temperature: 200 deg C
Bed Temp: 60 deg C
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 fixing 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.
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 it 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.
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.
Conclusion
In the 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.
Thanks for reading my article.
If you like my project, don’t forget to share it.
This project won First Prize in PCB Challenge.
Comments and feedback are always welcome.