From metering the dose of a medicine and an IV to measuring the flow of irrigation water on a farm to tracking your fuel, flow meters play a role in nearly every area of our lives. In fact, there’s probably a meter outside your home counting your water usage for your monthly utility bill. There are a whole host of ways we can measure flow. But today I want to talk about a method I think is particularly fascinating. The magnetic flow meter will walk through some of the electrical engineering behind this ingenious device and try to overcome the challenges that arise when the real world doesn’t quite match the theory. But the theory comes first. So we’ll start at the beginning. A magnetic flow meter relies on Faraday’s law of induction, which basically says this. Moving a conductor through a magnetic field will generate an electromagnetic force which is proportional to the velocity.
Let’s break that down just a bit with an example. I’ve got a magnet and a conductor, in this case, a coil of wire. The conductor is connected to a new toy in the shop, an oscilloscope which is an instrument for measuring changing voltage and displaying it on a screen. For example, here’s a typical AC sine wave similar to what you measure at a wall outlet. If I keep the conductor still within the magnetic field, nothing happens. But as soon as I move the magnet, we see a spike in voltage. This is the electro mode of force, or EMF. In Faraday’s law. The faster the coil passes through the magnetic field, the higher the voltage spikes, demonstrating that the IMF is proportional to the velocity. A magnetic flow meter works exactly the same way, except instead of wire, the conductor is a fluid in a pipe. Magnets outside the pipe create a magnetic field, electrodes are located perpendicular to the magnets, a conductive fluid moving through the pipe will generate a voltage between the electrodes due to Faraday’s law. The faster the fluid moves through the pipe, the higher the voltage. Once you know the velocity of the fluid, you can calculate flow using the cross-sectional area of the pipe. It seems pretty straightforward, but let’s see if it really works. Here’s the test setup. I’ve got a length of PVC pipe with a pump on one side, I can control the flow of water using this valve to stainless steel bolts serve as electrodes to measure the IMF and to create the magnetic field. I’m starting with two permanent neodymium magnets. I’m measuring the EMF using a differential amplifier to boost the signal into my oscilloscope. Watch what happens when I start to let the water flow through the pipe. The voltage jumps. We’re definitely getting an electrical response to the flowing water, but you can see that we have a fairly noisy signal. It would be a major challenge to try and convert this signal into a flow reading. The problem is electrical noise and there are a few potential sources of noise here. First, depending on the fluid chemistry and the type of metal used for the electrodes and electrolytic reaction between the liquid and the electrode can generate an electric potential. Second, string voltages can sometimes exist within the fluid from other equipment along the pipe, like the pump. Finally, the liquid in the meter can have some capacitance to a very limited extent. It can actually charge up like a battery, which can create noise in the voltage signal between the electrodes. The problem is there’s no way to know what part of the signal is due to the flow and what part is just noise. And the noise can be significantly bigger than the part of the signal. We actually care about an electrical engineering. We would say that the signal to noise ratio is high. In other words, the theory behind the magnetic flow meter is sound, but the real world is getting in the way of things. This is where the physicists throw up their hands and the electrical engineer step in. And the electrical engineers have found that one way to avoid the issues mentioned above is to change the magnetic field over time. Here’s how it works. This is a graph of a magnetic field which varies in strength as a series of biphasic DC pulses biphasic because it has negative and positive pulses and DC because unlike a typical AC sine wave, which is constantly changing, the waveform only has two values on or off above as an example of the resulting EMF from a magnetic flow meter.
Remember, we only care about the portion of the IMF generated by the magnetic field. Since this is the only part of the signal which is proportional to the velocity of the fluid. Everything else is just noise. Notice that even when there’s no magnetic field, there may still be a non-zero voltage between the electrodes. But if we sample the signal at the peak of the magnetic field and subtract the voltage measured when the magnetic field is zero, we’re left with only the part of the signal we care about. Even if the noise is changing over time, we’re only measuring the part of the signal which is induced by the magnetic field. Obviously, there’s no easy way to generate this type of waveform with permanent magnets, so we’ll have to switch to electromagnets. Of course, I’m using artisan electromagnet coils and wound in small batches with locally sourced magnet wire. Here’s a diagram of the overall setup, the electromagnets on the flow meter are powered using an H bridge. This is a circuit that allows a small signal to control high current devices like electromagnets. The control signal in this case is provided by an Arduino. I’ve written some simple code so I can control the frequency and duty cycle of the biphasic DC pulses. There’s a GitHub link in the description. If you’re interested in the code. The blue line shown here is the voltage waveform going to the electromagnets. Unfortunately, even with all the trouble, this setup wasn’t quite strong enough to give me a reliable signal from some literature, I read a well said. A meter typically only generates about 100 micro volts for every foot per second of velocity, or about three hundred micro volts for a meter per second for my garage workshop and the pump I’m using. That’s a needle in a haystack of RF noise and hum, especially considering that my crude apparatus can hardly be considered well set up every once in a while. If I was standing at just the right spot in the room, I could get a clean response from the electrodes, but I just wasn’t ever able to catch it with a camera. But this video is all about the devil in the details, so I guess I should have expected this to be a bigger challenge for now. Let me just use some example data to demonstrate how a real meter would calculate flow. Let’s say I was able to measure the induced voltage in the electrodes for a number of different flow rates in the pipe, I could plot those points on a graph. Since the IMF is linearly proportional to velocity and velocity is linearly proportional to the volumetric flow rate, these points should fall in roughly a straight line. The slope of this line can be used as a proportionality constant in the signal processing of the flow meter and the math becomes dead. Simple step one measure the induced voltage step to multiply the voltage by the calibration constant while you just measured the flow. It really is that simple, assuming you get a good signal from your electrodes. From generators at a power plant to the pickups on an electric guitar, Faraday’s law of induction is working behind the scenes and some of the most unlikely places, including an ingenious method of measuring the flow of liquid through a pipe. I am a bit disappointed I couldn’t get the prototype working better, but I think there were some good lessons that came out of it regardless, namely that electrical engineering is hard. I thought about not making a video at all, but I think documenting your failure is just as important as documenting success. And this is hardly the most shameful thing I put on the Internet.