Features of working with wireless pulse counters Lora from Vega-Absolut
My work involves developing software for collecting readings from metering devices.
I also had a chance to work with IoT (Internet of Things) devices. Several times we used devices manufactured by Vega-Absolut, in particular the SI-11 Pulse Counter.
![External appearance of the pulse counter Vega SI-11 External appearance of the pulse counter Vega SI-11](https://habrastorage.org/getpro/habr/upload_files/bc0/cfc/c93/bc0cfcc93357103ec1969527841fd479.png)
Briefly about the device: 4 inputs, counts pulses and once a day transmits the total number of pulses via LoraWan to the Vega server (software and devices of the same manufacturer, base stations too). You can configure the security mode on the ports, but this is not important now. In our case, water meters with a pulse output are connected to the ports.
The pulse interface itself brings with it a bunch of problems, which were described in the article Notes of an IoT provider. The curse of the pulse output. Here I will try to supplement the features that we encountered when working with Vega SI-11 devices.
1. When replacing the Vega server database, the device is lost.
There is a sticker with keys on the SI-11, they need to be entered on the server and it will be able to activate the device by pressing a button or by pressing a magnet (depending on the version). In our case, a button.
By default, the OTAA (over-the-air activation) method is used. It works like this: When activating a device, the server gives a session key and SI-11 encrypts all new packets using this session key.
![Activation example:JOIN_REQ - activation requestJOIN_ACC - response with session key Activation example:JOIN_REQ - activation requestJOIN_ACC - response with session key](https://habrastorage.org/getpro/habr/upload_files/47b/b5b/9a6/47bb5b9a672d1e9a253c776fc56f1077.png)
JOIN_REQ – activation request
JOIN_ACC – response with session key
When replacing or losing the database, the Vega server stops knowing the authorization key, does not know how the packet is encrypted and cannot decrypt it. The device does not ask for the key, it simply sends data on schedule with confidence in delivery. This will continue until you manually start activating the device or until the battery starts to run down (more on this below). To activate the device, you need physical access to the device, and if there are several thousand devices, this becomes a problem.
2. Volatile memory
The device works from a battery, in older versions it is soldered. The problem is that when the power is turned off, everything it has counted is forgotten forever. This is normal, when you replace the battery, you can synchronize. The most interesting thing is how the battery runs down.
In our case, a lithium-thionyl chloride (LiSOCl2) battery soldered to the SI-11 board is used. In new versions, the battery is removable, but we have not worked with such yet.
![Soldered battery SI-11 Soldered battery SI-11](https://habrastorage.org/getpro/habr/upload_files/f23/e85/620/f23e856204bcabc008d0b82e9c20525c.png)
So, the battery dies and at some point it stops holding a stable voltage of 3.6 volts and drops to 3.3 and below. At this point, the accumulated readings are reset.
Simply connecting a multimeter will not catch the current case. You need to connect and start data transmission.
An interesting point is that you can't just replace a lithium-thionyl chloride battery. These are special batteries with low self-discharge that can be stored in warehouses for a long time. Before installing it, you need to depassivize it (the process of removing the lithium chloride film from the battery electrode and returning the voltage on the battery contacts under load above 3.2 volts). More details https://voltacom.ru/articles/depassivaciya-litievyh-batarej
What does a reset lead to: unexpectedly, the client sees readings in the application that are close to zero or to the readings of the last adjustment. We can observe a reset of accumulated readings.
![Example of resetting readings Example of resetting readings](https://habrastorage.org/getpro/habr/upload_files/4dd/a9a/c74/4dda9ac74e736b51bfe77b0208caa505.png)
It is obvious that SI-11 often resets and starts counting again.
In the administration panel (admin-tool) of the Vega server, activation begins. And we remember that it can only be started manually.
![Example of sudden activation due to battery reset Example of sudden activation due to battery reset](https://habrastorage.org/getpro/habr/upload_files/8b3/6c9/dac/8b36c9dac8661d7aa5aebe211850747c.png)
By sorting devices by the last communication session, we think that the device is connected, but in fact it is not.
![1st never contacted the server, the rest recently, but among them there is SI-11 with a dead battery 1st never contacted the server, the rest recently, but among them there is SI-11 with a dead battery](https://habrastorage.org/getpro/habr/upload_files/d61/541/082/d6154108234107162f7333adf02c0417.png)
the rest are recent, but among them there is a SI-11 with a dead battery
Another scenario is to remove the batteries and connect to a power supply. But this is also not ideal. The graphs show exactly when the power was turned off.
![Synchronous jumps in readings Synchronous jumps in readings](https://habrastorage.org/getpro/habr/upload_files/e0d/fa7/a9d/e0dfa7a9da478375053be4ab96e2840b.png)
Uninterruptible power supply is required. A simple external power supply will not help.
By installing a wireless pulse counter, we certainly save on construction, but lose on operation. Time spent on adjustments and replacing batteries is expensive, and time is even more expensive. For example, a large residential complex with 1,000 apartments can have 1 to 2-3 thousand such pulse counters.
The main disadvantage is that SI11 does not transmit data and even worse transmits incorrect data, and this cannot be called a full-fledged work. The manufacturer could have made saving data in ROM, but did not.
Conclusion: be careful when designing an automated metering system, take these points into account.