Pulse generator

You may use this generator to wake-up an Atmega-based external sensor. The external sensor should measure the value and output it to a UART port.

Pulse counter

It is a 32 bit counter with a configurable debounce interval. Therefore it cannot be used for high-frequency signals.

If the “Interval” parameter is defined, the counter automatically resets after that interval and reports the counted values to a coordinator. If this parameter is zero, the counter increments indefinitely, and the firmware periodically reports a counter’s value.

Configuration example

The counter in the power saving mode (PSM)

The counter uses a hardware interrupt for a rising edge for a configured input. The chip wakes up with every interrupt and stays alive for three seconds. If incoming impulses are too frequent, the chip will never sleep and consume battery power. It is OK if you count a series of impulses for a short time interval.

Please, consider using a special external counter in this mode.

Zigbee2MQTT commands

read – immediately reads the counter value.
Topic: z2m/[friedly_name]/get/[channel]
Channel: l1, l2, l3 … l8
Payload: 1
Returns: The counter value {“[channel]”: float_value}
write – resets the counter, or sets any initial value.
Topic: z2m/[friedly_name]/set/[channel]
Channel: l1, l2, l3 … l8
Payload: 0


Comments
Harvey Specter
Posted at 21:58 March 26, 2021
Damian
Reply
Author

It is possible to disable 3 seconds alive time in PSM mode after receiving impulse? I want to build battery powered pulse counter with impulse frequency about 1 impulse per 1-2 seconds.

    Harvey Specter
    Posted at 05:39 March 27, 2021
    Owner
    Reply
    Author

    No, it is not possible. Therefore my firmware is not acceptable for fast counters without an external hardware counter like pcf8583.

      Harvey Specter
      Posted at 17:53 March 27, 2021
      Damian
      Reply
      Author

      OK, thanks for suggestion, I can go that way, but I see pcf8583 is not supported by your generator, and it needs to by initialized to act as counter. Can I find an example for using custom i2c device with your firmware?

        Harvey Specter
        Posted at 11:11 March 28, 2021
        Owner
        Reply
        Author

        I’ll add it in the next version.

Leave a Reply