Monitoring temperature at a remote site by “improvised” means


Back in 2019, when it was possible to go outside without a pass, I was asked to do remote monitoring of the temperature in the village house. The conditions were as follows. There is a private house with internet, in the house there is a gas boiler for heating. The boiler maintains a certain temperature in the heating system, periodically turning it on and off. In the off state, the standby wick is on. The hood is installed with errors, so a strong wind from outside periodically blows the wick and the heating stops working. So that in winter the water in the heating system does not freeze, you need to manually light the wick.

In this house, people appear once a month, so you can’t do without a monitoring system. Next, the statement of the problem and its implementation in the most “lazy" way that I found in 2 months.


Problem statement
If the wick goes out, then the temperature in the house begins to gradually drop. When it drops below 15 degrees, send an “email” notification to the “client”. The “client” himself makes a decision, either to go by himself or to call the neighbors who light the wick. Main condition: “No configuration. I brought it, turned it on and everything works. ”

Element base selection
I had 2 months for development (the task was set in the fall, it was far from frost). In this situation, the ESP8266 begs for itself. There is Wi-fi in the house, libraries for measuring temperature are written for various sensors. I had both an ESP and a DS18b20 temperature sensor, so I postponed this project for a while due to work on the main job. Almost 2 months passed and it was time to turn in a ready-made solution, but I did not start. I looked around and decided to use a ready-made solution with some modifications. I had a free Z-Wave based smart home controller. It consists of RaspberryPi and an expansion board for it, which makes it a smart home controller. RaspberryPi bought on Avito for 1500r. half a year ago, and I had a used expansion board. New costs 6000r.



If you buy everything in the store, then the price is about 13000r. and is called the "RaZberry Controller."
I did not have a ready temperature sensor compatible with Z-wave.

I made it on the basis of ZUNo (in the store about 3000r., I got one of the prototypes for free) and a sealed temperature sensor DS18B20.


ZUNo is an Arduino compatible board with a built-in radio transceiver. The sketch for her took without changes from the manufacturer's website ( https://z-uno.z-wave.me/examples/1-wire-ds18b20-temperature-sensor/) From this sketch, ZUNo polls the temperature sensor every 30 seconds and sends a notification to the controller via radio. ZUNo does not sleep while waiting. It’s me that the sketch is primitive, it does not save resources either on the microcontroller itself or on electricity. But he does exactly as much as I need!
ZUNo “neatly” filled with hot melt adhesive in a plastic case.

He brought 2 wires out of the case: powered by USB and a temperature sensor. It turned out reliably, so it's not scary to drop it and it looks decent.

The controller connected via Ethernet cable to the router. The cable could not be used. RaspberryPi can use Wi-fi. But since the main requirement was “turned on and forgot”, I did not take risks with pre-setting the wi-fi network on raspberryPi.
RaspberryPi was connected to a 2 amp “charge” from the phone. The temperature sensor consumes up to 50 mA so it is connected to the RaspberryPi USB connector.

Raspberry setup
The image was taken from here storage.z-wave.me/z-way-server called "razberry.img.zip".
Next, I installed the image on the SD card for RaspberryPi.
If RaspberryPi has started, the Z-way server (smart home software) will also be launched. But it is an old version, it needs to be updated. In the settings there is a button for updating, but no one uses it and it does not work.

It is much more “convenient” to use the instructions for updating. She is at this address. To enter the commands described in this manual you need to open a terminal on RaspberryPi. This can be done via ssh or by connecting a monitor with a keyboard. The second monitor and keyboard are always with me, unlike the router, so I chose the second option. Since I’m developing an unattended embedded system, you need to provide a watchdog timer to increase reliability. All the same, RaspberryPi is not an industrial controller and the Z-wave system, it is also not recommended to use it in critical decisions; I will count on periodic freezes, which can only be exited by restarting the software or the entire operating system on RaspberryPi. I will restart the entire operating system every day at 12:00.
To do this, I added a line to the file executed after the start of the operating system.
#sudo vi /etc/rc.local
shutdown -r 12:00

Basic vi commands
if I want to repeat and forget
“i” - start typing in vi
“: wq!” - save and exit vi

The assembled ZUNo-based temperature sensor is also not ideal, if you connect it to the RaspberryPi it will reboot on power every day. This greatly improves the reliability of the system as a whole. The operating system remains the weak point, if it freezes and does not restart at 12:00 there is nothing to be done. Have to call a "specialist" to distort the food. However, this operating system has been tested and debugged better than the other components of this project (I hope). You have to take this risk.

Setting up the Z-way server software

To enter the graphical part of the Z-way server software, it energized the equipment and after a few minutes used the service. This service looks for RaspberryPi with a Z-way server running on the local network and displays their ip addresses. You can also connect to a remote RaspberryPi here. To configure this, I chose a local RaspberryPi. Set a username and password and remembered the six-digit ID. This is enough for a remote connection.

ID for remote connection.

1) Added a temperature sensor. This is a standard action.

2) Added Applications-> Local Applications-> Email ME

3) Specified the name of the element and email address with the text of the letter
4) Added the condition under which the letter will be sent. Nothing too complicated.


Final check
Connected RaspberryPi to a router through a cable, applied power, connected a thermal sensor.
I cooled the temperature sensor and received a letter, then one more, and another. While the temperature is below 15 degrees, the "client" will receive letters. It’s good, you won’t be able to miss it. (Looking ahead, I’ll say that the client didn’t have mail either, so I received several hundred letters from my “brainchild.” My mail client conveniently put them in chains and did not cause any discomfort).
To quickly see the temperature in the house on the phone, I installed the Z-way application.

I can’t say that it is fast, convenient, but it allows you to remotely connect to the Z-way server on RaspberryPi and watch the temperature.

Summary
For 2 evenings, looking around, I assembled a temperature monitoring system for a remote object. Previously, ZUNo and the Razberry controller were considered expensive toys. But after the solemn removal of my equipment from the "combat" post, where it several times in time determined the malfunction of the heating system during the winter season, I was respected by these products. And there is something to respect. The Internet and the light periodically disappeared, but after the resumption of filing, communication was restored. Now I disassembled this “complex” into spare parts and understood its main strength. Having a Razberry controller board that can be inserted into RaspberryPi, or via an UART adapter to any computer, one or two ZUNo, a basic set of sensors and simple actuators, you can quickly solve the problem.I don’t like the word “easy” and do not have the experience of using “smart” equipment from other manufacturers, but in 2 days I received a ready-made set of equipment that is enough to connect to power, as well as an application on a smartphone, a web application on a computer and notifications by e-mail.

All Articles