Current mirrors and current detection - Page 1
Forum section: electronics / beginners

author: BuzzB
author_rank: Contributor
timestamp: February 03, 2021, 07:15:36 pm
content: I am working on a project where I have a microcontroller controlling 2 motors through 2 H-bridges using PWM for speed. There is a 12V supply into the H-bridges for the motors, and before that, there is a split to a 5V buck converter that supplies the micro. I have a filter on the buck output that quiets the pwm noise generated by the H-bridges. The micro is actually a dev board (Teensy 3.2) that has an onboard 5v to 3.3v linear regulator.Ok... So...I started to wonder if I might be able to monitor the current the motors are drawing... to detect stalls, etc. So being a completely uneducated newbie, I started poking around on the old interwebs and I learned about current mirrors and current to voltage circuits. I thought maybe I could jam those together and come up with something.I1 is the H-bridges etc just simulated as one big current sink. (When I captured the image I had the current draw set to 200 ma to see if the thing was working)I don't expect that all to sink anymore than 3 Amps.Obviously, Q1 and Q2 are the mirror using PNP transistors. IthinkI read the data sheets correctly and those can handle the power.U1 and R2 are the current to voltage converter, with R2 chosen so that at 3Amps drawn by the motor block, the output of this converter is 3v. ish.D1 is a 3v Zener as a clamp to be sure no more than 3 volts are fed to the micro input pin.R1 is a dummy load to simulate a high impedance input to the micro.Do I understand any of this correctly? Is this even a thing. It seems to do what I am looking for in LTSpice, butThanks in advance.- Buzz

author: Benta
author_rank: Super Contributor
timestamp: February 03, 2021, 08:02:54 pm
content: First: current mirrors only operate in the linear region of your BJTs, meaning you'll have at least 1 V drop over them, if not more.Second, discrete current mirrors are almost impossible to get to work properly.You'll need perfect Vbe matching between the two devices over temperature.They need to be very closely thermally coupled.There are more issues, but you can start with these.Current mirrors are extremely well suited for linear ICs, eg, opamps, where parameter matching and temperature tracking is inherent.If you want to measure bridge current, just use a low-ohm resistor. Much simpler.An even better solution (for MOSFET bridges) is using SenseFETs, which have a separate extra source connection for current monitoring.

author: BuzzB
author_rank: Contributor
timestamp: February 03, 2021, 08:40:27 pm
content: Got it. Thanks!

author: mawyatt
author_rank: Super Contributor
timestamp: February 04, 2021, 02:21:37 am
content: You might consider a Hall Effect device. Here's a link to a Hall Effect Current Monitor for Stepper Motor use.https://www.photomacrography.net/forum/viewtopic.php?f=25&t=39689&hilit=Hall+Effect+SensorBest,

author: SmokedComponent
author_rank: Regular Contributor
timestamp: February 04, 2021, 03:19:21 am
content: I would use some high-side current sense amplifier IC, for example INA210, with an appropriate low value shunt resistor (it's very simple to use). Then you can feed its output directly to ADC.

author: Terry Bites
author_rank: Super Contributor
timestamp: February 04, 2021, 05:32:18 pm
content: Use a dedicated producthttps://www.onsemi.com/products/amplifiers-comparators/current-sense-amplifiers/ncs199a3rsqt2gYou need ultra matched transistors for a current mirror and the basic topology in your circuit rarely works well in practice.https://en.wikibooks.org/wiki/Circuit_Idea/How_the_Wilson_current_mirror_equalizes_the_currentsThe ready made current monitor ICs are much cheaper than matched transistors and they work straight out of the bag!LT spice assumes twoabsolutely matchedTP42A's In the real world this doesn't happen (often) put a similar but not identical transistor along side a TP42.??https://www.allegromicro.com/en/insights-and-innovations/technical-documents/power-ic-power-management-publications/innovative-back-emf-based-stall-detection-simplifies-stepper-motor-designs