Use Cases
Reed Sensor
- Count how many times a door is opened
- Detect a left open door/window
- Monitor a drawer, window, refrigerator door etc.
- Detect intrusion into an area by attaching a trip wire to the reed contacts
- Use as a call button - to call a taxi from a taxi station nearby e.g.
- Use like an Amazon Dash Button to automate a task when a button is pressed: ordering something, controling a distant relay that listens for MQTT messages, controling some home automation device etc.
Motion Sensor
- Detect a knock on a door
- Detect opening of a window
- Detect whether a machine (e.g. washing machine, industrial appliance) is working or not *
- Detect movement of an elevator *
* could be supported in future firmware
Temp./Humidity/Pressure sensor
- Calculate absolute humidity
- Weather forecast
- Measure elevation level
- Find out which floor an elevator is on
- Use data to control air ventilation or heating/cooling
- Warn about mould on high relative humidity levels
Battery Life vs Precision vs Transmission Interval

A "trick" when trying to achieve a low average power consumption is to transmit infrequently: say every 5 minutes. This sacrifices data density for power efficiency. This easy route has not been chosen in this project. The transmission interval is fixed at 0.5 minutes. Note that the sensor could even achieve a higher battery lifetime if the transmission was based on a minimum delta between 2 measured datapoints, e.g. if we changed the code to only transmit if the temperature has changed by at least 0.05°C since the last transmission (same for pressure/humidity) then we might save some substantial battery juice because the transmission would happen more infrequently. Please also note that in such a case waiting for an acknowledgment from the receiver is a good idea because the "last transmission" from the view of the sender is not necessarily the "last transmission" from the view of the receiver. Missed packets can always occur.
A different approach to increasing battery lifetime is to keep data imprecise. The less bytes you send, the faster you'll be finished. The faster you're finished, the less energy you've consumed. Sending the temperature without decimals e.g. would fit in 1 single byte. Canique Ambience does not go this route either.
Temperature (°C) is transmitted with 2 decimal places, relative humidity (%) is transmitted with 2 decimal places, barometric pressure (Pascal) is transmitted with 1 decimal place. So: no sacrifice here either. A compression is applied to the transmitted data, though, to save some valuable battery power.
We already mentioned that a fast transmission saves power. Now you could be tempted to transmit at maximum speed which in the case of the used radio chip is 300kb/s using FSK modulation. The drawback of this approach is that you're trading off speed for range. Higher speed means lower sensitivity, means lower range.
The sensor introduced here transmits at 25kb/s, so: range has not been sacrificed either.
Battery Life
This is a comparison table for the estimated minimum battery life assuming max. transmission power (+13dBm), a transmission interval of 30 seconds and a battery self discharge of 15% over the entire lifetime.
Note that with lower transmission power, the battery life time will increase.
Measurement | Battery | Min. Batt. Life |
Temperature, Rel. Humidity, Pressure | Energizer Ultimate Lithium 3000 mAh | 13 years |
Temperature, Rel. Humidity, Pressure | Energizer Ultimate Lithium 3000 mAh min. TX power (-18 dBm) | 20 years |
Temperature, Rel. Humidity, Pressure | Alkaline 2800 mAh | 10 years |
Temperature, Rel. Humidity, Pressure, Knock detection | Energizer Ultimate Lithium 3000 mAh | 10 years |
Temperature, Rel. Humidity, Pressure, Knock detection | Energizer Ultimate Lithium 3000 mAh min. TX power (-18 dBm) | 13 years |
Temperature, Rel. Humidity, Pressure, Knock detection | Alkaline 2800 mAh | 9 years |
Temperature, Rel. Humidity, Pressure, Tilt detection | Energizer Ultimate Lithium 3000 mAh | 13 years |
"Knock detection" means an immediate transmission when a vibration is detected (measured @100Hz).
"Tilt detection" means an immediate transmission when a rotation of the sensor is detected (in either x, y, or z axis, measured @12.5Hz).
In either detection mode a low number of motion-related transmissions per day is assumed (less than 30).
Quiescent Power Consumption
Input Voltage | Consumption | |
Tilt detection (alone) | 1.25 V | 1.7 µA |
Knock detection (alone) | 1.25 V | 8.5 µA |
MCU, RTC, Radio, Temp./Hum./Pressure sensor (sum) | 1.25 V | 2.25 µA |
Why no solar power?
Solar power is a popular option in recent projects. Usually you'll need some energy harvesting IC, a solar panel and some super capacitor or some other energy storage to get you through dark hours.
The solar option decreases your flexibility - you're bound to light and increases your BOM cost. To keep costs to a minimum this project does not use any solar power. The dependence on light would limit the sensor's usabillity: what if you want to measure temperature in a refrigerator or a freezing chamber where it's dark?
Another reason for staying away from solar power is that a temperature sensor should not be exposed to direct sunlight. It dramatically influences the measurement. So to go with solar power the solar panel would need to be mounted elsewhere...
Why no WiFi?
With minimum battery consumption in focus, WiFi is just not an option. It consumes far too much power.
Low power options are:
- Bluetooth LE (only intended for short distance)
- Zigbee
- 915/868/433 MHz radio with FSK or LoRa modulation
Hardware
The core of the hardware is a Cortex M0+ MCU running at different speeds in different sleep modes depending on the current task.
The sensor for the temperature/humidity and the sensor for barometric pressure (Bosch BMP388) are separate since only very accurate sensors are used here.
The whole system is running @ 1.8V internally - this again has to do with the goal of achieving best in class power consumption. The minimum possible voltage was selected.
The radio used is an RFM69W module.
Reed sensor

The reed input is internally pulled up to 1.8V. In case the circuit is closed, a small current (~240 nA) flows through the pull up resistor to GND. The magnetic reed switch shown in the picture is a NC (normally closed) switch.
When the magnet is near the switch, that is: when the door/window is closed, the circuit is open and no current will flow. When the door/window is opened, a small current will flow until it is closed. Each transition will be transmitted via a radio message. Of course you can use a "normally open" switch too - in that case current will flow when the door or window is closed, and stop flowing once it is open.
Apart from reed sensors, you can also connect a button to the input. On each press of the button, the wire terminals will be connected to each other and the sensor will detect this transition.
Another possibility (requiring a firmware change, though) would be to use the button input as a frequency counter.
Why encryption is mandatory for a reed sensor
If radio transmissions were not encrypted, door/window status could be eavesdropped by any person with a radio receiver. Even if transmissions are encrypted, it must be done properly: encrypting the same plain text multiple times must produce a different cipher text each time. Otherwise the same reed status would always produce the same encrypted message and an eavesdropper could again deduce the status of the door/window even without decrypting the message.
Encryption alone, though, is not sufficient. Encryption is about hiding the status of the reed sensor or other data. It must also be taken care that an attacker cannot inject an unauthentic message. If the authenticity of each transmitted message was not verified, any malicious sender could transmit fake door status messages e.g.
Canique Ambience uses Chacha20-Poly1305 for every transmitted message - a 256 Bit AEAD cipher - for both ensuring proper encryption and authenticity.
Base Station
There are 3 options for the base station which will translate radio messages from the sensors into MQTT messages.
- Canique Pico Gateway: standalone device built using a Raspberry Pico and a Wiznet Ethernet Chip
- Canique Raspberry Pi Radio Hat: a CR2032 battery powered time-keeping hat for the Raspberry Pi turning it into a radio gateway
- Canique Gateway: contains a 4 core ARM SOC and a radio hat, runs Linux
The Radio Hat for Raspberry Pi is the most affordable. It turns a Raspberry Pi into a radio transceiver being able to communicate via a secure 868 MHz connection with the sensors.
Canique Ambience Quick Facts
- Radio frequency band: 868 MHz
- Radio encryption: Chacha20-Poly1305 (256 Bit symmetric cipher)
- Range: 400-800 meters
- Reed connector:
2 pin 3.5mm wire terminal, max 0.75mm² wire
2 pin 2.5mm through holes for parallel wire terminal (not assembled) - Temperature range: -40°C to 85°C (except battery)
- Humidity range: 0% to 100%
- Thermometer/Hygrometer resolution: 0.01°C / 0.01%
- Absolute Temperature accuracy
0 to 60°C ± 0.2°C
80°C ± 0.3°C
-20°C ± 0.4°C
-40°C ± 0.6°C - Min./Max. transmission power: -18dBm / +13dBm
- Transmission speed: 25kbps