You may define up to 8 analog inputs in the configuration. You must connect analog inputs to pins P00 .. P07.

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). But 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.

Internal temperature – reports the temperature of the CC2530 chips. You may assign this sensor to any unused pin.

Scale factor – it is the optional scale factor. It cannot be 0. 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: z2m/[friedly_name]/get/[channel]
Channel: l1, l2, l3 … l8
Payload: 1
Returns: The channel state {“[channel]”: float_value}


Comments
Harvey Specter
Posted at 16:49 March 11, 2021
Zmiteri
Reply
Author

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?

    Harvey Specter
    Posted at 03:26 March 12, 2021
    Owner
    Reply
    Author

    The firmware uses a 12-bit resolution. The full scale is 2048 bits, so one bit is 1.15V/2048.

Harvey Specter
Posted at 16:04 February 16, 2021
Alex
Reply
Author

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!

    Harvey Specter
    Posted at 11:31 February 17, 2021
    Owner
    Reply
    Author

    Hi,
    1. Sorry, but I don’t know.
    2. Yes, I’m working on it.

    Harvey Specter
    Posted at 13:50 February 17, 2021
    Alex
    Reply
    Author

    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.

      Harvey Specter
      Posted at 14:04 February 17, 2021
      Owner
      Reply
      Author

      The main problem is power consumption.

        Harvey Specter
        Posted at 12:24 February 25, 2021
        Alex
        Reply
        Author

        Hi,

        Can you explain why the max 1.15V and max 3.3V for the analog input options?

        Thanks!

          Harvey Specter
          Posted at 03:46 February 26, 2021
          Owner
          Author

          It is a hardware limitation of the chip.

Harvey Specter
Posted at 20:41 December 1, 2020
Doublet
Reply
Author

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!

    Harvey Specter
    Posted at 04:01 December 2, 2020
    Owner
    Reply
    Author

    Thank you for the great example!

Leave a Reply