# Using binary inputs for water or electricity metering

**URL:** <https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572>\
**Category:** TOWER\
**Created:** [May 1, 2020, 1:42pm UTC](https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572 "2020-05-01T13:42:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![glomerata](https://forum.hardwario.com/user_avatar/forum.hardwario.com/glomerata/32/464_2.png) [@glomerata](https://forum.hardwario.com/u/glomerata)\
**Post date:** [May 1, 2020, 1:42pm UTC](https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572/1 "2020-05-01T13:42:24Z")

</div>

Hello,

I would like to use binary inputs at the Sensor module ([Sensor Module - HARDWARIO Shop](https://shop.hardwario.com/sensor-module/)) for monitoring devices such as water meters, electricity meters, or 🌧 rain gauge at a weather station.

Could you please give a hint or publish any successful project using a sensor module for water or electricity metering (analog binary input)?

Thanks!

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [May 4, 2020, 4:05pm UTC](https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572/2 "2020-05-04T16:05:02Z")

</div>

Hi,  
you can use pulse counter firmware. On channel A it is counting pulses and sending value every few minutes. Channel B acts differently - as a normal button AFAIK.

> **[bigclownlabs/bcf-radio-pulse-counter](https://github.com/bigclownlabs/bcf-radio-pulse-counter)**
>
> Contribute to bigclownlabs/bcf-radio-pulse-counter development by creating an account on GitHub.

This firmware is already in the Playground.

I used and tested this firmware few days ago to test my new utility meter and works fine. You can extend the code so all three channels A, B and C (check the solder jumper in dev docs) could count pulses from any contact/S0 utility meter.

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [May 25, 2020, 12:24pm UTC](https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572/3 "2020-05-25T12:24:07Z")

</div>

Hello to Hostětín 🙂  
we have some tips in this Twitter thread so you can follow some ideas.

> <https://twitter.com/hubmartin/status/1264211599239327750>

---

<div class="post-metadata">

**Author:** ![glomerata](https://forum.hardwario.com/user_avatar/forum.hardwario.com/glomerata/32/464_2.png) [@glomerata](https://forum.hardwario.com/u/glomerata)\
**Post date:** [August 3, 2021, 6:23am UTC](https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572/4 "2021-08-03T06:23:07Z")

</div>

Hi,  
I followed instructions described at [https://www.hackster.io/jakub-smejkal/hardwario-pulse-counter-15ce72](https://www.hackster.io/jakub-smejkal/hardwario-pulse-counter-15ce72)  
This step-by-step manual help me to set the kit, but I would appreciate more detailed information about:

- how to connect cables from sensor (in my case from water meter) to Sensor module?  
It is written to connect in A and B channels of the module, but there is also a wire connected in the GND slot.  
Thus, can I ask you to draw a wiring diagram?
- what are differences between pulse on channel A and channel B?  
What are the appropriate time periods of wire connection to register a pulse?  
How to publish a pulse imediatelly - same as push button behavior - and not to wait for REPORT\_INTERVAL?  
see [https://github.com/hardwario/twr-radio-pulse-counter/blob/master/src/application.c](https://github.com/hardwario/twr-radio-pulse-counter/blob/master/src/application.c)
- is there any limit for maximum count of pulses registered within a one second?

Thanx for an advice!

---

<div class="post-metadata">

**Author:** ![smejkalJakub](https://forum.hardwario.com/user_avatar/forum.hardwario.com/smejkaljakub/32/643_2.png) [@smejkalJakub](https://forum.hardwario.com/u/smejkalJakub)\
**Post date:** [August 6, 2021, 10:47am UTC](https://forum.hardwario.com/t/using-binary-inputs-for-water-or-electricity-metering/572/5 "2021-08-06T10:47:08Z")

</div>

Hi,

In this project and firmware, there are two things connected to the Sensor module. To the channel B there is a button connected, in this case a magnetic sensor, against the ground.  
To channel A, there is a counter connected.  
The firmware gets the values from the pulse counter(channel A) and sends them over the radio with a topic /pulse-counter/a/count.  
The button on channel B is detected and send over in case of an event.

You can send pulse in the body of condition if(event == TWR\_PULSE\_COUNTER\_EVENT\_UPDATE) on line 94 in the firmware, just put twr\_scheduler\_plan\_now(0) there. But we do not advise this because in the case of for example electricity meter with 1kwh you would get like 10000 messages(pulses), for these reasons we put the REPORT\_INTERVAL there. You can probably find number of pulses, kwh, or cubic meters on the device.

There is a limit in sending over the radio. Pulses should be detected without a problem.

Hope this helps.
