Monitoring Residential Water Usage by Reading Municipal Water Meter With Hall Effect Sensor + Arduino

Gregory0 'profile picture'
121K12434

Intro: Monitoring Residential Water Usage by Reading Municipal Water Meter With Hall Effect Sensor + Arduino

If you'd like to monitor your water usage, as part of a DIY smart home automation and monitoring project, then this instructable might help you to achieve that goal. The solution described here is non-invasive, uses your existing municipal water meter, and the total project cost can be kept under $5-10.

First, let's take a look at what is going on inside a typical residential water meter. The most common water meter type that is installed by local municipalities is a positive displacement water meter. This type of water meter design usually incorporates a wheel, as part of the internal mechanism, with one or more magnets attached to the wheel. When water is flowing through the meter, this wheel spins, driving the register. The register is the part that sits on top of the water meter, analog or digital, that shows you how many gallons of water you have used.

This magnetic drive between the water meter and the register is used in virtually all residential water meters. So to measure water flow, you just need to monitor whether this wheel is spinning, and how fast. Since the wheel has magnets attached to it, the magnetic field from the magnets will almost certainly be detectable from the outside of the water meter enclosure.  To test this, hold a compass next to the water meter. Hold it close to where the meter and the register join, this is where the magnetic field will be strongest. If the compass needle fluctuates when the water is flowing, then there is a very good chance that you will be able to monitor those fluctuations.

STEP 1: Un-amplified and Un-filtered Hall Effect Sensor Output

To monitor magnetic field fluctuations you will need a Hall effect sensor. In my experiments I have used a Honeywell SS494B Hall effect sensor, which is available online for $3-$4. Other sensors should work also, just pick an analog model, not latching, with comparable or better sensitivity. The Honeywell SS494B promises to be sensitive enough to provide around 5mV per 1 gauss.  For a frame of reference,  the earth's natural magnetic field measures around 0.5 gauss, a refrigerator magnet is about 50 gauss, and a neodymium magnet is in the 1000's of gauss.

The Honeywell SS494B is a very sensitive Hall effect sensor, as far as low cost hall effect sensors go, but its measuring range still reaches over 400 gauss. Depending on the construction of your water meter enclosure, if it's made of  metal or plastic, the magnetic field strength outside the meter can be as low as 1 gauss or less. This presents a challenge, since 1 gauss or less is at the extreme low end of the Hall effect sensor's measuring range.

But before tackling the challenge of measuring very small magnetic fields, let's take a look at how the Honeywell SS494B Hall effect sensor works. The sensor has 3 pins: power (Vcc), ground, and output. If you were to look at the output from this Honewell Hall effect sensor, simply powered from a +5v source, you would see that the output sits at around +2.5v, or roughly half of Vcc. This is called the quiescent output voltage, or in other words, this is the voltage the Hall effect sensor will output when no magnetic field is present. But if you hold a magnet in front of the sensor, the magnetic field will pull the output voltage either towards ground(0V) or Vcc(5v), depending on the polarity of the magnetic field.

The tricky part comes next. If you were to measure field strengths of 1 gauss or less, the Honeywell SS494B will deviate no more than ~5mV from the quiescent output voltage. So, to use an Arduino to measure such tiny voltage fluctuations, and with good resolution,  amplification will be required.

To amplify the signal coming from the Hall effect sensor, a general purpose operational amplifier like the LM324 will work just fine. In my experiments I have used a widely available and cheap (less than $0.25) LM324 op-amp, and the schematic in the next step is based on the LM324 op-amp.

STEP 2: Amplification + Filtering Circuit Schematic

This is a fairly simple schematic of the amplifier and filter. At the core of the circuit is a 4 channel LM324 op-amp running in an ac-coupled inverting configuration. Capacitor C1 removes the DC quiescent output voltage from the Hall effect sensor, feeding only the tiny sine wave output from the sensor into the op-amp. Resistors R1 and R3 set the amplification, in this case roughly 1000x, so a fluctuation of 2-3mV would become 2-3V on the output (pin 1). With an amplification of 1000x, there is bound to be some noise, so a second channel of the LM324 op-amp will be turned into a Schmitt trigger.

The oscilloscope screen shot shows exactly how the signal looks when water is flowing through the water meter. Channel 1 (yellow) shows the amplified sine wave coming out of op-amp (pin 1). Channel 2 (blue) shows the output from the Schmitt trigger (pin 7).

Depending on how strong the magnetic field is in your water meter, amplification might need to be adjusted (resistor R1), and/or the DC offset (resistor R2). An oscilloscope is the right tool to do this adjustment, but it can be done with a decent multimeter.

STEP 3: Logging Amplified Hall Effect Sensor Output With an Arduino

There are many ways to digitize the output from the op-amp, but the easiest is to simply connect the output from the op-amp to one of the Arduino's digital input pins. The pin will switch state from HIGH to LOW, or from LOW to HIGH, when the op-amp's output voltage passes the ~2.5V mark. Each magnet pass will initiate a state change, so to calculate water flow, you'll just need to figure out* how many passes the magnet makes for each 1 gallon of water flowing through the meter.

At this point, a gallon per minute (GPM) water flow rate can be calculated by simply counting the state changes on the digital pin in any 1 minute time period.

If you are using an Aduino to log the output of the sensor, just use digital pin 2 or 3 (on most Arduino boards), and attach an interrupt to it as such:

------------------------------------------------------------------------------------

int magnetPasses = 0;

void setup(void) {
  attachInterrupt( 0, magnetPass, FALLING ); // attach interrupt to external trigger on digital pin 2
  timer.setInterval( 60000, printWaterTotal ); // call function 'printWaterTotal' every 60 seconds
}

void magnetPass() {
  magnetPasses++; // increase by 1
}

void printWaterTotal() {
  Serial.print( "Magnet passes " );
  Serial.println( magnetPasses );
  magnetPasses = 0; // reset counter
}

------------------------------------------------------------------------------------

*For example, a popular Neptune T-10 residential water meter will show 120 magnet passes for every 1 gallons of water flow. This is roughly 1 magnet pass for every 1oz of water flow, so even very small water leaks can be easily detected using this method.

STEP 4: Miscellaneous Tips & Tricks

Tip #1: To make the Hall effect sensor package sturdy, use small diameter heat shrink tubing around each of the 3 wires soldered to the Hall effect sensor, then a larger diameter shrink tube around the 3 wires. Do not put shrink wrap on the sensor itself, as you want the sensor to be as close to the register as possible.

Tip #2: Electrical tape can be used to affix the Hall effect sensor to the register. Make sure the Hall effect sensor "front" is facing the register. Hall effect sensors have a "front" and "back", and the "front" should be facing the source of the magnetic field you are trying to measure.

26 Comments

I tried constructing the circuit as shown in your schematic. The output of the first op amp was very unstable and kept hitting either supply rail, even with no magnet anywhere near the sensor. Adjusting the bias pot didn’t really help and any drift would upset the bias. I suspected leakage current through my input capacitor was upsetting the input and adding a small random DC bias which was then amplified 1000 times.

I tried many different electrolytic capacitors and all suffered the same problem, which is not surprising as they are not really intended or suitable for use in low frequency AC signal coupling, as opposed to power supply decoupling.

Only one 47uF non polarised capacitor seemed to work reliably. I don’t have a 470uF non polar capacitor so my input cut off frequency would be ten times higher than in your design.

As you will know, the capacitor and 1K resistor form a high pass C-R filter with low cut off frequency f = 1 / (2 * pi * R * C).

So 470 uF with 1K gives a design frequency of 0.34 Hz which seems about right.

47 uF gives a frequency of 3.4 Hz which may be too high to detect small volume water flow.

Using a non electrolytic capacitor of say 1uF value makes the cut-off frequency even higher at 157 Hz which is not going to work.

The inverting amp configuration in your design requires a very large input coupling capacitor to get a low cut off frequency. You could increase the input resistor but the feedback resistor would have to be increased by the same multiple. For example a 100K input resistor would allow a coupling capacitor or 4.7 uF to be used (expensive but available as a polyester layer non electrolytic capacitor). But that would require a 100M feedback resistor or addition of a second stage amplifier. Using such high value resistors may not even work (the currents would be tiny) and the signal might be swamped with thermal noise.

It therefore occurred to me that a better arrangement might be to use the op amp in a non-inverting configuration. If resistors are used to set the input impedance on the + input to say 470K (which is quite feasible), then the input coupling capacitor would only need to be 1 uF to achieve the same 0.34 Hz cut off frequency.

The instructions and schematics are a bit over my head so I bought a sensor module from eBay. But it appears the sensor is not strong enough to read my water meter. It's range is 7mm to 10mm depending on the magnet strength. I tested it with a strong magnet and appears to slightly exceed the 10mm claim even.

Is it possible to boost the signal from the sensor?

The module in question is here:

http://m.ebay.com/itm?itemId=230955026196

Water meter is a Sensus SR-II/SR-A

If the module you bought is the one pictured below then I had the same thought. I ordered it from Amazon, assuming it would have an amplifier on board, and tested it with an oscilloscope. Not only is the analog output unamplified (so it will be impossible to measure the field from a water meter), but the comparator has no hysteresis - so when it is triggered, the output oscillates wildly. See the photo of oscilloscope display - the blue trace is the analog out and the red is the digital out (from the comparator).

As such, even if the module were sensitive enough to use, the comparator would count hundreds or thousands of false rotations owing to the oscillation, each time it was triggered. I therefore returned the item as it adds no value at all.

By luck, I managed to find the schematic for the module on another website (I'm fairly sure it is correct or very close), and you can see that the comparator has no hysteresis.

There is no point therefore in using the module as it adds nothing in this context. The analog output is pretty much raw and taken directly from the hall effect sensor. You would be far better buying just the sensor (it cost me a few pounds in the UK on a well known auction site) and copying a decent op amp-based amplifier design, adding your own comparator with hysteresis if you wish. It's a bit of a learning curve, but one worth following. I hope that helps anyone reading this, even if it's six years too late for fstr.

As a meter seller, a couple FYI's. First, the drive magnets in meters vary in size by brand, and some brands are very small and may not be detectable outside the register shroud (Master Meter is very small). Second, some manufactures use 2 pole magnets and some use 4 pole magnets to better follow each other as shown below and reduce "magnetic separation" where they don't stay in sync. If you don't test, you might double or halve your output.

Agree the Master Meter magnet must be very small. Can't detect with my hall sensor set up as described in this article, though my hall setup is nearly as sensitive as a compass needle. But they do have ultra sensitive hall sensors for Master Meter, I have seen a commercially sold type that fits around the meter. What I did was use an IR distance sensor stuck to the top of the meter glass; the usage star is reflective enough to be detected.
How far can the hall sensor be located from the circuit and how far can the circuit be from an arduino?
Hello, this is my first non-packaged project and I'm not sure what capacitors I need. When I search for "470uF" (or "4700pF") on digikey.com or mouser.com, I get a ton of results and am not sure where to start.

Any help or pointers would be greatly appreciated.

May I suggest a few circuit changes that should eliminate the need for the pot and use fewer parts?

I hope you can see the full image.

I'm interested in making this same sort of setup for my water meter and gas meter. I was curious about R2, R4, and R5. Why a 20K potentiometer for R2, but a simple 10K/10K voltage divider for R4 and R5?

is it possible to get a diagram that a noob like myself can follow. Unfortunately my concentration will not let me learn to well so I try following diagrams. The one that is posted here is most likely very simple but ya.....

I've built this circuit and followed the correct pin diagram, but something doesn't seem right. When I try to power it up, the LED on my 5V power source blinks (it should remain solid). Any thoughts of where I might be going wrong. I've checked the diagram against my wiring 3 times now and everything seems to be wired correctly. Any advice?

When did you come up with the idea?

Your schematic shows the lm324 with ground to pin 4 and +5 to pin 8. However, the pinout of my lm324 shows pin 4 as vcc and pin 11 as ground (pin 8 is output for internal amp 3). Seeing as I have no idea how an op amp works, why the difference? Thanks!!

Different manufacturers can have different pinouts for their products. Lesson learned: Always compare the schematic to the spec sheet of the IC chip used to make sure pinouts are correctly used! The Texas Instruments LM324AN had the same pins as you described, not as listed above. Spec Sheet for the one I obtained and used here:

http://www.ti.com/lit/ds/symlink/lm124-n.pdf

Can you explain the difference between the circuit diagram you uploaded a few days ago and the one that was up here originally? I don't think the text description matches the new diagram, so it's a bit confusing.

I've updated the amplification circuit to a much better design. Let me know if the description is clear enough. I'll add some more details in the near future.

You've completely missed concentrating the field with pole pieces. You can get 100X more signal that way.

Can you explain this a little more?

Imagine the shape of the field around the magnet inside the meter, it flows from the north to the south pole of the magnet. Your job is to intercept and concentrate that field, which is probably oriented towards the meter on the front, and not out to the side

Putting a piece of transformer iron on the back of the sensor, and iron concentrates the field from the magnet. A lot of experimenting is needed for the best result though - maybe putting the magnet, and "pole piece" on the FRONT of the meter would help too.

More Comments