EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: BuzzB on February 03, 2021, 07:15:36 pm
-
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.
(https://www.eevblog.com/forum/beginners/current-mirrors-and-current-detection/?action=dlattach;attach=1164638;image)
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. I think I 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, but :-//
Thanks in advance.
- Buzz
-
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.
-
Got it. Thanks!
-
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+Sensor (https://www.photomacrography.net/forum/viewtopic.php?f=25&t=39689&hilit=Hall+Effect+Sensor)
Best,
-
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.
-
Use a dedicated product https://www.onsemi.com/products/amplifiers-comparators/current-sense-amplifiers/ncs199a3rsqt2g (https://www.onsemi.com/products/amplifiers-comparators/current-sense-amplifiers/ncs199a3rsqt2g)
You 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_currents (https://en.wikibooks.org/wiki/Circuit_Idea/How_the_Wilson_current_mirror_equalizes_the_currents)
The ready made current monitor ICs are much cheaper than matched transistors and they work straight out of the bag!
LT spice assumes two absolutely matched TP42A's In the real world this doesn't happen (often) put a similar but not identical transistor along side a TP42. |O
??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