Arduino weather station part 2

Sometimes I just do not have time to connect to the internet and check current weather conditions. This is the reason why I made this indoor LCD weather display based on Atmega328 Arduino MCU. The circuit board consists of two LP2950 voltage regulators, MCU, four buttons, ENC28J60 Ethernet module and LCD12864 graphic display module.The Ethernet module is used to connect to this website and to download current data. With it I am not limited to use only at home, but it can be used in any place with internet access. The input voltage is 3V3 so this is the reason why I have two voltage regulators. The connection to MCU is established using SCK, MISO, MIMO and SS digital pins.

Indoor weather station display disassembled.

The LCD12864 display uses ST7920 controller that has the option of parallel and serial communication. Serial communication is preferred because it uses only three digital pins (3, 8 and 9) instead of ten or more for parallel. Another advantage with this display is that it can be used in graphic mode. With it you can control individual pixels on screen. I used this to draw the sun or clouds depending on a outside conditions.

Display showing the current data.

LCD display in action. On the first screen you can see the current weather data (temperature, humidity, wind pressure, cloud coverage and sky temperature), the time when they were recorded and if the change from earlier time is positive, negative or constant. On the second picture the display is showing maximum and minimum within certain period and they can even be reset. All the captions are in Slovene language. More pictures can be found in gallery.
Display showing the limiting data.

The original library was meant to be used with Arduino Mega that has 4 times as much SRAM as ATmega328 I have been using. The screen buffer alone needs 1KB (128×64/8 = 1024 bytes) of memory that is half of the total memory one could use. Beside this in graphic mode you have to store every individual pixel of any character used, leading to overflown memory, leading to broken code and unexpected errors. If you do not want to change the look of the character while the program is running you can store them in FLASH memory along with the source code. Any variable the contents of which will be constant and not changed after initialization can be stored in FLASH using avr/pgmspace library. Doing so updated library can be successfully used on UNO an Duemilanove Arduino broads. Here you can download my updated version of the library I have been using for LCD 128×64.

Wiring diagram

Useful links at building this device:

Sorce of Arduino library for graphic display
Arduino ENC28J60 Ethernet library

Arduino weather station part 1

Finally the weather shelter is no longer empty. Inside it I put Arduino based weather station, made by me. I wanted it to drain as low power as possible so the Atmega328 MCU is sleeping most of the time except when it gets interrupt to send data to PC or when it detects that anemometer (wind speed) is moving. As voltage regulator I am using LP2950 instead of LM7805 or LD1117 as it has way lower quiescent current of aprox 100uA. That is 50 times less than 5mA as a LM7805 has. Station is running on four AA batteries so every mA counts and with this settup I get for around of two weeks energy. Connection to PC is done using serial Bluetooth module. All the data sent from the station can be seen here.

Inside the weather shelter.

Closer look.

Detectors used:

Anemometer – wind mill:


This one is made of scrap material found at home. The magnet is attached inside the cap and when it passes the hall switch US5881LUA detector Arduino gets interrupt to increase an integer that is measuring wind speed. The calibration was done with anemometer attached to the bicycle. I tested it while cycling at speed form 5 to 25 km/h and got a nice linear graph.

Hall switch with two stabilizing capacitors and pull-up resistor.

MLX90614 as cloud detector:

MLX90614 mounted on a top of the PVC pipe cap.

The MLX90614 is high-resolution I2C non-contact infra-red thermometer. For my purpose it is pointing to the sky and it is measuring the sky temperature. The temperature depends on whether the sky is clear or overcast. When the sky is clear the temperature is lower and when it is overcast the temperature is higher. Sadly this is not enough to detect clouds. In addition, it is necessary to measure the ambient temperature too. Cloud detector calculates the difference between the sky and ambient temperature. From the tests I deduced that difference of lees than 5 degree means 100% cloudy and difference higher than 22 degree is clear sky. My MLX90614 is not the best for this work as it has field of view of 90°, more suitable would be the one with FOV of 20° or 10°. The casing of the sensor is hermetically sealed and that way it can be directly mounted on top of the shelter without any need for additional rain protection.


This is digital high-precision barometric pressure and ambient temperature sensor. It is designed to be connected directly to a MCU via an I2C bus.


Analog humidity sensor.

Humidity (left) and pressure+temperature (right) sensor.

Pluviometer – rain gouge:

Tipping bucket

I even build rain gauge with tipping bucket, but it is not used in final setup as I have no use/need for precipitations data.

Wiring diagram, click on the picture for better resolution.

For even lover power consumption I replaced Bluetooth module with NRF24 wireless radio transmitter and added internal watchdog timer that wakes up microprocessor when it has to transmit data. NRF24 in comparison with BT drains current of tens uA in contrast of 5mA current for BT. The biggest difference can be seen when modules are not connected to PC. NRF uses the same amount of power in contrast to the BT that draws more than 50mA. Now the only serious power consumers are sensors that remain unchanged.

Useful links:
More pictures in gallery
Arduino library for MLX90614 IR Thermometer
BMP085 Sensor Tutorial
HIH-4030 can work with 3v3 input