Fail Of The Week: Magnetic Flow Measurement Gone Wrong

Physics gives us the basic tools needed to understand the universe, but turning theory into something useful is how engineers make their living. Pushing on that boundary is the subject of this week’s Fail of the Week, wherein we follow the travails of making a working magnetic flowmeter (YouTube, embedded below).

Theory suggests that measuring fluid flow should be simple. After all, sticking a magnetic paddle wheel into a fluid stream and counting pulses with a reed switch or Hall sensor is pretty straightforward, right? In this case, though, [Grady] of Practical Engineering starts out with a much more complicated flow measurement modality – electromagnetic detection. He does a great job of explaining Faraday’s Law of Induction and how a fluid can be the conductor that moves through a magnetic field and has a measurable current induced in it. The current should be proportional to the velocity of the fluid, so it should be a snap to whip up a homebrew magnetic flowmeter, right? Nope – despite valiant effort, [Grady] was never able to get a usable signal out of the noise in his system. 

The theory is sound, his test rig looks workable, and he’s got some pretty decent instrumentation. So where did [Grady] go wrong? Could he clean up the signal with a better instrumentation amp? What would happen if he changed the process fluid to something more conductive, like salt water? By his own admission, electrical engineering is not his strong suit – he’s a civil engineer by trade. Think you can clean up that signal? Let us know in the comments section. 


2013-09-05-Hackaday-Fail-tips-tileFail of the Week is a Hackaday column which celebrates failure as a learning tool. Help keep the fun rolling by writing about your own failures and sending us a link to the story — or sending in links to fail write ups you find in your Internet travels.

42 thoughts on “Fail Of The Week: Magnetic Flow Measurement Gone Wrong

  1. You can modulate the signal with an AC frequency and use a lock-in amplifier.
    http://www.analog.com/library/analogdialogue/archives/48-11/lock_in_amplifier.html

    Wiki page on lock-in amplifier is a bit weak.
    >A lock-in amplifier is a type of amplifier that can extract a signal with a known carrier wave from an extremely noisy environment. Depending on the dynamic reserve of the instrument, signals up to 1 million times smaller than noise components, potentially fairly close by in frequency, can still be reliably detected.

  2. Change in current induces change in magnetic field. During steady state flow, he should be measuring nothing from those coils. Stop and start the flow, he should see it twitch.

    1. Well derp, now I know he’s measuring across the electrodes I didn’t spot 1st time. Thought he was expecting magnetic induction into coils.

      Anyhoooooo, if where he stood in the room affected it, then yeah, capacitance and hooman antenna in effect.

  3. I think one problem is the hysteresis of the coil. You aren’t going to get your square wave magnetic field. I also think it would be good to have a synchronized AC bias voltage on the electrode to prevent the electro-chemical reaction you referred to in your excellent video.
    I think you would have better luck with an ultrasonic transducer and measure the Doppler shift.

  4. I don’t think that you will get a moving or varying magnetic field by inducing current flow in a moving liquid. In order to sense the magnetic field inductively, the field has to be changing. I think that inducing the field will result in a stationary field, even as the liquid moves. If you added some bubbles of known size, you might be able to infer the flow rate from the fluctuation periods, but you would have to know the size or the spacing of the bubbles.

    1. Mate, I’m sorry to tell you this but… it does work. However, it is normally used only for highly conductive fluids. And water is a no-no for this method. Even salt water is not likely to work.

      1. 0.9% equivalent saline (i.e., blood) works great. It has worked great in this application for more than a half century, on everything from 20mm aortas to <4mm arteries, including coronaries. Yes, we used to mount these directly on a beating heart.

      2. I made the same incorrect assumption that RW did, I assumed the project was trying to sense the flow inductively in addition to driving it inductively. It makes a little more sense this way.

      3. Mag meter are (and have been for a few decades) the preferred method for measuring aqueous flow in pretty much any application demanding long-term accuracy and durability. Minimum conductivity spec for most commercial devices is around 20 uS, which covers potable water and beyond. You’ll only run into issues with the really pure stuff: condensate, WFI, semicon water, etc.

      4. Commercial magmeters have no trouble measuring *tap* water.

        Salt water is an order of magnitude more conductive than necessary to measure with a commercial magmeter.

        As long as you’re not trying to measure DI water, it’s not an issue.

    2. The water flowing through is the same as a wire passing through. It doesn’t matter if it is the magnet moving, or the field changing, or the conductor moving. All that matters is relative motion.

      This is not sensing inductively. The coils are used only in place of static magnets in order to switch the magnetic field direction, similar to how a chopping amplifier works.

  5. Electromagnetic flowmeters have been used for measuring blood flow in arteries for decades. They were considered the gold standard in the 1960s, and were used to validate the then-new Doppler ultrasound flowmeter. We were still using electromagnetic flowmeter cuffs in-vivo well into the nineties. They were especially good for chronic continuous monitoring (over several days), though noise through electrode contamination would eventually cause them to quit.

    Properly sized, cleaned, and installed, they yielded excellent signal-to-noise ratio. Their biggest advantage was that you didn’t have to cut open the artery of interest to measure the flow within it. Folks at the time considered that to be a good thing.

    The coils were driven quite hard: the devices got disturbingly warm for something you implant within a body, even if they were liquid-cooled :-)

  6. From “Flowmeters” by Alan Hayward. It’s rather old (1979), but the text suggests this is *really* hard to make and keep working properly. I’m sure easier now that one can fling large amounts of electronics at the problem.

    “The main difficulties are as follow:

    (a) At practical flow velocities the value of the induced voltage is very small and hence difficult to measure accurately, especially if “stray” voltages are not completely eliminated.

    (b) Main voltage and frequency are never completely stable and unless the circuit is designed to compensate for these input fluctuations they will give rise to spurious output fluctuations.

    (c) Ordinary direct current cannot be used to power the electromagnets without causing polarization of the electrodes, but if ordinary alternating current is used, this causes a kind of transformer effect which generates troublesome out-of-phase voltages.

    (d) it is difficult to obtain a completely stable electrical zero, in other words ‘zero drift’ can be a serious problem.”

    Bubbles cause erroneous readings and must be avoided. At a minimum this will require a good instrumentation amp. I don’t have the bandwidth for YouTube, so I don’t know exactly what he’s doing. But the points made by Hayward are all rather thorny problems.

    Interesting project though and I’m sure quite educational even if a failure.

  7. Okay, now I understand what he’s trying to do. The writeup doesn’t really explain a lot.

    He’s making a magnetohydrodynamic sensor. He’s putting a magnetic field across the flow, and measuring the voltage perpendicular to the flow and perpendicular to the magnetic field.

    At a guess, from looking at his video, he’s not generating strong magnetic fields. He thinks that more turns makes for more magnetic field. In reality, more turns tends to lead magnetic field.

    Magnetic field *quantity* is proportional to the turns times the amperage through the coil. Adding more turns and keeping the current constant will make more field, but there’s a catch: adding more turns increases the inductance as well, so to keep the current constant you have to bring the voltage up as well. Inductance goes by the square of the turns, so inductance goes up faster than the field is multiplied by the turns.

    His coils have a lot of turns, and at a guess the inductance is so high at the frequency he’s using that there’s very little current and thus very little magnetic field.

    He should reduce the number of turns and push more current through the coil.

    The actual magnetic field may be calculated by the magnetic version of Ohms Law: MMF = Psi x R, where:

    “MMF” is the magneto motive force and is amperes times turns
    Psi is the generated field in Webers
    R is the reluctance of the material. Reluctance is the inverse (ie – 1 over) of permeability, so if you can’t find the reluctance of water you can use the permeability.

    (Permeability is usually relative to vacuum, so if you find the relative permeability of water you need to multiply by the absolute permeability of vacuum to get absolute permeability of water.)

    Once you have the total field, the field strength is field/area, so take the field in Webers and divide by the cross section in square meters of the pipe to get Teslas.

    And once you have the magnetic field, you can use Faraday’s equations to estimate the amount of voltage will be generated:

    http://hyperphysics.phy-astr.gsu.edu/hbase/magnetic/genwir2.html

  8. Some years ago I was involved in the design of a couple of these systems. One was a high featured commercial Mag Flow meter for factories (M300) and the other a “cut down” version for irrigation monitoring (Irriflow). They do work very well indeed but there are quite a few gotchas. A high frequency AC signal can be applied to the electrodes to clean them for one thing.
    The coils are excited by DC, not an AC signal.
    We used a MAX132 18bit plus sign A/D converter with extra calibrating circuitry. Also good instrumentation amps. These meters proved to have a 10x dynamic range as compared to our customer’s original mechanical standard meters so they were very impressed. To date many thousands of these have been produced. There is a document explaining various flow meters here that can make good reading.
    irrigation.org.au/documents/publications…/Know_The_Flow_Training_Manual.pdf
    The ones I was involved in, designing the hardware and laying out the PCBs are now sold under the Tyco EMFLUX branding as the original company that was our customer was absorbed by “Take Your Company Over” ;) My boss at the time put the magic software into them.
    The Irriflows replaced paddle wheel mechanical meters in the irrigation channels. These wheels often had problems like fish getting stuck in them so the farmers got free water. Sometimes the fish were still frozen, and even salt water species. Very “strange”! Talking to a water bailiff, he had even come across a wheel that had mysteriously had an inch cut off all the fins so free water could flow!
    If a farmer could get to the magflow sensor and put an object in it, the result would be an increases water velocity and extra charge for less water so these sorts of blockages are a thing of the past. The magflow sensors are usually in a lowered part of the pipe so they stay full of water at all times. Even so, there is usually a Pipe Full detection sensor built in.

  9. Use the Analog Devices AD630 as a lock in amplifier (see page 18 of its data sheet). From the specks, I would recommend a frequency of less than 100Hz, and drive your coil with a sine wave. An inexpensive way to drive the coil is with a step down transformer to your line voltage (50-60 Hz). A sample of the drive voltage and the output from your electrodes are then fed to the AD630, and it’s output is a DC voltage proportional to the signal you want. You can see signals buried in lots of noise using the AD630. Good luck and post your results, please.

  10. Quoted from the video, at 8:44:

    “After some feedback on the EEVblog forums, and some additional reading, I think fixing the demo would require a full redesign. And I figured you guys would rather me move on to something new, rather than keep spinning my wheels on this one.”

    I get the impression [Grady]’s real objective was to produce an entertaining and somewhat informative video, just one in a series, that makes him money from Patreon and sponsorships – so long as he keeps producing them with regularity. Well, he has his video, so his objective is complete. I have no doubt he could improve on the flow meter, even with a minimal investment of time; but unless he can milk another complete video out of it, that won’t happen. Because the flow meter itself was never his objective.

    Personally, I don’t consider that to be in the spirit of the Fail of The Week.

      1. More mature by more than a century: Michael Faraday himself tried it in 1832.
        Doppler ultrasound wasn’t available until after WWII, and not commonly used until the 60s.

  11. Not a fail at all, the work just isn’t finished. Certainly doesn’t require a redesign.
    1-Filter! The bandwidth of the flow signal is probably less than 10Hz (how much does the flowrate change in 1 second). Add a low pass filter to remove the unwanted out of band signals. A lock-in amp does this by mixing the signal down to DC. Adding a low pass filter after the lock in amp (also called a synchronous demodulator) then limits the bandwidth to the cut-off frequency.

    But what the heck – why the extra complication of a lock in amp. He has an Arduino and is making a switched DC flowmeter (yes it’s a DC flowmeter for the time that the current in the coil is fixed. Reversing the current then gets him another DC flowmeter with reversed polarity). Trick is to keep the coil current constant as long as reasonable but measure many times during that stage and average the readings. Averaging can be using a low pass filter but only start measuring after 5 time constants of the LPF. In fact, to reduce high frequency noise he should have a LPF before the first differential amp anyway just to clean up the noise else he’ll be amplifying everything from RF noise to electric motor emissions.

    Shielded Pickups
    —> RF/EMC filter
    —>Inst/Diff amp, Zin>10^7 ohms
    —>low pass filter FcGain amp
    —>ADC Sample many times, average result

    No real need to have the step at 0 current in the coils – except perhaps for a diagnostic or to measure the electrochemical voltage. Measure at + then at – current, subtract to get the difference which is caused by flow only.

    2-Impedance. The voltage generated by a conductor moving through a magnetic field is independent of water impedance, until you add a load – the front end amplifier. If the sensor pickup is low impedance he will loose some signal if the water / liquid is pure and not very conductive. Ensure the pickup amp impedance >> sensor impedance. From Analog devices,”the sensor output resistance varies from a few tens of ohms to 10^7 Ω”. Oscilloscope probes may be too low.

    3-Increase magnetic flux. Increase the current OR number of turns OR add a magnetic yoke. A C core was mentioned in the youtube comments. The yoke is probably the best if the first 2 have already been optimised. Ideally a laminated iron yoke but if the frequencies are low and he’s not too worried about eddy current losses he can use solid iron. Again, since this is really a DC flowmeter (measure when the current is at a constant value) he will want the switching frequency to be high enough to reject electrochemical changes in voltage which will possible be low enough to ignore core losses in a solid core

    4-Reject noise. Shielding IS required for the small signals and high impedance pickup. Magnetic shielding too. Use shielded cables on both pickups. Magflow signals, before amplification, are very low, – a few microvolts! Over the air radio signals can be stronger, wifi is 10uV for a weak signal.

    5-Know your system. Particles in the liquid that impact the pickups, bubbles, vibration, partially filled pipes, mixed media… all inject noise. Bends change flow velocity profile through the pipe between the pickups… he may have to add more engineering features to compensate for these

    http://web.ornl.gov/info/reports/1960/3445603511689.pdf
    http://www.analog.com/library/analogdialogue/archives/48-02/flow_meter.html

    1. Klave,
      Thanks for that long dose of sanity in this nutty comment thread.
      One point though: Though I wholeheartedly agree that the lock-in amp functionality could be replaced by an Arduino’s ADC and some fairly straightforward processing, in practice this makes a crappy lock-in amp because it’s subject to the quantization noise of the ADC, plus other noise sources. Good enough for demo purposes, and maybe even good enough for an application like this, but nothing like the performance of a real lock-in amp. A ‘real’ LIA (like the ADA2200 mentioned above or, even better, discrete solutions from places like SRS) does the front-end processing in the analog domain, and gets much better performance.

      1. And of course I post on old data before double checking. I stand corrected: newer high-performance LIAs/PSDs *do* operate digitally. E.g. SRS units use a 16-bit ADC at 256 kHz.

    2. It is good to see a few pros commenting here. Everything I came here to say and more, and better than I could have written it. Well done.

      I was very surprised when in the video he said that the noise he saw would complicate things. It is all high frequency noise, the signal was not bouncing up and down. The centerline seemed pretty solid. And as you pointed out, how fast is the waterflow going to change?

      As far as a lock-in amp goes, we’re generating the signal, so we have the original. No worries about not being able to detect and sync to the AC signal as if we were picking up a long distance radio signal.

      Impedance – many people remember the whole “load impedance matches source impedance for maximum power transfer” and apply it too broadly. That is as bad as “current follows the path of least resistance” in misunderstood oversimplifications.

      Magnetic flux – I was thinking of maybe a couple of cores from old TV flyback transformers. Basically two C cores with the open ends together and the pipe in between. Of course, if the pipe is much wider than the ends of the ferrite, signal is lost to eddy currents in the water.

      Shielding – what seems to have been missed in the video is shielding the sense wires from the electric fields of the cores themselves. Such is the nature of breadboarding.

      Particulates and bubbles – if you desire a very high resistance to disturbance from these things, I can imagine some kind of bubble catchment. A sort of low velocity air hammer preventer vertical pipe. Filtering would catch particulates.

  12. there ar 2 points u have to meet as minimum to get it work the fluid has to have a minimum of 0.5µS per cm. The second is Minimum flow speed is 0.5 m/s. Another point is the proper material for the electrodes, maybe you try other ones, like graphite.

  13. some grounding in your pipe (at least before your flow meter) will help a lot du to electric static friction noise will be created in the plastic pipes.
    Make sure that no air is trapped in your fluid (air bubles have a very bad conductivity)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.