Counting pulses from a Steca TA VM2 water meter?

This is just a general request for any bookmarks or links to good resources for reading a water meter of this type (below) with the electric imp. I’m using google site search against “https://discourse.electricimp.com/” and have found a few items, but not entirely relevant to this meter, I think?

If anyone has a moment, and it is easy for you, can you send any links to good examples of hardware and code for Imp pulse counting which is relevant to a water meter of this type? I am in uncharted territory with pulse output, but have been successful using the electric imp for temperature monitoring and relay control…

https://electricimp.com/docs/api/hardware/sampler/

This function can count pulses for you.

Hi @solarishot! Glad to see you back. Just thawed out? Approaches here are numerous.

I’m assuming the flow isn’t going to be ridiculously high–occasional pulses-- due to the type of systems you’re working on. I’d have the meter connected to an input which would be declared a DIGITAL_IN with a callback function. The callback function would basically be responsible for adding 10 to a global total flow variable. You’d also want to save this value in non-volatile memory in case the device restarts (fundamentally, when the function runs, it would load the value from memory, increment it by 10 and then save it to memory).

You’d then want a couple of other functions: one to reset (and save) the global variable on demand, one to read the global variable and one to read and reset the global variable–the last one being the most often called. It would be important to always save the value of the global variable.

You have several options to read the value: on demand from the agent, on a period within the device and push it to the agent, or when it reaches a value (perhaps 100) after being incremented. It rather depends upon what you’re doing with the value.

Does this help or did I miss a complication?

…also, tie one leg of the switch to 3.3 and the other to the input port which should also be tied to ground through a resistor – 10K would work fine.

By the way, on the callback, I believe you’d want to check the value of the input and only increment when it’s high. The callback function will be called both on the transition from low to high as well as high to low and you don’t want to get double counts.

Solarishot … see my messages in your notification box.

The meter you show gives 1 pulse every 10 liters. For normal household use, that would not be good enough resolution. That’s a lot of water passing before you get a pulse. For me in the U.S., that’s 1 pulse every 2.6 gallons. To get a more accurate measurement for household use, you need a meter that gives 1 pulse every 1/2 liter.

Example of using meter that outputs 1 pulse every 1/2 liter …
If you ran your kitchen sink, and you read the imp pulse count every 10 seconds, you might be seeing 4 pulses. For me, that is .5 gallons of water every 10 seconds. So the imp counts the pulses for 10 seconds, then outputs (pulses * 6 = liters per minute). It then zeroes the count and starts over. Every 10 seconds you’ll get a real-time reading as your water is flowing.

A 2nd counter is totalizing the water for you, giving a total usage for whatever timeframe you wish to use (how much water per month?).

@MikeyDK, thank you!

@hvacspei, thank you too. I have not yet selected a final meter, but I know your help in focusing my code strategy will be immense.

@mlseim, that helps very much. Thank you. I was thinking I would need to take baseline good water flow readings, then write alarms based on excess over time (with the Steca 10L/pulse meter). But with your point about meter resolution, it seems all of that is simplified now. A low steady flow of any amount should be enough to warn of parasitic water flow (waste).

Seems like the key to this project of interfacing an Imp to a whole-house water meter is making sure meter pulse resolution is high. The municipality tells you when you have a leak, but every few months. And they give you a bill, too. More pulses obviously offers a chance to catch leaks or high water use faster. Thanks again.

10 liters is a lot of water. 19.9 liters would be one pulse, just short of the 2nd pulse. That’s 5 gallons of water that just passed through before I see the 2nd pulse.