My parents live outside the city and for storage of vegetables, like many, they use the cellar, which in winter needs to be well insulated and monitored so that the vegetables do not freeze. I thought it would be convenient to monitor the temperature, and at the same time the humidity in the cellar without leaving the house. So there was a project for monitoring temperature and humidity in the cellar.
The project consists of two parts - a receiver and a transmitter. The transmitter contains a humidity and temperature sensor, works autonomously, powered by a battery, and takes measurements at a certain interval and sends it to the receiver. In between measurements, the transmitter is asleep.
The receiver receives data from the transmitter and displays them on the display, while the data is written to the log and it is possible to view the history of changes in temperature and humidity over the past period.
As a wireless protocol for transmitting data between the transmitter and receiver, I decided to use LoRa, which has a large communication distance and low power consumption. “LoRa” is a Sementech patented modulation method. The LoRa technology is supported by SX1278 / SX1276 and other chips manufactured by Sementech, on which the transceivers on the market are based. LoRa transceivers promise long battery life and communication over a distance of several kilometers.
Earlier, I tested 433MHz LoRa modules (sx1278), for which I designed and manufactured an adapter board for Wemos D1 mini.
Later I found a more suitable option for the transmitter - TTGO T-Base. It is pinout compatible with Wemos D1 mini, but it already contains a charging and battery voltage control circuit.
The expansion card for the T-Watch contains a LoRa-module, which is based on the SX1276, with an operating frequency of 868 MHz, I also had modules on the SX1278 with a frequency of 433 MHz, so an additional transceiver was ordered for the corresponding frequency.
For the test, the project for monitoring the temperature in the cellar with new components was revived. Now it looks like this:
Transmitter: TTGO T-Base + SX1276 + DS18b20
Receiver: TTGO T-Watch + SX1276
In the repository there is an example for working with the LoRa module.
The lvgl library on which this example is based turned out to be difficult for me to understand, so I wrote my sketch without using it. I adapted the LoRa_sender and LoRa_reciver examples from the Arduino-LoRa library.
After receiving the printed circuit boards, the shield was finally assembled.
An important characteristic of a transmitter is its power consumption. The figure shows a graph of the current consumption of the transmitter, the values are sent every minute, after which esp8266 goes into deep sleep mode. The measurement was carried out using a USB tester with Bluetooth, which does not differ in high resolution and sampling frequency, so not all peaks corresponding to the wake cycle of the microcontroller are displayed on the graph. In the sleep cycle, however, consumption is completely equal to 0, which would certainly be wonderful if it were true.
However, the transmitter has been running for several days in a row.
To work in real conditions, it is necessary to reduce the frequency of sending the measured parameters, remove the LED from the T-Base board and, possibly, process the LoRa-shield board.
The T-Watch based receiver displays the latest temperature, minimum, maximum and a graph of the last 240.
Since I, unfortunately, do not visit my parents very often, so far I have managed to test the system only twice. The first test was not entirely successful: I left the transmitter outside the cellar, and lowered the temperature sensor inside. But, apparently, because of the frost, the battery was quickly discharged and it was not possible to trace any temperature dynamics in the cellar.
The second test was more successful. The transmitter, placed inside the cellar, worked for almost a day, until I took it. The signal was confidently received throughout the house, at a distance of about 50m. It should be noted that the transmitter was at a depth of a couple of meters underground, and there were several obstacles between it and the receiver.
TODO
Change sensor DS18B20 to humidity sensor.
Add transmitter battery charge control.
Choose a box for the transmitter, preferably tight.
Optimize receiver code.
Comments