Introduction: SOLAR POWERED ARDUINO WEATHER STATION
In a country like India, most of the people are dependent on agriculture. For effective planning in agriculture, the weather forecast is of utmost importance. So farmers are always interested in the Weather Forecasts. As farmers stay in remote areas, they have to wait for the news updates on TV, Radio or News Papers. Unfortunately, this weather information is not the accurate data of their local environment rather it gives data of the nearest weather forecasting station.
Being the son of a farmer, I decided to monitor the local weather and inform to my father earlier. So that he can take an early decision for his farm.
You can find all of my projects on https://www.opengreenenergy.com/
My weather stations typically consist of two major parts:
1. The sensors that sit outside and measure temperature, humidity, rainfall, and barometric pressure. This data is sent wirelessly through an RF transmitter module to the display unit. I named the entire module as Transmitter module. (Tx).
2. The display unit that lives inside in a convenient place so anyone can read the external temperature, humidity, etc. It equipped with an RF receiver to receive data from the transmitter module. I named it as Receiver module (Rx).
Both the modules are run by the Arduino microcontrollers.
As the transmitter module is deployed in the field, we have to deal with power management. It is impractical to run a long cable to provide power to the sensor’s location. This leaves relatively few practical options.
1. Connecting directly an Arduino board to a battery. Though it sounds good and obviously it would work, but your battery would be depleted in a matter of days because some components like voltage regulators, power led and USB interfacing chip in the Arduino board are always drawing power.
But nowadays high capacity battery packs are readily available in the market. Solar panels are getting more efficient and cheaper. Adding a boost converter in the circuits extract every last drop of juice out of battery.
2. Putting the Arduino to “sleep mode" to consume even less power.
You can see it in the step-11 and 12.
In this guide, I will teach new skills on how you can make a solar powered battery pack for your Arduino and how Arduino power consumption can be optimized by putting it into sleep mode.
By using the above technique you can run your sensor related or any other stand-alone Arduino project for a long time.
Step 1: PARTS AND TOOLS REQUIRED :
12.Resistor 10K ( Amazon )
13.Diode -IN4007 ( Amazon )
14.Jumper wires/Wires ( Amazon )
15.Bread Board ( Amazon )
16.22 AWG solid core wire ( for making antenna) ( Amazon )
17.Scotch mounting pad and tap ( Amazon )
1.Soldering Iron and solder ( Amazon )
2.Glue gun ( Amazon )
3.Hobby Knife ( Amazon )
4.Drill ( Amazon )
5.Wire cutter/Stripper ( Amazon )
Step 2: SOLAR POWER
Why Solar Power?
The main drawback of battery operated device is that it will be depleted after a certain time. This drawback can be eliminated by using natural resources like solar, wind or hydro energy. The most obvious free source of energy to recharge the battery is solar energy. It is a relatively simple, cheap and requires very less skill.
Among the rechargeable battery, nickel metal hydride (NiMH) and Li-Ion battery are widely used for battery operated device.
Facts on Battery Charging :
The thumb rule for charging Ni Mh batteries is 1/10th (commonly known as C/10). To charge the battery pack at 1/10th its rated current requires 16 hours of charge time( You can see the picture). The solar panel receives optimal sunlight for only four hours per day, from 10 a.m. to 2 p.m. Thus, a totally ideal system would require four days to fully charge the battery pack.
What is C/10?
For example, we have a 2xAA–sized 1300mAh battery pack that is rated at 1.2 volts per cell. With cells in series, our pack outputs 2.4 volts and 1300mAh.
Here capacity C =1300mAh
C/10 means 1300/10 =130mAh
So to charge the above battery pack we need a higher voltage ( 2.4 to 3 V) with a maximum current of 130mAh.
As per C/10 rule, it requires 16 hours to fully charge the battery pack.
You must be asked, what will happen if we increase the current (>130mAh)? No doubt your battery will charge faster. But the life of the battery will be reduced.So my advice is to keep the current below the C/10 value.
Step 3: How to Choose the Right Solar Panel
The main source for powering the sensor module is a solar panel. So it must be able to provide current for powering the Arduino as well as current to charge the battery pack during the day. As per my experience, it is the most challenging part for a novice user.
Don't worry these are the following tricks which can help you to buy the right solar panel.
1. Voltage: Choose 1.5 times the battery pack voltage
2.Current: Current taken by the Arduino + current for charging (should be
A battery pack is made of 2 AA Ni Mh battery.
Battery voltage = 1.2 x 2= 2.4V
So required voltage for solar panel =2.4 x 1.5 = 3.6V
By taking some margin we can choose a 4V solar panel for it.
The sensor module along with Arduino taking 100mAh current.
Battery capacity is 1300mAh
C/10 = 130mAh
The solar panel has to provide current 100mAh for Arduino along with a current not more than 130mAh.
Lets take 100 mAh for charging the battery
Total current required = 100+100=200mAh
From the above calculation, it is clear that we need a solar panel of 4V and 200mAh.
The following table shows the solar system configuration relationship between storage batteries and mini solar panels.
Battery ---->Solar Panel
1.2V ------> 2V ~ 2.5V
2.4V ------> 3.5V ~ 4V
3.6V ------> 5V ~ 6V
6V ------> 7.5V ~ 9V
12V ------>15V ~ 18V
Note : It is not the strict rule for choosing the exact rating solar panel,rather it is approximate rating .I write as per my experience.
Step 4: Ni Mh Battery Charger :
To power an Arduino we need 5v. There are two options
1. Use a 4 AA battery pack :
Total voltage =1.2V x4=4.8V (nominal ) but when it is fully charged,voltage is more than 5V.
This is not efficient.
2.Use 2 AA battery pack :
Total voltage =1.2Vx2 =2.4 V
In this case, we have to raise the voltage level to 5V by using a voltage booster circuit.
I recommend using this pack. It is reliable and efficient.
Charging Circuit :
Standard sized nickel metal hydride (NiMH) cells need simple charge circuit.
You only need a solar panel, diode, the batteries, and a battery case and wires.
4 AA battery pack
Solder the positive terminal of the solar panel to the positive terminal of a diode.
Solder the negative terminal of the diode to the positive terminal of the battery pack.
solder the negative terminal of the solar panel to the negative terminal of the battery pack.
See the above picture for soldering.
2 AA battery pack
As the battery pack voltage is not sufficient in this case, we have to use a booster circuit to make 5V for Arduino.
Step 5: Boost Converter
A boost converter is a DC-to-DC power converter (like a step up transformer in AC) with an output voltage greater than its input voltage.
Boost converter used in this project has the following specification :
>>Input voltage: 0.9V-5V DC
>>With USB port
>>With working indicator light
>>with one AA battery power supply output current can up to 200~300mA,
>>two AA batteries to the output current of 500~600mA
You can buy it from eBay
In our case, the input to the boost converter is 2.4V and output is 5V which is sufficient to power an Arduino.
Solder the '+' terminal of boost converter to the battery positive terminal.
Solder the '-' terminal of the boost converter to the battery negative terminal.
Step 6: Li Ion Battery Charger
Among all the charger what I have discussed earlier, I like it most. This is the most powerful and efficient battery pack. The interesting thing is that you can use this for charging any USB powered gadget like a smartphone, tablet, MP3, etc.
If you look at the Periodic Table, you will find that Lithium is on the far left in the first column, where all the most reactive elements live.
You must take certain precautions when dealing with Lithium Ion Batteries. In order to maintain a very precise voltage when charging. The 3.7V batteries we're using in this guide need to have a charging voltage of 4.2V. A volt high or a volt low can mean an out of control chemical reaction which can lead to danger.
Don't worry, a suitable Li-Ion battery charge controller will solve the above problem.
Lithium Battery Charging Board used in this project have following specification :
>> Current- 1A adjustable.
>> Charge precision- 1.5%.
>> Input voltage- 4.5V-5.5V.
>> Full charge voltage- 4.2V.
>> Led indicator- red is charging blue is full charged.
>>Input interface- mini USB.
>> Work temperature- -10℃ to +85℃.
You can buy it from eBay
Circuit Connection :
Solder the Input positive terminal of boost converter(red wire) and battery holder positive terminal(red wire) to the charging board's BAT +.
Solder the Input negative terminal of boost converter(black wire) and battery holder negative terminal(black wire) to the charging board's BAT-.
The boost converter output is a USB terminal. For powering a breadboard circuit we need two wires for connection. So we have to modify something according to our requirement.
The USB has four terminals (5V, D-, D+and GND).
Solder the red and black wire to the + and - respectively as shown in the back side of the boost converter.
Note: The boost converter does not have any marking. So use my picture during soldering.
Step 7: TRANSMITTER
The transmitter module contains the DHT11 sensor which is a relatively cheap sensor for measuring temperature and humidity of the environment. It is good for 20-80% humidity readings with 5% accuracy and for 0-50°C temperature readings with ±2°C accuracy.
I ordered the Barometric Pressure Sensor( BMP085) and rainfall sensor from eBay to forecast more weather data. For the time being, I am happy with only temperature and humidity.
The weather data is measured by DHT11, processed by an Arduino nano/breadboard Arduino and transmit it wirelessly through an RF transmitter.
DHT11 Connection :
DHT11 sensor have 4 pins : 1->Vcc ,2->Data ,3->NC ,4 ->GND
NC --> No connection
Connect a 10K resistor between VCC and Data pin of DHT11
RF Transmitter Connection :
The RF transmitter has 3 pins ( VCC, Data, and GND).
RF Transmitter -->ARDUINO
VCC --> 5V
Note: Add an antenna in the RF transmitter to increase the range, click here
After connecting everything, upload the Tx_code attached bellow
Step 8: MAKE a ENCLOSURE FOR Tx MODULE
I used a plastic box for the transmitter module enclosure.
Make a hole in the top side of the plastic box for inserting the wire from the solar panel.
Make small holes in the side wall (opposite face) for ingress of fresh air ( to measure the accurate data ).see the pics.
Place the charging circuit (made earlier) inside the box.
Take out the wires from the li-ion battery charger (IN+ and IN-)
Solder the positive terminal of the solar panel to the positive terminal of diode and negative terminal of the diode to the red wire from the charger.
Solder the black wire to the solar panel negative terminal.
For mounting the solar panel and battery holder I used a skotch mounting pad. The mini breadboard has an inbuilt pad to stick.
Use tap to stick the wire firmly.
Connect the 5V (+) and GND (-) terminals of boost converter to the breadboard red rail(+) and blue rail (-) respectively.
To test it expose to sunlight, you will see the red led in all (Arduino, boost converter, charging) the boards will glow.
Step 9: RECEIVER
The receiver module receives the weather data by an RF receiver and it is processed by Arduino UNO. The processed data is displayed through a 20x4 char LCD display. You can also choose a 16x2 LCD also. The main reason for using a 20x4 char LCD is display is that I can display a large number of weather parameters.
I add an I2C module to the LCD for reducing the number of connection with Arduino (requires only 4 wires).
If you don't have an I2C module go to my tutorial on LCD tutorial for connection and example code.
LCD connection :
The I2C LCD has only 4 pins (GND, VCC, SDA, SCL)
RF receiver Connection:
The RF receiver has 3 pins ( VCC, Data, and GND).
RF Receiver -->ARDUINO
VCC --> 5V
Note: Add an antenna in the RF receiver to increase the range, click here
After connecting everything upload the Rx_code attached bellow
Step 10: MAKE a ENCLOSURE FOR Rx MODULE
The receiver enclosure is a card board box.
Mark the outline of LCD by using a pencil or marker.
Cut the marking portion by using a hobby knife.
Insert the LCD into the cutting portion of the box.
Hard gue on the back side of the LCD to hold it firmly
Place the breadboard receiver module prepared in the previous step.
I use a 12V dc adapter for powering the Arduino UNO. Make a hole in the back side of the cardboard box for inserting the dc adapter cable.
Step 11: POWER OPTIMIZATION BY USING SLEEP MODE
The weather data does not change frequently. So we can take a reading at an interval of 5mins. As we are taking readings at regular intervals, it is a fantastic way to save lots of power. A system with appropriate sleep schedules can run for several months on just two AA batteries. We are so lucky that Arduino has several sleep modes that can be used to reduce power consumption.
This is most useful for any sensor networks. You can use this trick in any of your stand alone sensor project.
After searching through the internet for using the sleep modes, I found a simple but powerful library by
Rocket Scream has a Lightweight Low Power library supports all AVR power down modes. Each mode has an associated library method that lets you control sleep duration using the watchdog timer. For a novice programmer like me, it is very simple and easy to use.
How to use LowPower Library :
1. Download the library from GitHub
2. Extract the zip file to the Arduino library in your computer.
3. Import the library in your code.
4. Write the following one line code for power saving.
"LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF) ; "
You can also pass different arguments to shut off individual peripherals. For different argument and sleep time refer to the table provided by Lightweight Low Power Arduino Library.
example code :
// No setup is required for this library
// Sleep for 8 s with ADC module and BOD module off
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
// Do something here
// Example: read sensor, log data, transmit data
Let's use it in the blink code of Arduino IDE example
Apply "LowPower library" in Blink code
#include "LowPower.h" // import the lowpoer library
int led = 13;
LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF); // instead of delay(1000) ;
LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF); // instead of delay(1000) ;
Before using the Lowpower library current taken by arduino
51.7mA, when led, is ON
47mA, when led, is OFF
After using the Low-power library current taken by Arduino
34.93mA, when led, is ON
31.73mA, when led, is OFF
Are you happy to reduce 32.43 % power ?? Hey, there is still room to reduce the power consumption.
Your Arduino board have different power sucking components like power led, voltage regulator and USB interface chip which takes most of the power even when it is idle. For other alternatives see the next step.
Step 12: Alternatives for Power Saving
>> The simplest method to reduce the power consumption is bypassing the voltage regulator in the Arduino board.
Buy a separate boost regulator circuit and connect its output to the 5-volt pin on the Arduino board, which bypasses the 5-volt regulator on board. This procedure is used in our project.
>> using a "bare bones" board instead of Arduino board.
>> Disable the unnecessary led
>> If you do not need time accuracy, then use the Atmega 328 internal 8MHz crystal instead of an external 16Mhz crystal.
>> Operate Atmega 328 at 3.3V instead of 5V
>>Turn off the sensor as soon as possible
To know more details on Arduino power saving techniques click here
The maximum power saving is done by using a Barebones board. By using a barebone board the power consumption can be reduced to microamps level during the sleep period. You can see the above figure.
You can easily make this on a breadboard by following the links below :
1.Arduino on a Breadboard
2.Arduino to a Microcontroller on a Breadboard
Make bare bone PCB board by following the links below :
Single Sided Really Bare Bones Board Arduino in EAGLE
I will highly recommend for the bare bone board for any battery driven projects ( like sensors).
Step 13: Battery Life Estimation
The battery life can be calculated by determining the average current for the circuit.
Use the following general equation to calculate the average current.
Iavg = (Ton*Ion + Tsleep*Isleep ) / (Ton +Tsleep)
Ton (arduino is active ) = 250 ms =0.25s and Ion = 16mA
Tsleep = 5min =300s and Isleep = 200 uA (approx)
It is very difficult measure the current during the sleep period .Some time I got zero reading.
Iavg = 0.205 mA
Operating Voltage =5 V
Pavg=VxIavg =5x.205=1.026 mW
Li-Ion battery capacity =3000 mAh
Battery voltage =3.7V
Power =3.7x3000=11100 mWh
Battery life = 11100/1.026 =10,818.7 hours = 15 months approximately
From the above calculation, it is clear that theoretically by using a fully charged 3000 mAh Li-Ion battery we can run the Arduino for 15 months. In practical due to battery self-discharge, this figure may be different.
As the system is equipped with a solar charging system, we can run for a few years without any interruption.
I hope you enjoyed reading my tutorial. Please, comments if any mistake found.
This project is entered in 3 competitions, please vote for me.
Thank you so much.