H-Bridge motor driver back EMF question

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
I need to sense if a small 6 VDC motor (rated at 200 mA ... the thing is practically a toy) is actually rotating or not, and I'd like to avoid the use of an extra sensor in the assembly. My first thought was to simply measure the motor's natural back EMF. But then I realized this was going to be more complicated than I thought, since the motor's rotation is reversible.

My first attempt at a concept is show below. I've connected a resistor across the motor (represented by L1), which will be activated through an nFet (M5). A differential amplifier would then sample the voltage across R1, reporting it to one of my MCU's pins. Measuring the speed of the motor is not important, so no fancy ADC is needed here. All I want is to know if the motor is rotating or not.


1589331941647.png

The above circuit is rather clumsy, because I realize the the voltage that needs to be applied to M5's gate has to be done in relation to its source. And said source's polarity changes with the motor's direction. Also, I'd very much like to avoid the use of an additional source of negative voltage, if that's possible.

Question, is there a better (and I'm sure of it) approach to this problem? What would be the simplest solution?

Many thanks in advance to those who'll try to help me out.
 

Attachments

BillB3857

Joined Feb 28, 2009
2,561
I think that if you followed the op-amp that supplies the "SENSE" output with a precision rectifier, no matter which direction the motor ran, the output would be the same polarity. Also, the FET you show would not be needed if your software ignored the "SENSE" unless it was told to look at it.
https://circuitdigest.com/electroni...wave-precision-rectifier-circuit-using-op-amp

Another way could be to bias the "SENSE" signal so that if it went above or below the bias level, it could sense the motor spinning. Of course that would, again, depend upon only looking at the "SENSE" when the full bridge is in the OFF state.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
I think that if you followed the op-amp that supplies the "SENSE" output with a precision rectifier, no matter which direction the motor ran, the output would be the same polarity. Also, the FET you show would not be needed if your software ignored the "SENSE" unless it was told to look at it.
https://circuitdigest.com/electroni...wave-precision-rectifier-circuit-using-op-amp

Another way could be to bias the "SENSE" signal so that if it went above or below the bias level, it could sense the motor spinning. Of course that would, again, depend upon only looking at the "SENSE" when the full bridge is in the OFF state.
I thought about that... using a precision rectifier, that is. But I'm not sure about how it would be connected to the motor's output. On the other hand, I also thought about using a simple full wave rectifier using schottky diodes. But even though they have a very low voltage drop, I'm thinking that it might be too much for the the meager EMF that the motor would be producing.

I'm thinking ... what if I were to use a couple of comparators whose inputs were directly connected to the motor's terminals in an inverse parallel configuration? They have high impedance inputs, right? The only requirement would be that they should be tolerant to -6V at their inputs ... does such a comparator exist?
 

Alec_t

Joined Sep 17, 2013
12,802
Another approach. Whether the motor is brushed or 2-wire brushless, commutation will result in rotation-related current fluctuations/noise. Perhaps you could sense the presence/absence of that with a current-sense resistor?
 
Aside: Not likely to help you. There was an IC made by National Semiconductor that was used in 8-track tape decks for speed control.

Used the relation V=Vm-Im*Rm; Where Vm is made a constant for constant speed. It's a quantity you can't measure, but can model.

Speed is proportional to voltage when Im = 0. m::= motor
 

Danko

Joined Nov 22, 2017
1,297
Question, is there a better (and I'm sure of it) approach to this problem? What would be the simplest solution?

Many thanks in advance to those who'll try to help me out.
Connect some small choke in series with motor.
Twice useful - kind of EMI filter and sensor of rotation.
From leads of choke you can take big electrical noise, when rotor rotates.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
Connect some small choke in series with motor.
Twice useful - kind of EMI filter and sensor of rotation.
From leads of choke you can take big electrical noise, when rotor rotates.
Interesting idea... I do have some chokes lying around. Can't hurt to connect them and scope them and see what happens. Thanks!
 

MaxHeadRoom

Joined Jul 18, 2013
25,183
And said source's polarity changes with the motor's direction. Also, I'd very much like to avoid the use of an additional source of negative voltage, if that's possible.
Question, is there a better (and I'm sure of it) approach to this problem? What would be the simplest solution?
Keep in mind when you need to ensure uni-polarity, regardless, a miniature schottky bridge often works.
Max.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
Keep in mind when you need to ensure uni-polarity, regardless, a miniature schottky bridge often works.
Max.
AAMOF, I was thinking about experimenting with Danko's suggestion, using a schottky bridge and connecting its output to a comparator. The comparator's output would in turn be clipped using a zener, since my MCU works at 3.3V, whilst the motor and comparator will work at 6V.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
That makes me think that maybe it would also be good practice to add a bidirectional tvs diode connected across the choke, to make sure the produced noise never goes beyond 6V and thus protect the comparator's inputs.
 

OBW0549

Joined Mar 2, 2015
3,566
Per our PM exchanges here's my solution, based on an LM393 configured as a window comparator:

Untitled.png
D1 thru D4 are clamp diodes to protect the LM393 inputs; they can be 1N914, 1N4148 or just about any other "jellybean" diode. The R1/R2 ratio and the R4/R3 ratio determine the detection thresholds (+/- 270 mV if Vcc = 6V). One side of the motor, VM1, is used as the reference voltage and the other side, VM2, is compared against the derived thresholds. If the motor voltage is between those two thresholds the combined comparator output is HIGH; if it is higher than VRH or lower than VRL the output goes LOW.

I haven't put in any noise filtering; no matter what you do the comparator outputs are going to chatter because the motor back EMF is going to bobble up and down with the position of the motor shaft, so your MCU is going to have to sample the comparator output multiple times anyway to arrive at a rotating/not rotating decision.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
Per our PM exchanges here's my solution, based on an LM393 configured as a window comparator:

View attachment 207103
D1 thru D4 are clamp diodes to protect the LM393 inputs; they can be 1N914, 1N4148 or just about any other "jellybean" diode. The R1/R2 ratio and the R4/R3 ratio determine the detection thresholds (+/- 270 mV if Vcc = 6V). One side of the motor, VM1, is used as the reference voltage and the other side, VM2, is compared against the derived thresholds. If the motor voltage is between those two thresholds the combined comparator output is HIGH; if it is higher than VRH or lower than VRL the output goes LOW.

I haven't put in any noise filtering; no matter what you do the comparator outputs are going to chatter because the motor back EMF is going to bobble up and down with the position of the motor shaft, so your MCU is going to have to sample the comparator output multiple times anyway to arrive at a rotating/not rotating decision.
Very nice! ... I'm thinking about connecting your circuit's output to a pin with external interrupt capabilities, that would simplify programming quite a bit. Many thanks!
 

OBW0549

Joined Mar 2, 2015
3,566
Very nice! ... I'm thinking about connecting your circuit's output to a pin with external interrupt capabilities, that would simplify programming quite a bit. Many thanks!
In that case you wouldn't want the circuit's output to chatter at all, nor would you want the oscillations that tend to occur with comparators when their inputs are within a few millivolts of one another. In that event you'd want to add some hysteresis to the circuit-- a couple hundred kΩ between the output and VRH and a MΩ or two between the output and VM2B. If you need to filter out motor brush noise or whatever, you could try connecting a 10 nF capacitor between VM1 and VM2B.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
Ok, I've tested Danko's idea using a 100 µH choke, and this is the result:

It's a pretty good Idea. The inductor reacts to the motor's brushes as they switch from one contact to the next inside the rotor. And those spikes cease immediately when the motor stalls.

I'd just have to add a full rectifier to insure proper polarity, and feed the result to a comparator. Those spikes may or may not need to be clipped to protect the comparator, but that would only add a zener and a resistor to the circuit. The question here is if the duration of those spikes is enough for the comparator to reach and for the MCU to detect.

74d5797f-4336-43c3-83ea-5315b563994f.jpg
 

Danko

Joined Nov 22, 2017
1,297
Wow... many thanks, Danko. It it's any help, I measured 110 mA going into the motor when it ran at 6V unloaded, and 1.1 Amps when stalled.
See if your choke can not burns by 1A current.
1A current will lasting not more, than 2ms.
EDIT:
What is resistance of choke?
EDIT:
OK, 280 mOhm. Good.
 
Last edited:

Thread Starter

cmartinez

Joined Jan 17, 2007
7,686
Ok ... here's my take on the circuit I'm considering, based on your motor model, Danko:

1589597663182.png


The advantage I see, is that it consumes no power until the motor is energized. On the other hand, the MCU's input pin has an internal weak pull up resistor (I believe it's something in the order of 100k, but I'm not sure). Connecting things as shown would draw a very tiny amount of current through R11 ... but maybe if I configure said input as open collector then current draw would be effectively zero?

Another thing that drew my attention is the steady state of the to_MCU output during detection, even though I placed no capacitor in parallel to R11 !

Any comments?
 

Attachments

Top