Introduction: NaTaLia Weather Station: Arduino Solar Powered Weather Station Done the Right Way

Picture of NaTaLia Weather Station: Arduino Solar Powered Weather Station Done the Right Way

After 1 year of successful operation on 2 different locations I am sharing my solar powered weather station project plans and explaining how did it evolve into a system which can really survive over long time periods from solar power. If you follow my instructions and using the exact same materials as listed, you can build a solar powered weather station which will run for many years. Actually the only factor limiting how long it will run is the lifespan of the battery what you are using.

Step 1: Weather Station Operation

1, Transmitter: Outdoor mounted box with solar panel which sends weather telemetry (Temperature, Humidity, Heat Index, Solar Strenght) periodically to the indoor receiver unit.

2, Receiver: Indoor unit made from a Raspberry PI 2 + Arduino Mega having a 433 Mhz RF Receiver connected for data reception. In my setup this unit does not have any local LCD display functionality. It runs heedlessly. A main C program takes care of receiving the incoming data from the Arduino through the serial, then logging the data into a text file and making the last received data available through telnet for other devices to query it.

The station is controlling lights in my home by the reading of photoresistor( which determines whether it is day or night outside). The receiver is headless in my case but you can easily modify the project to add an LCD display. One of the device using, parsing and displaying the weather data from the station is my other project: Ironforge the NetBSD Toaster.

Step 2: First Versions

Picture of First Versions

There are a lot of solar projects on the net but many of them commits the common mistake that the system takes out more energy from the battery over time what the solar panel could replenish, especially during the cloudy, dark winter months.

When you design a solar system the only thing matters is POWER CONSUMPTION, on all components: mcu, radio transmitter, voltage regulator etc.

Using a large computer like a raspberry pi or power hungry wifi device like the ESP just to collect and transport couple of bits weather data would be an overkill but as I will show it in this tutorial even a small Arduino board is.

The best is always measuring current during your build process with a meter or with a scope (useful when you try to measure small spikes in usage during the operation in very short timespans (milliseconds)).

On the first picture you can see my first (Arduino Nano Based) station and the second Arduino Barebone Atmega 328P board.

The first version, although it worked perfectly (monitoring environment and sending data via radio) had too high power consumption ~ 46mA and drained down the battery in a few weeks.

All the versions are using the following battery:

18650 6000mAh Protected Li-ion Rechargeable Battery Built-in Protection Board

Therefore with simple calculations the battery is providing:

Battery voltage =3.7V

Power =3.7x6000=22000 mWh

Now don’t forget these are theoretical values provided by the vendor and apply for the time of manufacturing of the battery. So the real capacity will be under this.

Version: 0.1 ARDUINO NANO BASED

Even with the LowPower library an Arduino nano consumes ~ 16 mA (in sleep mode) -> FAIL.

Pavg=VxIavg =5Vx16mA=80 mW

Battery life = 22000/80 =275 hours = 11 days approximately

Version: 0.2 Atmega 328P Barebone

The power consumed by an ATmega328 depends a lot on what you are doing with it. Just sitting there in a default state, it can use 16mA @ 5V while running at 16MHz.

When the ATmega328P is in Active Mode, it will continuously execute several million instructions per second. Further, the On-Board Peripherals Analog to Digital Converter (ADC), Serial Peripheral Interface (SPI), Timer 0,1,2, Two Wire Interface (I2C), USART, Watchdog Timer (WDT), and the Brown-out Detection (BOD) consume power.

To save power, the ATmega328P MCU supports a number of sleep modes and unused peripherals can be turned off. The sleep modes differ in what parts remain active, by the sleep duration and the time needed to wake-up (wake-up period). The sleep mode and active peripherals can be controlled with the AVR sleep and power libraries or, more concisely, with the excellent Low-Power library.

The Low-Power library is simple to use but very powerful. The statement LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); puts the MCU in SLEEP_MODE_PWR_DOWN for 16 ms to 8 s, depending on the first argument. It disables the ADC and the BOD. Power-down sleep means that all chip functions are disabled till the next interrupt. Further, the external oscillator is stopped. Only level interrupts on INT1 and INT2, pin change interrupts, TWI/I2C address match, or the WDT, if enabled, can wake the MCU up. So with the single statement, you will minimize energy consumption. For a 3.3 V Pro Mini without power LED and without regulator (see below) that is running the statement, the energy consumption is 4.5 μA. That is very close to what is mentioned in the ATmega328P datasheet for power-down sleep with WDT enabled of 4.2 μA (datasheet linked in sources). Therefore, I am quite confident, that the powerDown function shuts down everything that is reasonably possible. With the statement LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);, the WDT will be disabled and you would not wake up until an interrupt is triggered.

So with the barebone setup we can put the chip into sleep mode for 5 minutes, while it is consuming very little amount of energy (0.04 mA without peripherals). However this is only the Atmega 328P chip with the crystal oscillator and nothing else, the voltage booster used in this configuration to boost the battery voltage from 3.7V -> 5.0 V also consumes 0.01 mA.

One constant voltage drain was the added photo resistor bumping up the consumption in sleep mode to an overall 1 mA (this includes all the components).

The formula for calculating the precise consumption for the device in both sleep and wakeup mode is:

Iavg = (Ton*Ion + Tsleep*Isleep ) / (Ton +Tsleep)

Ion = 13mA

This is mostly coming from the RF433 Mhz transmitter:

Transmitter :

Working voltage: 3V - 12V fo max. power use 12V
Working current: max Less than 40mA max , and min 9mA
Resonance mode: (SAW)
Modulation mode: ASK
Working frequency: Eve 315MHz Or 433MHz
Transmission power: 25mW (315MHz at 12V)
Frequency error: +150kHz (max)
Velocity : less than 10Kbps

Isleep = 1mA

Would be significantly less without the photoresistor.

Trunon time Ton=250 mS = 0.25s

Sleep time Tsleep= 5 min = 300s

Iavg = (Ton*Ion + Tsleep*Isleep ) / (Ton +Tsleep)

Iavg = (0.25s*13mA + 300s*1mA ) / (0.25s+300s)

Iavg=1.26mA

Pavg=VxIavg =5Vx1.26mA=6 mW

Battery life = 22000mWh/6mW =3666 hours = 152 days approximately

And that is an absolutely optimistic, theoretical figure at new age of the battery. So although I was not running such long test just from the battery, we can assume that the weather station can safely survive 93 days (3 months) just from the LiPo battery which is going to be enough to survive during the dark winter days with only 1-2 hrs solar charging from the Sun.

Feel free to build the station and write down your findings and calculations to the comments and I will update the article. I would also appreciate results with different MCUs and boost converters.

Step 3: Building a Successful Weather Station

Picture of Building a Successful Weather Station

Although it is the first successful version, it contains a little bit of fail on the pictures and I can’t remake those because the stations are already deployed. The two voltage boosters shown on the picture are obtainable at the time of writing for aero-modelling and other applications. When I redesigned my station I was thinking on getting a smaller and more efficient voltage stepup board, however smaller in size definitely does not mean that it is more efficient.

The new small module on the picture which does not even have an indicator led actually drained 3mA (*FAIL*) by itself, so I stayed with my old board:

PFM Control DC-DC USB 0.9V-5V to 5V dc Boost Step-up Power Supply Module

At the time of writing this module is still available on Ebay for 99 cent but if you decide to use another booster, always check the standby power consumption. With a good quality booster it should not be more than mine (0.01 mA), although the small LED on board had to be de-soldered.

Step 4: Hardware List

Picture of Hardware List
  • 18650 6000mAh Protected Li-ion Rechargeable Battery Built-in Protection Board
  • Atmega 328P16M 5V with bootloader
  • Adafruit DC Boarduino (Arduino compatible) Kit (w/ATmega328) < this is going to be a good investment if you are doing future barebone projects
  • Photo Light Sensitive Resistor Photoresistor Optoresistor 5mm GL5539
  • 1A 1000V Diode 1N4007 IN4007 DO-41 Rectifier Diodes
  • PFM Control DC-DC USB 0.9V-5V to 5V dc Boost Step-up Power Supply Module
  • 1.6W 5.5V 266mA Mini Solar Panel Module System Epoxy Cell Charger DIY
  • TP405 5V Mini USB 1A Lithium Battery Charging Board Charger Module
  • 433Mhz RF transmitter and receiver link kit for Arduino/ARM/MC remote control < Kit, contains both the transmitter and reveiver
  • IP65 Switch Protector Junction Box Outdoor Waterproof Enclosure 150x110x70mm
  • New DHT22 Temperature and Relative Humidity Sensor Module for Arduino
  • 1x220 Ohm, 2x10KOhm,1xLED,1xMini Switch,1x1N4007diode
  • Adafruit 16 MHz Ceramic Resonator / Oscillator [ADA1873]
  • Arduino UNO/Mega etc for receiver station + Raspberry PI 1/2/3
  • Clear Acrylic Plastic Box (optional)

You can find all of these on Ebay, I do not want to promote any sellers by linking to their pages and the links will become dead in the future anyway.

Notes for the hardware list:

Just in case you brick the Atmega somehow with programming buy more of them, same goes for the voltage booster and solar charge controller.

The solar charger contains 2 little color LEDs which are only turned on in case of solar charging and indicate (red-> charging, blue-> fully charged states). These can be unsoldered as well. It rather gives a little more extra juice to the battery during charging.

As you see there are no battery holders on my list. Why? Because they are unreliable. I had countless of occasions when the battery moved out from it’s holder and lost connection. Especially if your setup is mounted up on a high dish pole like mine, open for any harsh weather conditions. I even zipped the battery into the holder with 2 zippers and it still managed to move out. Don’t do it, just remove the external coating from the battery and solder the wires directly into the bottom of the battery, containing the overcharge protection circuit (do not bypass the protection). A battery holder can be used for only holding the battery in place in the device.

TP405 5V Mini USB 1A Lithium Battery Charging Board: unfortunately this board does not include reverse current protection to the solar panel, for this you will need 1 more diode to be placed between one leg of the solar panel and charging circuit to stop the current trying to flow back into the solar panel at nights.

Step 5: Assembly

Picture of Assembly

This board contains relatively few components and the markers on the board are fairly simple.

Make sure that you DO NOT insert the Atmega328P on the wrong way (that can heat up and brick the chip, might destroys the voltage booster too).

In this setup the chip faces down (little U hole marking PIN1). All the other components should be obvious.

Use shielded cable (eg.: Audio Cable from CDrom will do fine) for the LDR. In some cases (over many weeks of test) it turned out that it is interfering with the radio signal transmission. This was one of those bugs difficult to troubleshoot so if you don’t want trouble just use a shielded cable, end of story.

LED: The LED on the bottom of the box was originally added to blink when there is outgoing radio transmission but later on I have considered it as waste of power and it only blinks 3 times at the bootup process.

TP: is test point for measuring the current for the overall circuit.

DHT22: Don’t buy the cheap DHT11, spend 50 cents more to get the white DHT22 which can measure negative temperatures as well.

Step 6: Case Design

Picture of Case Design

Although it’s a bit of an overkill, a 3D printed cube (weather_cube) was made to hold the DHT22 temperature sensor in place. The cube is glued to the bottom of the IP box, featuring only 1 hole for the air to reach the sensor. I have added a net at the hole against bees, wasps and other small flies.

An external box can be used optionally to make the station more waterproof in case you are mounting it on a dish pole on the open.

Idea for 1 useful feature: adding a big metal roof plate 1-2cms on the top of the box providing shadow from the sun during the summer, although this could also take away our useful sunlight from the panel. You can come up with a design which separates the panel and the box (leaving the panel on the sun, the box in shadow).

On the pictures: one of the stations removed from working environment after 1 year, battery voltage is on stunning 3.9V still, no water damage to any part of the box although the net I glued at the bottom of the cube was torn apart. The reason the station needed to be serviced is connection fault on the LDR connector, although the jumper cable seemed to be still in place, the connection was broken therefore the pin was sometimes floating providing bad LDR analog readouts. Suggestion: if you use standard PC jumpercables, hotglue them all after the station is working perfectly to avoid this.

Step 7: Software

The software code will require 3 external libraries (LowPower, DHT, VirtualWire). I had problem finding some of them easily online lately so I attaching them in a separate ZIP file. Regardless what OS are you using Linux/Windows, just find your Arduino IDE’s library folder and extract them there.

Just a note, regardless that I already advise against buying the DHT11, if you use the wrong type of DHT sensor the program will just hang forever at the beginning at the initialization section (you will not even see the startup led blink 3 times).

The main loop code is very simple, first it reads the environment values (temperature, heat index, humidity, solar), sends them through radio then it uses the lowpower library to put the Arduino in sleep for 5 minutes.

I have found that lowering the baudrate will increase the stability of the radio transmissions. The station is sending a very small amount of data, 300 bps is more than enough. Also don’t forget that the transmitter is only operating from approx. 4.8V, in the future 3.3V version this might leads to even worse transmission quality (sending data through walls and other obstacles). I run into an issue with using an Arduino Mega attached to a Raspberry PI 2 powering the Mega from the PI, that I did not receive any transmission. Solution was to power the Mega from a separate external 12V supply.

Step 8: Closure and ToDo

Picture of Closure and ToDo

If you decide to build this weather station please DO NOT use Arduino Nano, Micro, Pro-Micro, Mini, Mega etc. but only the barebone Atmega328P chip as the transmitter, the receiver can be whatever other Arduino. If you use the exact same components I have listed it will do it’s job like a ZX80 calculator robustly for years.

I planning to do further improvements in the future as my time allows it, namely to run the Atmega on 3.3V with the internal oscillator to achieve even higher efficiency and building the whole station into a small cube, operating from a coin battery.

My other area of interest would be measuring the wind speed and direction, but most of the commonly available anemometers which rely on the hall effect operate from: Input voltage: DC12-24V which is beyond the scale of this project.

Another interesting possible board for those who don’t want to go barebone and want a tiny out of the box solution:

https://tinycircuits.com/pages/tinyduino-overview

If somebody knows more about the TinyDuino or own one I would be interested about the overall power consumption of this board in and outside of sleep mode.

Further Reduction In Power Consumption

Read the excellent article on:

https://www.avrprogrammers.com/howto/atmega328-power

Comments

ThomasVDD (author)2017-11-11

Very nice instructable!
I made a solar powered project myself a while back and had to solve the same issues (you can check it out here: https://www.instructables.com/id/Outdoor-Fish-Feed...
I modified an off the shelf arduino nano by 1) removing the leds, 2) removing the voltage regulator (it draws current, 7mA, even when not in use) and 3) using the low power library. Like this it draws next to nothing, just like a barebones, but its a bit easier to to program.
Great to see an instructable which is also truly solar powered and not battery powered with a solar panel slapped on top :p

About This Instructable

1,020views

28favorites

License:

Bio: Never stops thinking.
More by NLD:NaTaLia Weather Station: Arduino Solar Powered Weather Station Done the Right WayIronForge the NetBSD ToasterJavaStation (Self-Refilling Fully Automatic IoT Coffee Maker)
Add instructable to: