Firmware features
Radio transmission, power saving and operation on the device
The firmware is the software that runs directly on the HC-50 gateway and the HC-50 nodes. It ensures that readings are recorded, transmitted by radio and displayed in EcoSensors.cloud. The same program code is used for gateway and node. They differ only in their task.
This page describes firmware version 0.9.6. This is a preliminary version that has been tested on real hardware. The water level measurement is in testing. Further sensors, e.g. for the pH value, will follow in later versions.
How the system works
Gateway and node have different tasks:
| Node (measuring station) | Gateway (base station) | |
|---|---|---|
| Task | Measure and send | Receive and pass on to the cloud |
| Power supply | Battery, economical | USB power supply, continuous |
| Connection | LoRa radio only | LoRa radio and WiFi |
| Operation | sleeps most of the time | listens continuously for radio signals |
A measuring cycle of the node:
- The node wakes up.
- It reads its sensors.
- It sends the values to the gateway via LoRa radio.
- It briefly waits for an acknowledgement.
- It goes back to sleep.
The gateway accepts the values, acknowledges receipt and passes them on via WiFi and the internet to EcoSensors.cloud. There the node's values appear just like those of the gateway itself.
A node transmits directly to the gateways within its range. Therefore plan the locations so that every node can reach at least one gateway directly. Several kilometres are typical, depending on the terrain.
Features at a glance
Reliable radio transmission
- Acknowledgement: The gateway acknowledges every packet received. If no acknowledgement reaches the node, it sends up to three times.
- Automatic transmit power: The node starts with low power and increases it as needed. If a level works reliably, it remembers it and later carefully tries again to transmit with less power. This saves the battery.
- Send changes only: A value is only transmitted if it has changed since the last transmission. This shortens the transmission time and saves energy. Until then the cloud shows the last known value.
- Transmission time limit: Radio devices in the 433 MHz band may only transmit for part of the time (more on the radio parameters under LoRa radio technology). The firmware observes this legal limit on its own and extends the pauses when necessary. You do not have to configure anything.
Several gateways
Since version 0.9.4 several gateways with overlapping range can be operated. This makes the system fail-safe, see HC-50 system.
- Every gateway transmits itself: Every gateway that receives a packet from a node passes its values on to the cloud via its own WiFi. The cloud removes duplicate values. Gateways do not relay packets to one another. Each one therefore needs its own power supply and its own WiFi with internet access.
- Only one gateway acknowledges: The gateways coordinate by radio. Priority goes to a gateway that holds a setting for the node, then to one with a working internet connection, then to the one with the best radio link to the node. The others overhear the acknowledgement and skip their own.
- Automatic takeover: If a gateway fails or loses its internet connection, another one acknowledges and forwards. A gateway without an internet connection only acknowledges if no other one does.
- No configuration needed: All devices use the same radio channel. Nothing changes on the nodes.
- Radio quality per gateway: Every gateway reports how well it receives a node and the other gateways. This is the basis of the network map in the dashboard.
Gateways with older firmware do not coordinate. In a setup with several gateways, update all gateways to version 0.9.4 or newer.
Economical battery operation
The node sleeps completely between two measurements. During this time it uses hardly any power, and the battery lasts correspondingly long. By default the measuring interval is deliberately set short at about 20 seconds so that tests can be evaluated quickly. For field use it can be set remotely per node between 10 seconds and 24 hours, see “Remote settings” further down. The less often measurements are taken, the longer the battery lasts. What else influences the runtime is described under Power supply.
Sensors
The following sensors are supported by the firmware. They can be connected to gateway and node:
| Sensor | Readings |
|---|---|
| Processor temperature (built in) | Temperature inside the device |
| BME280 | Temperature, humidity, air pressure |
| BMP280 | Temperature, air pressure |
| BMP085 | Temperature, air pressure |
| VEML7700 | Brightness (lux) |
| MCP9808 | Precise temperature (±0.25 °C) |
| DS18B20 | Temperature, e.g. water temperature (up to four probes) |
| RCWL-9620 (ultrasonic) | Distance to the water surface for the water level, in testing |
The sensors do not have to be configured. At startup the firmware checks which sensors are connected and transmits only their values. A sensor that is not connected does not produce an error message.
In addition, every device reports information about its own status: operating time, firmware version, the quality of the radio link (signal strength and signal-to-noise ratio) and how heavily the permitted transmission time is used. For the gateway, WiFi data is added, e.g. the WiFi signal strength.
The ultrasonic water level measurement is in testing. Further sensors for water quality, e.g. for the pH value, are in development. The status of each measurand is shown on the page Water monitoring. The SCD40 CO₂ sensor, the MPU-6500 and MPU-6050 motion sensors (tilt and movement of the device), battery monitoring, the Paxcounter and the magnetic switches for maintenance are also in testing. Sensors for fine dust, wind, air quality (MQ-135: alcohol, benzene, CO₂, smoke and other gases) and radioactivity as well as positioning via GPS are planned.
Online status
Each device is listed in the cloud with the status online or offline. A gateway signs itself off as soon as the connection breaks. For nodes the gateway takes over this task: if it hears nothing more from a node for a longer time, it marks it as offline. How long it waits depends on the node's measuring interval.
In addition, the gateway keeps an event log for every node. It records when a sensor fails or works again, when the node goes offline or online, when acknowledgements fail to arrive and when the firmware version changes.
Unique device identifier
Each device automatically receives its own identifier, derived from its hardware address:
- Gateways:
hc50gw-xxxxxx - Nodes:
hc50nd-xxxxxx
You do not have to enter the identifier anywhere. On the gateway it can be found on the display and on the sticker. With it you assign the device in the cloud.
Remote settings
Some settings can be changed via the cloud connection (MQTT) without opening the device:
| Setting | Effect |
|---|---|
| Measuring interval (node) | 10 seconds to 24 hours |
| Maximum transmit power (node) | Upper limit for the automatic transmit power |
| LED | switch on and off, switch off the automatic signals |
| Update mode (node) | keep Bluetooth ready for a firmware update, see “Update the firmware” |
A gateway applies a setting immediately. A node receives it the next time it reports in, because it sleeps in between. Measuring interval and maximum transmit power remain stored in the node, even after a battery change. Please contact support for changes if needed.
Operation on the device
Display
Gateway models with a display (Heltec WB32LA) show status and readings. To save energy and protect the display, it switches off after one minute without operation.
Button (PRG)
- Short press: wakes up the display.
- At the same time the button triggers a test transmission. This lets you check at the place of use whether the radio link is up.
LED
The LED lights up only for events, not continuously:
- Brief flash: radio activity, i.e. a packet was sent or received.
- Four quick blinks: an error has occurred.
The LED can also be switched on and off manually via the cloud and then serves e.g. as an aid to find a device on site. The automatic indications can be switched off for this.
Set up WiFi (gateway)
The WiFi credentials are not written permanently into the firmware but entered by smartphone during commissioning. This way your password is only stored on your device.
- Install the free app ESP BLE Provisioning (Espressif Systems) for Android or iOS.
- Connect the gateway to the power supply. As long as it does not know a WiFi yet, it automatically starts the setup mode.
- Open the app and search for the device. It appears with the name
PROV_…. - Enter the PIN. It is on the gateway's display or, for models without a display, on the sticker or QR code on the device, if the device was delivered that way. Each device has its own PIN.
- Select your WiFi and enter the password. The gateway connects and registers in the cloud.
Automatic recovery: If the gateway cannot reach its WiFi for two minutes, it opens the setup mode for five minutes and then tries the stored WiFi again. This repeats until the connection is up. The stored credentials are always kept: after a power cut or a router restart the gateway reconnects on its own. If the WiFi password has changed, repeat the steps above as soon as the setup mode is open. You do not have to open the device or connect a cable for this.
Update the firmware
There are three ways. Which one fits depends on the device:
| Device | Way | Effort |
|---|---|---|
| Gateway | Via WiFi through a web page in the browser | low, no cable needed |
| Node | Via Bluetooth with the smartphone | medium, you have to be on site |
| Gateway and node | Via USB cable | housing must be accessible |
Gateway: via WiFi
- Open
http://<IP address of the gateway>/updatein the browser. Smartphone or PC must be in the same WiFi. You find the IP address in your router or in the cloud under the device. - Choose the firmware file (
.bin) and submit it. - The gateway installs the firmware and restarts on its own.
Node: via Bluetooth
A node sleeps almost all the time. It therefore has to be put into update mode beforehand, without you having to open it:
- Request the update mode for the node. This can be done before you even travel there via the cloud connection (MQTT). If needed, contact support for this.
- During its next measuring cycles the node keeps Bluetooth ready briefly each time. This state remains for about 30 minutes.
- On site, connect with the Android app ESP32 OTA BLE and select the firmware file. The range is a few metres to a few dozen metres.
- After installing, the node restarts. If nobody has arrived within the time, it returns to normal operation on its own.
Via USB cable
Always possible if you have the device in your hands. This requires a computer and the development environment. Contact support if needed.
Only install firmware files that you received directly from EcoSensors. The updates via WiFi and Bluetooth do not yet check in the current version whether the file is genuine. A digital signature check will be added.
Good to know
- Connection drops: If the internet or WiFi is briefly disrupted, the gateway reconnects on its own and sends buffered values afterwards. The buffer is small. During a longer disruption values are lost unless a second gateway hears the nodes.
- Several gateways in range: All devices use the same radio channel. Gateways from version 0.9.4 coordinate automatically, see “Several gateways” above.
- Better radio link: Position gateway and nodes as openly as possible, e.g. on a mast or on the roof, and not near large metal surfaces. More on this under LoRa radio technology.