The PCF8583 is a clock and calendar chip. It has an event-counter mode.
The event counter mode counts pulses applied to the oscillator input (OSCO left open-circuit). The event counter stores up to 6 digits of data. The chip saves the counter value in an internal CMOS RAM and saves a value without external voltage. You may use this counter in the power-saving mode.
⚠️ THIS FEATURE IS AVAILABLE IN THE PREMIUM VERSION

Note: Maybe, you need an external debounce filter (74HC132) for a counter input. Otherwise, the counter will count many noise values. The recommended schematic is shown below.


The firmware allows you to set an initial counter value from a coordinator using the “write” command below.
Zigbee2MQTT commands
read - immediately reads the counter value. Topic: zigbee2mqtt/[friedly_name]/get/[channel] Channel: l1, l2, l3 … l16 Payload: 1 Returns: The counter value {"[channel]": float_value}
write - resets the counter, or sets any initial value. Topic: zigbee2mqtt/[friedly_name]/set Channel: l1, l2, l3 … l16 Payload: {"[channel]": [value]} Value: 0 or any your number
Damian
I have problem with PCF8583 and CC2530 setup… I’m using like on this example – P15 as SDA and P13 as SCL. PCF8583 address is 0xA0 so 160 in dec. Unfurtanelly I see only 32 value of l1 endpoint all the time, and when I try to set 0 for example to this endpoint, I’ll get immediately status: Failure response.
Damian
Same prototype test board works with esp8266 (I just switched SDA and SCL cables from CC2530 to ESP8266 with ESPHome). ESPHome i2c scan shows device at 0x50, but I need to use 0xA0 address in PCF8583 lib – https://platformio.org/lib/show/535/PCF8583, in PCF8583 datasheet also references to 0xA0 address when A0 pin isn’t connected to VCC)
Owner
The standard address is 0x50 (hex) or 80 (dec) in the firmware.
Damian
Thanks, on address 80 it is working… Strange that in PCF8583 platformio library I must enter 0xA0 (8 bits, not 7)…
Owner
The firmware accepts commands in the PSM mode for a short time (about 1 second) after the last report.
FYI: the standard address is 0x50 (hex) or 80 (dec) in the firmware.
Damian
PCF8583 requires premium version (I can’t save firmware in generator when PCF8583 is chosen). Can I test it first before buying (I want to build battery powered device but it would be nice to test it first without PSM)?
Owner
Yes, it requires the premium version.
Damian
I’m still waiting for my CC2530, and meanwhile i’ve build such counter on esp8266 – it works just fine with one PCF8583 and 1K resistor + 100nF capacitor as RC filter before PCF8583 and input signal, so 74HC132 (or any other NAND gate) is not really necessary for counting pulses not faster that about 20 ms each
Owner
Could you please share a schematic? I’ll add an alternative on the page.
Damian
Yes, it’s very simple:
https://ibb.co/S39VNRS
It is working with photoresistor module since yesterday and it counts very well LED pulses from energy meter (6400 pulses per kWh)