# current sensing for variable loads

Discussion in 'The Projects Forum' started by b0red, Mar 5, 2010.

1. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
Hi ! Can anyone help me with solving this puzzle :

I need to sense commutation event in motor windings (thus get rpm reading).

But, i have no control of which motor will be attached to this sensing circuit (namely how much current it will draw).

Circuit is intended to work with 12V BLDC motors.

I have sucessfully made a low side monitoring test circuit with LM339, one input is from motor / shunt resistor connection, other is from trimmer pot as voltage divider and LED with resistor to vcc.

I can "tune" the circuit for one motor, but when i connect motor with different amp rating, beacuse of different voltage drop across shunt resistor, LED no longer correctly indicates commutation event.

I have an idea to use op-amp to re-scale the voltage drop so it is always same, regardless of loading on shunt resistor, but i have no idea how to implement it

2. ### beenthere Retired Moderator

Apr 20, 2004
15,808
294
Wouldn't sensing shaft rotation present fewer problems?

3. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
I guess you mean having a separate signal from motor axle with extra sensor.
Nice, but as i said i need a "sensorless" reading directly from power line feeding the motor.
The principle behind is sound and widely used, i'm just at loss as to how to make it work with variable loads

PS: i've seen exmaples for feeding constant current to loads, i just need it in some kind of reverse version

Last edited: Mar 5, 2010
4. ### russ_hensel Distinguished Member

Jan 11, 2009
825
57
Commutation even will not give you the rpm unless you know how many commutation events per rotation. This is hidden inside the motor.

5. ### retched AAC Fanatic!

Dec 5, 2009
5,200
316
You can use a uC to measure manually a single revolution, getting the number of commutation events per R. then set that in a counter loop to give the RPM.

That way you can use different unknown motors, and calibrate the tach with a single rotation.

6. ### ifixit AAC Fanatic!

Nov 20, 2008
650
118
In theory, this could work...
1. Rectify and filter the average voltage across the sense resistor to a smooth DC level. This level will vary dependant on the average motor current.
2. Halfway between 0v and the average voltage (V$_{av}$) is a good level to set the comparator reference to.
3. The other comparator input can now receive the unrectified sense voltage. Some high frequency filtering may be needed as well.
4. As the motor current changes with load, or amoung different motors, the sense thershold voltage (half of V$_{av}$) will adjust automatically.
I may simulate this if I have time.

Good Luck

7. ### retched AAC Fanatic!

Dec 5, 2009
5,200
316
I'm interested in seeing the results of the simulation. This could be a good circuit to have on hand.

8. ### ifixit AAC Fanatic!

Nov 20, 2008
650
118
The OP may no longer care, but here's a circuit for review.

I measured a few motors that I have on hand to see what the signals look like. The motor current model is based those measurements.

Needs improvement...
Large changes in load current may cause the slicer output to stop until the peak detector has re-established the new slicing level for the new load current. A change of 10% doesn't cause a problem, but a 50% change does. Therefore, using the output signal as feedback to control the motor speed will only work if the loop response time is slower than the peak detector (200mS).

Investigation and solution...
The sawtooth shaped commutator signal seems to have a much faster fall time than rise time and it was mostly the rise time that varied wrt RPM more than fall time. By differentiating the fall time I get more reliable and consistent results. The signal is small so I multiplied by ten, which will make the slicers job easier.

Since the signal level varies with RPM, and load, and motors, I use a peak detector to measure the signal level. C1 remembers this value while it is divided by 2 and used by the slicer to square the signal up. R5 on the slicer comparator provides a small amount of hystersis, which improves the circuits noise immunity.

I used LTspice to test the circuit. If anybody needs the source, post a request, and I'll post the source (.asc file).

• ###### Commutator sense.jpg
File size:
112.2 KB
Views:
53
b0red likes this.
9. ### retched AAC Fanatic!

Dec 5, 2009
5,200
316
Post the source. I would really like to play around a little more with this.

10. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
@ifixit : wow ! i thought this kind of signal required some serious post-processing or such, but really you have done it !

As i see it, the key components are signal differentiator and peak detector
(the HEART of it all !).

Especially i like the part how is reference voltage generated... simply beatiful !

This way one can hook up any motor without worrying about varying voltage drop across shunt resistor.

Life is good again

11. ### BillB3857 AAC Fanatic!

Feb 28, 2009
2,478
382
Since a BLDC is essentially a synchronous motor, wouldn't simply measuring the frequency of the drive signal and compensating for the number of poles in the motor be a more reliable method?

On edit...... Of course the frequency of the PWM switching would need to be disregarded.

12. ### ifixit AAC Fanatic!

Nov 20, 2008
650
118
B0red...
I'm glad you like the circuit. However, Bill makes a good point.

The circuit is intended to be used with commutated DC motors. Your original post spook of commutation and BLDC (BrushLess Direct Current) motors at the same time. I just assumed you ment motors with brushes on a commutator since it doesn't make sense to use this circuit on a BLDC motor. What did you mean?

Retched...
I have attached the source. You can change the opamps to something you have available if required.

Have Fun.

File size:
6.1 KB
Views:
13
13. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
Dang it i assumed you (ifixit) took a BLDC as example It's obvious i didn't care about differences between BLDC and "brushed" in commutation events.

I just assumed this circuit will try to scale various voltage drops across shunt to some uniform amplitude that can be later simply compared to fixed reference value.

So... to summarize : the previous circuit wouldn't work with BLDCs ? The motor i have has built-in switching circuit that should "look" to this rpm detector like a everyday brushed motor ?

I mean the BLDC's internal commutating circuit should/could have similar switching characteristics just like a usual mechanical commutator ?

@BillB3857 :
Errr how does one look at this "frequency of the drive signal" ? I do want to use PWM (man, am i THAT transparent ? ), but other than monitoring current waveform i have no other idea how to implement feedback loop, unless you mean voltage variations caused by motor's windings ?

@ifixit :
Can you nag to some of semiconductor manufacturers to put your circuit inside IC ?
I guess many people would love to have this inside "current monitor" ICs

14. ### ifixit AAC Fanatic!

Nov 20, 2008
650
118
Okay I thing I understand, the BLDC has the pwm circuits contained inside it where you have no access. My circuit may still work if the current waveform is more or less sawtooth shaped.

Can you get a scope picture of the motors waveform and post it for me? I have brushless motors, but none with the PWM circuits inside so I can't take measurements myself.

It's not a complex circuit so you could just breadboard it and try it, which should be done anyway.

Good Luck, and sorry about the mis-communication.
Ifixit

15. ### BillB3857 AAC Fanatic!

Feb 28, 2009
2,478
382
Can you tell us more about the motor(s) you are wanting to monitor? Do you simply supply power and they run, like fans in a PC, or do they have a controller that allows variable speed/position as in a servo application?

@ifxit, BLDC motors have commutation signals that tell the controller how to change the power to each of the stator windings. These commutation signals come from a device directly attached to the motor shaft. Some use resolvers and others use pulse type encoders. Even others use very fancy serial signals from multi-turn encoders for absolute positioning. In any case, the terminology is commutation. Probably a fall-back to the good ol' brush motor days. If you go here.........
http://www.mitchell-electronics.com/technicalinfo.html you will have a good read on the subject.

ifixit and b0red like this.
16. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
Oops it may be me who mis-communicated the problem. The BLDC motor i have has only the electronic version of commutator, it has no PWM capability. All it does is switch current in windings (as far i as i currently understand inner workings of BLDCs).

As the local saying goes "from your mouth to God's ears". In translation : i WISH i had a scope I contacted a friend that goes to school, he'll ask professor for use of scope (most likely some old analogue w/o sampling memory or PC-connectivity). If all goes well i'll make some snapshots.

I can even build a PWL table as spice macro, i had success before.

What i did was:
-take a snapshot of scope waveform from some pdf document
-transfer it to vector drawing VBA-capable program
-manually draw a line following the scope's waveform (made of points with straight lines)
-wrote a small VBA program that read coordinates of all points and sent them to spreadsheet program, forming a table
-googled for how to make a spice macro for PWL source that repeats the pattern
-inserted it into a simulator and voila ! the signal in sim was quite similar to one inside pdf document

After i gather some missing components, the nerve-wrecking breadboard test
will commence ASAP

No apologies needed. We're cool.

17. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
First, i apologise if it seems trivial, since i feel that the intended target for ifixit's circuit may be much more serious application for larger motors performing important or even critical functions. Luckily (for me), the scalability of this circuit makes it a worth the effort ifixit put into designing it.

My goal is PWM control of fans in PC, the varying voltage drops were the thorn in my eye and if the circuit holds up, i'll overcome one of my major hurdles. Most of today's cooling fans have feedback, but i have no idea what model will be connected to controller, it might have no tach feedback wire at all.

After confirming successfull tach monitoring, rest is just decision making.

I intend to use PIC as a controller for multi-fan PWM system. I've already built a program-flow diagram for single fan, and fixed some bugs, damned things find their way inside even in this stage.

And thanks for the link explaining the internals of today's commutation ciruits. Certainly a good read. Which makes me wonder : are there on the internet any available scope screenshots or maybe even csv files showing BLDC or brushed motor commutation in action ?

Feb 28, 2009
2,478
382

File size:
117.4 KB
Views:
13
19. ### b0red Thread Starter New Member

Dec 17, 2009
12
0
OP is back !
I know this thread is (not so) old, but i have some good news ! After some time i have contacted the professor at local high school and he agreed to let me use their oscilloscope !!!

YAAY !

And it isn't just ANY 'scope ! It's a Voltcraft 4062 (IIRC - i had only a short glimpse at it). The thing has USB port (type USB-B, the small square-like kind) soo if i hookup it up to computer, i should be able to get all data in for later review and processing (like inserting it into circuit simulation, yummmm )

Sooo, if this works out, i'll have raw data on electric current inside windings of various BLDC fans and their operation.

I'm soo happy ! I can't contain myself !

I'll test fans on normal DC, then with PWM with cycles in 10% steps and whatever comes to mind at that point.

Oh, and this brings me to one problem : since professor is a working man, he does not have infinite amount of time available for these tests.

One way of speeding things up would be for me to learn something about this specific model.

I tried looking for manual for Voltcraft 4062, but have found nothing.

Does anyone have a useful manual ?

Or, maybe a guide to working with oscilloscopes in general would be just as helpful ?

20. ### ifixit AAC Fanatic!

Nov 20, 2008
650
118
Good News,

I tested my circuit on some BLDC motors I took out of a tape drive. The commutation signal they produced is similar to the brushed motors and my circuit seems to work just as well with them.

One difference was that the RPM of these motors was very constant once a certain voltage was reached. Not only are they brushless, but the circuit inside regulates the RPM also.

Have Fun with that Scope,
Ifixit