Main Content

Autonomous Arduino-weather station on two AA batteries

A stunning result will be achieved - the battery life of the weather station is longer than that of similar industrial products.

Introduction
To begin with, I could not find an amateur weather station or a battery-powered thermostat on the Internet. I mean a simple household autonomous weather station with the measurement of parameters indoors, outdoors and displaying information on the display of the weather station. Hobbyists do not stop at this problem, but power their autonomous devices from solar panels or batteries. Since my surfing on the Internet did not give anything, I realized that this is not a simple problem and began to study it.

To reduce the cost of goods, manufacturers of industrial autonomous devices compose programs taking into account the amount of memory where the codes of these programs are written. After all, memory is money. The smaller the memory size, the lower the cost of the product. It is very difficult to do this on the Arduino IDE platform, since everything is hidden in bulky heavy libraries, and simple codes (sketches) take up several dozen lines in the editor, making work in this environment comfortable and not requiring much effort. I will give a good example: the size of the memory occupied in the controller by the blinking code of one LED written in the Arduino platform is 1030 bytes, in C - 176 bytes, and in the low-level programming language Assembler - 42 bytes. At the same time, industrial household weather stations, room thermostats have been running for years on a pair of AA batteries, and this fact is the goal that I would like to achieve.

To reduce the cost of goods, manufacturers of industrial autonomous devices compose programs taking into account the amount of memory where the codes of these programs are written. After all, memory is money. The smaller the memory size, the lower the cost of the product. It is very difficult to do this on the Arduino IDE platform, since everything is hidden in bulky heavy libraries, and simple codes (sketches) take up several dozen lines in the editor, making work in this environment comfortable and not requiring much effort. I will give a good example: the size of the memory occupied in the controller by the blinking code of one LED written in the Arduino platform is 1030 bytes, in C - 176 bytes, and in the low-level programming language Assembler - 42 bytes. At the same time, industrial household weather stations, room thermostats have been running for years on a pair of AA batteries, and this fact is the goal that I would like to achieve.

I present my version of the weather station with new algorithms, element base and code with low-level inserts. All this made it possible to reach the operating time of the weather station from one set of batteries, even somewhat more than manufacturers of household weather stations and room thermostats guarantee.

Description of the weather station
What is done:

A transition to a stable controller frequency (8 MHz) was made at a supply voltage below 3 V. To reduce the amount of memory occupied in the sketches, some C/C++ functions were used. The main thing is that the algorithm for transmitting packets from an external temperature and humidity sensor and the algorithm for receiving these packets by the weather station base have been fundamentally changed. To ensure reliable reception of packets from an external sensor, not one, but three packets with data on outdoor air parameters and battery status are formed and sent at an interval of about 0.3 seconds. Only after sending the third packet, the controller of the external sensor, together with the periphery, goes to sleep. The weather station base goes to sleep after receiving one of the six packets from the external sensor and wakes up half a second earlier in a minute before the next series of packets from the external sensor arrives.

The weather station consists of two autonomous nodes powered by two AA batteries: a base and an external sensor.

The base is built on the ATMEGA328P controller. It measures the temperature and humidity (temperature and humidity sensor HTU21D) in the room, and also measures and analyzes the power supply voltage of the node, which is provided by two 1.5V AA batteries. The controller also receives a signal from the LoRa receiver, which receives data from external sensor. All information from the controller is displayed on the LCD display of NOKIA 5110.

The external sensor, also assembled on the ATMEGA328P controller, measures the temperature and humidity of the air outside (HTU21D module), as well as the supply voltage of the external node on two AA batteries 1.5 V. The LoRa transmitter of this node transmits data on temperature, humidity and battery status to the base. 3 packets are sent from the external sensor with an interval of about 0.3 seconds, then the ATMEGA328P controller, the LoRa transmitter and the HTU21D module are put into sleep mode to conserve battery power. Measurements and sending data from an external sensor are performed with a cycle slightly less than 1 minute.

The operation of the database is built according to the following algorithm:

First, when both nodes of the weather station are turned on, the base controller sends commands to measure the temperature and humidity inside the room and displays these parameters on the display, then sets the LoRa receiver to the broadcast listening mode. After receiving a signal from an external sensor and successfully decoding the received data, the controller issues a command to re-measure the temperature and humidity and displays the data in full on the screen. Then the base goes to sleep, waking up about half a second before the planned arrival of a signal from an external sensor. Having received and decrypted one of the three packets from an external sensor, it re-performs its measurements, displays information on the display and goes back to sleep. If for some reason there is no signal from the external sensor for about one minute (for example, the batteries are dead), which corresponds in time to sending 6 packets from the external sensor, the base takes measurements only indoors, occasionally scanning the air: what if the external sensor appears on the air ?! This is done so that the LoRa module, which is constantly working on receiving the radio, does not discharge the batteries of the base in a short time.

To assemble the device, you will need radio components:

- Controller ATMEGA328P-PU — 2 pcs.
- Humidity and temperature sensor HTU21D/SHT21/Si7021 — 2 pcs.
- LCD display NOKIA 5110 — 1 pc.
- Receiver-transmitter LoRa Ra-01 — 2 pcs.
- Breadboard (fiberglass), mounting wires, AA batteries, 8 MHz quartz resonators, resistors, capacitors, and other little things.

The cost of components at the prices of the AliExpress website is about $ 25.”

Link to article