The power-saving mode (PSM) allows minimizing power consumption up to 0.4 µA in the sleep mode. Of course, attached sensors and peripherals should support power saving too.
Note: I cannot guarantee that the firmware will work correctly in your case because it greatly depends on the schematic of your DIY device. I exhort you to wash your DIY device in an ultrasonic cleaner because a small current leak may consume a battery.
⚠️ THIS FEATURE REQUIRES THE PREMIUM VERSION
The power-saving mode has the following limitations:
- GPIO input, the switch mode – the firmware detects ON and OFF states’ changes by a signal rising or falling edge. The CC2530 has a hardware limitation of this implementation. You can add only one switch on pin ranges P00 – P07, P10 – P13, P14 – P17, P20 – P23. Therefore, you can have up to four switches in your configuration. If you define a switch on a pin, you cannot use other pins in the corresponding range for other sensors because it may cause problems with detecting signal edges.
- You may use a board with an amplifier (for example, EBYTE E18, CC2530 + CC2592), but this combination of chips consumes about 180 mA in the active mode instead of 25 mA of CC2530.
- Some sensors are incompatible with PSM (for example, Pulse Generator, SenseAir8, Sensirion SPS30).
- CC253x: The maximum uninterruptible sleep time is about 512 seconds (rounded to 510 s). After this time, the chip wake-ups, updates the sleep times and continues sleep. The device does not poll sensors or activate the radio module at that moment.
The following configuration options may help you to create your battery-powered device:
External wake-up – it is a special input type. It wakes up the chip from sleep mode and instructs it to send periodic reports immediately. After this, the chip stays active for 3 seconds and goes to PSM.
If the external wake-up option is selected on Input 1, the firmware also uses it as a system button and allows you to reset the device.
External sensor power control – it is a special output type. The firmware sets the configured output to the HIGH state before reading a sensor’s value, and sets it to LOW after that. The CC2530 and CC2531 chips allow you to use pins P10 and P11 to supply power up to 20 mA to external sensors.
If your sensors require more power, you may use any output connected to an external transistor worked in the switch mode. Please note, the firmware sets all output to the LOW state when it transits to the sleep mode. Therefore, the transistor should be switched off with the LOW control signal.
This output should be defined immediately before a controlled sensor or a group of sensors. Any sensor that does not support external control (GPIO, outputs, switches, internal temperature or voltage, etc.) or GPIO resets the “External sensor power control” setting.
“Wake-up delay” turns on external sensors X ms before reading and sending data so that they have time to warm up, initialize and collect initial data. This value depends on your sensors. It is a maximum value from all sensors controlled by this pin. If “Wake-up delay” is zero, the firmware starts reading sensor data immediately.
Wait for commands after report (on the Expert tab) – The device will wait for 2 seconds after it successfully sent a report with all values to a coordinator. It allows sending some commands back from the coordinator (for example, to configure an interval of periodic reports, control a state of GPIO, etc.).
Poll for queued commands (on the Expert tab) – If you enable this option, the device will wake up every N seconds and send a small request to a parent device (coordinator or router) to check for commands addressed to this device. The device does not poll data sensors and does not send any values to a coordinator. The device consumes rather more power, but you can get a more responsive sleeping device.
The LED indicator works differently in PSM if it is configured.
One short blink per four seconds – the device is connecting to a network.
Sporadic short blinks – the firmware indicates the following actions: clicks, switches, external wake-up signals, periodic reports.
Two short blinks – the firmware cannot send a report to a coordinator.
The firmware starts the pairing process immediately after flashing. It tries to connect for about 60 seconds. In case of an unsuccessful attempt, the firmware goes to sleep mode. If you need more time, you should configure the external wake-up input (for example, a button). The signal on that input extends the time for the next 60 seconds.
Power on, wait 2 seconds, power off, repeat this cycle three times. If the status LED is configured, it should light at a half-bright level for more than 2 seconds while the firmware initializes internal NVRAM memory.
If you selected GPIO or the external wake-up option on Input 1, it acts as a system button. You may click and hold it for 10 seconds. If the status LED is configured, it should light at a half-bright level after 10 seconds.
- Measure the power consumption of an assembled device with a constant power before using it with a battery. You should expect a range of 0.4 – 2 uA for most low-power devices (depending on the schematic and enabled features). If you observe higher current draw, clean your device using isopropanol, a similar alcohol-based liquid, or an ultrasonic cleaner (highly recommended).
- It is important to protect electronic components on your device from impact on the environment (high relative humidity, oxidation of contacts, etc.). I recommend using urethane aerosol spray for it.
- For better power consumption, you should use an external pull-up resistor for all GPIO inputs (3-5 MOhm).
- The firmware measures and sends a battery value with a periodic report. I recommend set to 21600 seconds (6 hours). The periodic report will also help you control the status of your device.
- Some routers work incorrectly with long time sleeping devices. Maybe, you’ll need to change this interval to 300 – 3600 seconds (try various values).