My school project incorporates motors, and since I don't really have time/money to include encoders, I looked into back EMF. I know the Arduino should be protected from this, but is there also a way to read the magnitude of it to do some speed control? It would be excellent if I could use this with a PID controller to regulate speed.
I know the Microchip website has some good app notes on back EMF - look for stuff related to things like driving electric window motors.
You only get back EMF when you turn off a motor as the field collapses so it is not much use for controlling the speed.
However if you monitor the current ripple through a motor that is proportional to speed. I have used that in the past as an encoder, or to be more precise as a VFO in a PLL to control the speed of a motor.
since I don't really have time/money to include encoders
Yes you do; if you have time to try to do the back EMF thing, you have time for an encoder.
Money? One of these is too expensive?:
http://www.goldmine-elec-products.com/prodinfo.asp?number=G8751
Time? Take a small disk of white cardboard/posterboard thinner than the slot on the above sensor, drill a small hole thru the center, use a sharpie marker to color one half of the disk black, and mount it on the shaft of your motor with a small drop of glue.
$1.00, and probably a couple of hours of time to build, mount, and code for the interface...
The only time issue I can see is if your project is due next week, and you can't get the parts shipped quick enough (that's what FedEx overnight is for, though - although for a $1.00 part its kinda pricey). Alternatively, you could go down to a thrift store and buy a few old non-optical mice and rip them open for the opto-slot interruptors...
![]()
You only get back EMF when you turn off a motor as the field collapses so it is not much use for controlling the speed.
This is incorrect. Back EMF simply refers to induced voltage in the motor windings as they move through the magnetic field (which for most small motors is provided by permanent magnets and cannot 'collapse'). So it is proportional to the motor speed. If you stall a motor there is no back EMF so typically very large currents flow as there is only the winding resistance to limit it.
However there is no easy way to measure back EMF as the voltage at the terminals is the sum of this EMF and the voltage drop across the resistance of the windings. However the latter can be estimated if you measure the current as well - a rough estimate of back EMF is probably doable.
In real motors there are other confounding factors such as winding inductance, magnetic losses, etc. Accurately measuring speed is easier with an explicit sensor.
All the above assumes permanent magnet DC motor.
However if you monitor the current ripple through a motor that is proportional to speed. I have used that in the past as an encoder, or to be more precise as a VFO in a PLL to control the speed of a motor.
Ahh, explains some of what they're looking for when they say that three phase brushless controllers measure back emf to drive the motor. And so I go over to the Microchip website and check up one of their app notes:
This application note describes a sensorless brushless DC (BLDC) motor control algorithm, implemented using the dsPIC® digital signal controller (DSC). The algorithm works by digitally filtering the back-Electromotive Force (back-EMF) on each phase of the motor and determining when to commutate the motor windings based on the filtered back-EMF signals. This control technique precludes the need for discrete, low-pass filtering hardware and off-chip comparators.
(which for most small motors is provided by permanent magnets and cannot 'collapse').
It takes two to tango. Yes the field on a permanent magnet doesn't collapse, that is why it is called a permanent magnet, the clue is in the name. The field that collapses is the field that is generated by the coil, unless you know how to make a motor without an electro magnet.
It takes two to tango. Yes the field on a permanent magnet doesn't collapse, that is why it is called a permanent magnet, the clue is in the name. The field that collapses is the field that is generated by the coil, unless you know how to make a motor without an electro magnet.
The winding self-inductance is another form of back EMF, true, but not really relevant to a motor running at constant speed/current/voltage - although its the absolute key to motor speed control using PWM.
Actually if using PWM the inductive back EMF is going to make the motor-action back EMF rather hard to measure...
Back EMF for motors is usually interpreted as the motor-action back EMF though since we're trying to turn a shaft, not be an inductor.
Ahh, explains some of what they're looking for when they say that three phase brushless controllers measure back emf to drive the motor.
With 3-phase BLDC motors there is always one phase undriven at any point in time so its voltage is back EMF. This can be used to determine rotor position without needing hall-effect sensors in the motor. RC-model motors usually use this technique, despite it not working well at slow speeds (low voltages, electrical noise). Such motor contollers have a special starting sequence since they cannot commutate the motor from standstill.
How big is your motor? An old style mouse with a ball will have inside it two small plastic discs with holes in them, and some kind of sensor that goes over it to detect when light passes through.
Assuming this is for a normal brushed DC motor, then YES, you can measure the back EMF of a motor to get an estimate of speed.
http://openservo.com/ has a technique, it gives a link here http://www.openservo.com/OpenServoV3
They use an ATmega168 and the code is open source, so that is one approach which would be plausible. There is some nifty electronics in it though. So an encoder may be cheaper anyway.
There are other techniques.
Google for something like "measuring DC motor back-EMF", and scan a few pages, and you'll bump into one.
It uses a comparator to measure the voltage across the motor. The voltage is modulated by the back-EMF (as Grumpy_Mike said), and looks like a sine-wave super-imosed on the driving voltage. So you tweak the comparator comparison voltage until you get nice edges. It isn't perfect as there may be a bit of extra noise, but it looks consistent. When we did the experiment, we just wired up an ordinary comparator, but there is a comparator in an ATmega, so it may be only a couple of capacitors, resistors and a potentiometer to get that working.
In this technique, it isn't really measuring the magnitude of the back-EMF voltage, instead, it detects the modulation of the voltage. In some ways this is better than a measure of magnitude because the modulation is the position of the armature in the magnetic field, and so you get data determined by the physical motor position. Time the edges, and it gives rotation speed.
HTH
GB
So if the brushed rotor had three windings, rpm would be frequency/3?
Thanks for the explanation, now I know why these sensorless brushless motors act the way they do. Some start kind of herky-jerky until the RPM builds up depending on the quality of ESC. Also, I was reading about the three phase drive which can be either sinusoidal or trapezoidal, the trapezoid pattern explains the harmonic audible noise some of these brushless motors produce.
FWIW, Microchip Brushless Motor Fundamentals App Note: http://ww1.microchip.com/downloads/en/AppNotes/00885a.pdf
So if the brushed rotor had three windings, rpm would be frequency/3?
I'd have to double check by looking at the oscilloscope trace again to be certain, but, as I remember it, yes, it is /3 plus a constant factor to correct for commutator 'noise'. It is very clear with a storage scope.
[edit]I was wrong, it is triggering at the zero crossings, of which there are two/armature/cycle.
They say
Because there are 3 armature segments, we'll actually see 6 zero-crossings per motor revolution
Sorry about that :-[
There may also be a number of spikes/rev, depending on your motor, to account for too.[/edit]
The page google finds shows their scope traces, but I'd need 15+ minutes to google around until I found it again. My friend found it first time, but I forget the exact search term. Find the page, and I think it is pretty clear.
HTH
This is one of the pages I was thinking of (much less than the 15+ minutes I'd feared).
It has some explanation, and the oscilloscope traces, so you can see how it works
http://www.surveyor.com/cgi-bin/yabb2/YaBB.pl?num=1181167494
[edit]The oscilloscope trace shows an extra spike, which we saw too (we maybe had two, but the motor was only 0.50 GBP, good but not exceptional).[/edit]
HTH
GB
Just to indicate the complexity of the circuit at
http://www.surveyor.com/cgi-bin/yabb2/YaBB.pl?num=1181167494
they say
Total circuit comprises 7 resistors and 1 capacitor per motor plus the LM393 dual comparator and an extra bypass capacitor for the 3.3v supply.
For one motor, you may be able to use the comparator in the ATmega, but that I really don't know. Personally, I'd avoid doing that and just buy an LM393, which are about 0.10 GBP+VAT, or $0.21: LM393 at Newark
It contains two comparators, so could handle two motors.
HTH
GB