ESP-NOW CO2 Gadget Guide: Long-Range Communication

Last modified 4 days

ESP-NOW is Espressif’s peer-to-peer protocol that allows your Gadget CO₂ sensors to communicate with one another without a router or Wi-Fi, with a range of hundreds of metres in open terrain. Useful for sensor networks in classrooms, offices or large spaces where you don’t want to overload the Wi-Fi.

Documentation is currently being updated. We are currently reviewing and improving all our pages. You may come across some broken links or content that is still pending. If you spot anything that isn’t working properly, please help us fix it at GitHub.

What is ESP-NOW?

ESP-NOW is a radio communications protocol for long range and low fuel consumption developed by Espressif. It uses the same Wi-Fi radio but does not require a router or access point — the devices communicate directly with one another (peer-to-peer) using their MAC addresses.

Enable ESP-NOW

ESP-NOW It is not enabled by default in the pre-compiled binaries. To use it, you need to enable SUPPORT_ESPNOW in the section [features] from platformio.ini and compile from the source code:

[features]
SUPPORT_ESPNOW = ON

After compiling and flashing, the firmware displays a menu ESP-NOW Config on the serial port and on /preferences.html.

Configuration

NVS parameterDefaultDescription
`activeESPNow``false`Enable/disable ESP-NOW
`tToPubESPNow`60 sTime between posts
`tKeepAlESPNow`300 sKeepalive interval
`boardID`Device MAC addressUnique number plate identifier
Peer MAC`FF:FF:FF:FF:FF:FF` (broadcast)Destination MAC (broadcast by default)

ESP-NOW shares the Wi-Fi radio; it operates in parallel if your AP is on the same channel (or if `ESPNOW_WIFI_CH = 1` is used). If the router changes channels, ESP-NOW stops receiving until it resynchronises. Be aware of the dynamic channel switching feature on modern routers.

Remote commands (killer feature)

ESP-NOW allows you to send remote commands between devices. The set of supported commands is:

CommandValueFunction
`cmdCO2GadgetNone`0No-op
`cmdCO2GadgetCalibration`1Forced calibration (parameter: 400–2000 ppm)
`cmdCO2GadgetDeepSleepPeriod`2Change to the deep sleep period (parameter: seconds)
`cmdCO2GadgetTest`10Test/debug

For example, you can calibrate remotely Another CO₂ meter – a gadget that doesn’t require physical contact.

Types of message

TypeValuePayload
`MSG_JSON`0Generic JSON
`MSG_RESERVED`1Confidential
`MSG_CO2GADGET`2CO2 Telemetry Gadget (boardID, temp, hum, co2, battery, readingId, command, parameter)
`MSG_PULSECOUNTER`3Pulse counter
`WS_OTHER`128Other protocols

Threshold gating

ESP-NOW posts also go through the ThresholdManager (channel ESPNOW_SEND). They are only published when the value crosses the configured threshold, thereby preventing the network from being overwhelmed with unnecessary messages.

Use cases

  • Meters in multiple rooms without a dedicated Wi-Fi connection
  • ESP-NOW Gateway → MQTT for sending telemetry to Home Assistant without Wi-Fi on the original meter
  • Outdoor monitoring (garage, workshop, greenhouse)
  • Remote calibration of field meters

Notes

  • ESP-NOW and BTHome can coexist (BLE and Wi-Fi share the same band, but ESP-NOW only transmits in short TX slots)
  • The range depends on the antenna and the environment; typical 100–200 m indoors and up to ~200 m in open terrain with a peer on the same channel
  • The CO2 Gadget with ESP-NOW outperforms any commercial meter in terms of range and versatility

Did you find this useful? Share this article. Have a look at the Menu Guide. Any questions? Ask on the Telegram group.

Leave a comment