The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions. We hope you enjoy it. If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to [email protected].
The Black Sheep
If Ohm had a family, current would be the black sheep. Most people, technical or not can figure out how to measure voltage. Resistance is not that big of a deal. But start talking about measuring current and a hush comes over the room. Like I said, the black sheep of the family. Here is the thing, there is always a thing, current is a common parameter that needs to be measured.
OK so most EE’s can figure out how to hook up the current meter of their favorite VOM, but what if you want that measurement to go into the MCU so you can send it to the user (via, serial, BlueTooth or WiFi)? Sometimes it is recorded, transmitted or used in decision making. Other times it is used as part of a feedback loop.
The current sense
The easiest way to measure current is with a low resistance resistor. Tie one side to ground and then measure the voltage on the other side. Voltage divided by resistance gives you the current. Of course, you want to avoid robbing too much of the voltage, so you will make your resistance small. How small? Well, 50 to 100mV is usually small enough. The value of the resistance will depend on the amount of current flowing.
If you are using a 10-bit A to D with a max input range of 1.8 volts, then your resolution is only 1.7mV. That is very course. So, maybe a direct measurement is not going to work. That means you need to add some gain to your signal. If the max voltage drop will be 100mV then a gain of 18 will get you to 1.8V, the max input of you’re A/D. You will get much better resolution (about 18x better – 94uA). We don’t need to go into noise issues, compensation for slew rate, lag time, anti-aliasing here, but you should think about all those things when you design the circuit.
High side current measuring
Sometimes it is not possible, or beneficial to measure the current relative to ground. Sometimes you must measure the current entering a circuit. Possibly you can’t change the circuit relative to ground and putting a resistor, even a small one in the ground path with cause issues. What’s an engineer to do?
One option might be to use an instrumentation amplifier. These have a very high input impedance; the gain can be set by changing a single resistor. As long as the input voltage is not too close to the rail, “Bob’s your uncle.” If you are measuring the current relative to the voltage source, this might be a problem.
Another option is to use a high side current monitor. This device uses a small resistor in line with the current and converts the voltage drop to either a voltage out or a current out. The nice part about a current output, is that you can scale the voltage to match you’re A/D just by changing the load resistance and a cap in parallel will add a bit of filtering.
You can build one yourself out of Op-Amps and discretes, but a quick search will turn up a host of high side devices that are temperature compensated, run rail-to-rail, handle noise well, etc. Oh, and they are inexpensive. There are devices by Texas Instruments, STMicroelectronics, Analog Devices, Maxim and ON Semiconductor to name a few.
In a real-world application, a customer used a microcontroller to turn on/off electromechanical devices. You won’t believe this, but sometimes there are system shorts and the amount of current drawn goes up severely. Unless preparations are made for such circumstances, the result is a fried board, overloaded power supply, or even fire. You get the idea. You can put a fuse in the circuit and then send out a technician to change the fuse, but if you are already turning the circuit on and off, why not just turn the circuit off if it draws too much current? A microcontroller does not work on human timescales. They do things fast, really fast. So, you can measure the current and decide if it is within acceptable limits with plenty of time to turn it off if there is a fault, short.
The next time you have to measure a current just use a current sensing device and don’t sweat the small stuff.
This newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan and Murray, Utah, which can be found on the web at: www.celticengineeringsolutions.com. If we can ever help you with your engineering needs please contact us. You can find the newsletter on the company blog, LinkedIn or in your inbox by subscribing. Send your emails to The Celtic Engineer at: [email protected], with the subject line SUBSCRIBE.