You may define up to 8 analog inputs in the configuration. You must connect analog inputs to pins:
CC2530, CC2531: P00 .. P07
CC2652, CC1352: P23 .. P30
The firmware reads analog values when it sends a periodic report to a host. When the periodic report is disabled, you should send the “read” request for the configured endpoint.
All analog inputs have a 12-bit resolution.
The firmware configures an ADC pin with the special “3-state” mode. The unconnected pin has a high level (3.3V).
⚠️ CC253x: If you configure another GPIO pin after ADC on the same port (P0x) with the “pull-down” mode, the unconnected ADC pin will have about 0.2V.
Analog input, accurate (max 1.15V) – the pin uses an internal reference voltage that is more precise than a source voltage.
Analog input (max 3.3V) – less accurate, but it can measure higher voltage.
Source voltage – reports source power voltage. It can be used to monitor a battery level. You may assign this sensor to any unused pin. The device with the PSM firmware reports the battery state automatically without this sensor configured.
Internal temperature – reports the temperature of the chip. You may assign this sensor to any unused pin.
Scale factor – it is the optional scale factor. The scale factor cannot be zero. The firmware multiples the measured value by this scale factor before sending a value to a coordinator.
Zigbee cluster: ZCL_CLUSTER_ID_GEN_ANALOG_INPUT_BASIC
Zigbee attributes:
ATTRID_IOV_BASIC_PRESENT_VALUE - the sensor value (single precision float).
ATTRID_IOV_BASIC_DESCRIPTION - the value units (V - voltage, C - temperature).
Zigbee2MQTT commands
read – immediately reads the analog input value
Topic: zigbee2mqtt/[friedly_name]/get/[channel] Channel: l1, l2, l3 … l16 Payload: 1 Returns the channel state: {"[channel]": float_value}
Zmiteri
Hi! Can you tell me about “Analog input, accurate (max 1.15V)” – what a resolution of ADC in this mode? I read datashet for cc2530 and a lit bit confused. range is 7bit-12bit, with effective number even smaller. Does it mean, that a minimal registered voltage is about 1mV resolution?
Owner
The firmware uses a 12-bit resolution. The full scale is 2048 bits, so one bit is 1.15V/2048.
Alex
Hi, thanks for the great firmware. Couple questions related to voltages on the chip:
(1) Do you where where the about 0.2V comes from on the ADC inputs when nothing is attached?
(2) I heard from Doublet in the thread related to the moisture sensor that you’re currently building the configurable firmware to allow for battery operated Zigbee chips, is this true?
Thanks a lot!
Owner
Hi,
1. Sorry, but I don’t know.
2. Yes, I’m working on it.
Alex
Can you briefly explain what the issue is with using a battery? I seem to be able to get reports through z2m just fine when supplying 5V from batteries to my CC2531 chip.
Owner
The main problem is power consumption.
Alex
Hi,
Can you explain why the max 1.15V and max 3.3V for the analog input options?
Thanks!
Owner
It is a hardware limitation of the chip.
Doublet
This basic feature enabled me to build a Zigbee moisture sensor: https://community.home-assistant.io/t/diy-zigbee-capacitive-soil-moisture-sensor/251031. Thnx keep up the good work!
Owner
Thank you for the great example!