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.0. This is a preliminary version that has been tested on real hardware. Individual functions, e.g. the sensors for pH value and water level, 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:

  1. The node wakes up.
  2. It reads its sensors.
  3. It sends the values to the gateway via LoRa radio.
  4. It briefly waits for an acknowledgement.
  5. 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 a gateway within its range. Therefore plan the gateway's location so that the nodes can reach it 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.

Economical battery operation

The node sleeps completely between two measurements. During this time it uses hardly any power, and the battery lasts correspondingly long. In the preliminary version the measuring interval is deliberately set short at about 20 seconds so that tests can be evaluated quickly. In field use a longer one is chosen. 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)

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.

Sensors for the pH value and the water level are in development.

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.

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.

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.

  1. Install the free app ESP BLE Provisioning (Espressif Systems) for Android or iOS.
  2. Connect the gateway to the power supply. As long as it does not know a WiFi yet, it automatically starts the setup mode.
  3. Open the app and search for the device. It appears with the name PROV_….
  4. 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.
  5. Select your WiFi and enter the password. The gateway connects and registers in the cloud.

Automatic recovery: If the stored credentials no longer work, e.g. because the WiFi password was changed, the gateway deletes them on its own and restarts the setup mode. You do not have to open the device or connect a cable for this. Repeat the steps above.

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

  1. Open http://<IP address of the gateway>/update in 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.
  2. Choose the firmware file (.bin) and submit it.
  3. 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:

  1. 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.
  2. During its next measuring cycles the node keeps Bluetooth ready briefly each time. This state remains for about 30 minutes.
  3. 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.
  4. 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. Values that arrive during this time may be lost.
  • Several gateways in range: All devices use the same radio channel. If there are several gateways within mutual range, you should get advice beforehand.
  • 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.