Current measurement while using an H bidge is pretty straightforward. In previous posts I’ve discussed some of the elements that make up an H bridge. Included in those posts were methods for controlling current to the load, in this case a motor, using high and low side switches. It’s fairly common and desirable know a little bit about what’s going on with your load, and so today I’ll cover some basics of measuring load (motor) current.
There are common methods for measuring current in motor drive applications. For DC motors you will usually see a shunt resistor that lies in the current path. Shunt resistors are generally very small valued resistors that are placed in series with the load. The resister is either between the power supply and the h-bridge (high-side sensing) or between the h-bridge and ground (low-side sensing). Current through the load creates a small voltage drop across the shunt resistor, which may be measured and is proportional to the motor current using Ohm’s Law.
You can also use hall effect devices to measure DC current without interrupting the current path. Hall effect current sensing is more expensive and not really applicable for current sensing in small DC motors. I won’t cover it here.
Here are some items to consider when measuring motor current.
1. Your measuring circuit should have minimal impact on the load. This means the shunt resistor will be small, and to have good resolution of the measurement you would need accurate amplification of the voltage across the shunt resistor.
2. Motors are notoriously noisy, and driving them with PWM signals makes them even more noisy.
3. Changes in the motor loading condition, such as extra weight on or against a wheel will change the load current.
Accounting for all of the various motor load and drive signal characteristics via hardware alone is not trivial. So if you need high resolution and accuracy you should be prepared to implement some algorithms (digital filters) and look-up tables in a microcontroller in your system.
In most instances you don’t need “that much” motor current information. Measuring a stall condition (high current) or a failure in wiring / switching elements (no current) are normal needs. This can be done cheaply on the low-side with an op-amp circuit. More complicated instrumentation circuits can be employed, but I’ve had luck using a non-inverting op-amp that feed its output voltage into an RC filter to smooth current sense voltage. You’ll also want to protect the inputs of the op-amp from voltage spikes and verify that the shunt resistor is appropriately sized to produce a measurable voltage.
For example, a 5 milliohm shunt resistor would produce 0.1V current sense voltage at 20A. A ratio of R1/R2 of 49 would give you a gain of 50 and an output of 5V at 20A. Using an 8-bit AD you would have a resolution of 78mA per bit, but probably nothing near 1-bit accuracy. If you were closer to +/- 2 bits accuracy you’d be at about 320mA of accurate resolution.
I guess it is worthwhile to touch on “resolution” and “accuracy” a bit (that last part was an engineering pun). Using the example above if you have 8-bits of resolution in your voltage measurement you can measure 256 steps. Over a range of 5V, that’s 5V/256 = 19.68mV per bit. But rarely, and not without considerable effort, can you get 1-bit of accuracy. In a noisy motor system with a basic op-amp amplifier and varying PWM drive signals +/-4 bit accuracy is not unreasonable. So don’t confuse accuracy with resolution. 8-bit resolution with 4-bit accuracy gives you 64 accurate measurement steps. If you need more than 64 steps you’ll have to do some engineering to get there.
There are instances where measuring at the high-side of the load makes more sense. Generally this would be when you want to measure all of the system’s current (controller included) and don’t want high load currents to create ground offsets specific to your motor control circuit. There are a number of high-side current sense circuits that take all of the design effort out of creating a high-side current measurement. One that I’ve used is the Linear Technologies LTC6101. You still have the shunt resistor, but the accuracy and op-amp specification has been handled for you. And you get a datasheet that recommends protections for various applications.
Another method of measuring the high-side current is to place a high-side smart switch in your circuit at the high-side H-bridge switches (S1 and S2). One I’ve used is the Infineon BTS555. This part has a current sense feedback that can be used to monitor your load current. These devices are heavily protected, and remove the need for a high-side MOSFET driver. Generally speaking, they are not good at fast switching so you won’t want to drive them with the same signal as your low-side H-bridge elements (S3 and S4). If you use these “smart switches” in your circuit you’ll need to check the turn-on and turn-off speeds to make sure you never create a shoot-through condition.
Several years ago we used the BTS555 as part of a half-bridge power switch. On the high side was the BTS555 and the low side were 4 N-channel MOSFETs. As a test load we used an automobile starter motor which was a 90A, very noisy, load. The circuit worked well and had adequate current measurement capability while controlled by a Microchip PIC16C73 (on board 8-bit ADs and PWM hardware).