# help regarding simple comparator

Discussion in 'General Electronics Chat' started by devalvyas, Nov 11, 2008.

1. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
i am new to using comparators and have been trying a simple circuit to understand comparator. I have put the following circuit on a circuit board.

I have a 741 ic 8-pin version which i am using as comparator. I am using 6 volts from 4 AA size battries, with +vcc connected to pin 7, and -Vcc to pin 4. I have connected output pin 6 to +vcc with a 10k resistor. I am measuing the voltage between output and ground ( pin 6 and pin 4 respectively) using voltmeter.

I have shorted the inverting input pin-2 to ground (pin4)

when i measure output it shows 5.4 volts dc.

now i am giving a +3 volt to non-inverting input pin-3. positive lead of two aa size battery to pin -3 and negative lead to ground.

nothing happens.

Now in apply reverse voltage i.e. -3 volts to pin -3, still nothing happens and the output hardly changes by 0.1 or 0.2 volts.

am i going wrong somewhere.

I tried the same thing thing using LM-339 comparator still i get the same results.

I am basically trying to build a circuit which will tell me when a small voltage is generated.

2. ### mik3 Senior Member

Feb 4, 2008
4,846
63
Can you post a schematic to see where you are wrong?

3. ### Audioguru New Member

Dec 20, 2007
9,411
896
A lousy old 741 opamp is spec'd with a 30V supply. Some won't work if the supply is less than 10V. Your supply is only 6V.

The datasheet of the 741 opamp shows that its inputs must be at least 3V above the negative supply (+3V minimum in your circuit) and at least 3V less than the positive supply (+3V max in your circuit) so you had the input voltages too low and one was negative which might have destroyed the opamp.

The datasheet shows that the output voltage of the 741 opamp will be between +1.2V higher than the negative supply (ground in your circuit) and 1.2V less than the positive supply.

The LM339 should have worked fine in the circuit except the negative input voltage might have destroyed it.

4. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
The LM324 is a good choice, as it goes between 3VDC and 35VDC on the power supply. It is a quad op amp.

You could also use two 9V batteries. Most op amps are happier with dual power supplies.

The LM339 is a true comparitor. You MUST have a pull resistor on its output for it to work though, but it will go down to 2V on the power supply.

Last edited: Nov 12, 2008
5. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
Thanks a lot for the information.

I will again experiment and let you know.

Actually the overall purpose of the circuit is as follows:

I am trying to build a circuit which will detect the slightest movement in a small dc motor and activate it for say 0.5 to 1 second.

I have a 6 volt dc motor. Since motor also acts as generator, I am using it as a sensor to detect small clock wise movement. If the motor moves clockwise slightly, it will generate voltage say around 0.1 to 0.5 volts.

This voltage will be compared with the ground voltage by comparator. As soon as the voltage rises above Zero, even by 0.1 volt, the comparator will give output. This output will go to a triggering circuit of 555 timer.

The output of the 555 timer will in turn further move the motor in the same direction for 0.5 to 1 second.

Any movement in the reverse direction of the motor will generate negative voltage. I plan to clamp this voltage by using a forward biased diode between the motor and the comparator.

The schematics is as follows: Attached File: Triggering circuit for 555 with opamp1.JPG

VS4 is 6 V DC motor. Movement in CW direction gives +ve voltage. When +ve voltage is applied by 555 timer, it further moves in CW direction

Am I right in my approach? Is there any better way of doing it? Which comparator ic should I use? will LM 339 do?

File size:
35.6 KB
Views:
61
6. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
Sound doable to me. You will need some sort of disable to keep the 555 from retriggering the comparitor which retriggers the 555 in a closed cycle, but other than that it is a plan.

The LM339 will work well in this application, it is basically a digital gate on the output. While the inputs are linear, the comparitor definately isn't.

Q1 and the rest isn't really needed (remember, the LM339 is a gate), but you will need some minor bias circuitry to keep the comparitor firmly off when the motor isn't turning.

You'll probably need a transistor to drive the motor, do you know what the current it requires?

Last edited: Nov 12, 2008
7. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
You are right. I tried running the motor and the 555 is re-triggering itself. Its not supposed to do so as i have used a triggeing circuit. Once the motor starts running, the output of the comparator will not change unless it stops.

The trigger circuit of R2, R3 and C1 will only produce pulse when the out put of the comparator (which is input to the trigger circuit) changes. And here the o/p does not change once the motor is running.

But apparently thats not happening.

Also, I have tried to replace the comparator with a simple npn Transistor (BC547) with common emitter configuration. The emitter at ground, the collector as the output and the base receiving the input from motor. HEnce a small voltage at base of the transistor will essentially close the switch and trigger the rc-network. The schematics is attached in the file: Triggering circuit for 555 with transistor.JPG

WHEN I STIMULATED THE SAME CONFIGURATION BY USING A BATTERY SOURCE IN PLACE OF MOTOR, i.e. i just connect a 3 volt battery to the base-emmiter and the out put is perfectly fine. There is no re-trigger even if i keep the 3 volt battery connected for quiet some time.

however when using the motor the re-trigger problem remains.

Question is that when the 555 is triggered, the input of the comparator/transistor switch gets the full output voltage (about 5 V). As per me that should not affect the operations as the comparator/transistor switch is already into saturation or closed, hence applying any more voltage to the transistor should not change the output.

Kindly let me know your views on the same.

One more question. IF i repeatedly try to trigger the 555, it misses some trigger points. I.e. i tried to trigger the 555 via the above circuit, for some 8 times in a row. It triggerd for 4 times then the next two times it did not trigger. then when i tried after couple of seconds again, it triggered. Why is that happening? Is the RC triggering circuit not working well?

I do not know the The current drawn by motor. But it powered by 4-aa size battries. I beliver the current should be not more than 300-400 mAmps.

File size:
36.3 KB
Views:
35
8. ### Audioguru New Member

Dec 20, 2007
9,411
896
As I explained before, a 741 opamp will not work in this circuit.

Your comparator doesn't have a power supply.
Its 10k load resistor R3 is correctly connected to +6V in your text but it is wrongly grounded on your schematic.
The 555 is not grounded.
The VS4 pot will short the output of the 555 and cause lots of smoke.
The clamping diode D2 must clamp the negative input voltage to -0.3V or less for an LM339 so a voltage divider must be used to reduce the voltage from the diode to the input of the LM339.

9. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
You will probably need another 555 to provide a dead time after the first one times out to allow the motor to spin down. For what it's worth I've been putting some thought into this. If you need some help or ideas I'd be willing to sketch some ideas out.

I don't know how you'd beat having the motor spin down as a requirement. It might be possible to sense the current the motor is using to tell if it is spinning under its own power or not.

Do you have a measurement on what the current the motor requires in current under it's own power?

One advantage of the quads, they offer the option for extra circuitry without any extra solid state parts.

I suspect you have your capacitor drawn an the wrong side of the buss, as AGuru says the 555 can't work without a ground.

10. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
Dear Bill, kindly let me know your views on the subject.

I have re-drawn the circuit and posted it in file: 555 and trigger circuit.JPG

I believe the drawing is right now.

But when i test it i still have the problem of re-triggering.

To test the circuit, i used the dc motor as generator and connected it only to the input (Vref). i used an led connected to output of 555.

The circuit works perfectly fine as designed. i.e. when i manually move the motor to generate some voltage the 555 triggers for specified time.

But moment i connect the feedback from output of the 555 back to the motor, the problem of retriggering starts. when i manually move the motor, to generate some volts, it triggers the 555, and motor starts running with higher speed. BUT IT DOES NOT STOP.

Kindly give your views on this.

File size:
23.6 KB
Views:
38
11. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
OK, several questions though, do you actually have 2 batteries, or are you using the same battery for both sides? You may need some filtering there.

The root problem as I see it is spin down, the motor is generating enough noise that some of the pulses are retriggering the monostable. You need to kill the monostables input while this happens. Give me a little while to redraw the schematic and I'll throw some ideas out.

12. ### Audioguru New Member

Dec 20, 2007
9,411
896
The amplifier transistor does not have a base series current-limiting resistor so it is blown up.
DC electric motors have a mechanical commutator that powers one winding, disconnects it then powers another winding, disconnects it then powers another winding etc. So of course the 555 is triggered over and over when the motor is running (if the amplifier transistor survived).

13. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
I was thinking about this on the way to work. You don't just want to sense when the motor is moving, you want to sense it's rate of change (moving, but with acceleration). The AAC eBook has an experiment dealing with this.

I'll be back with the schematic ideas in a bit...

14. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
OK, here are the redrawn schematics. AudioGuru is right, if you've run it with this schematic you've probably damaged some parts, Q1, and possibly U1 if it was connected.

The solution for the motor running and Q1 shorting is the same. I picked the values for C6 and R5 arbitrarily, you may want to play with the values.

Q2 is required to buffer between U1 and the motor. Since 555 is a hard connection to either power supply it will tend to short the signal from the motor.

Let me know if it works. I have some other ideas, but I think this will do it.

File size:
4.7 KB
Views:
48
15. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
At the onset, thanks a lot for giving your valuable feedback.

I was doing some de-bugging and trying to solve it piece wise. So i did the following.

1. I am using only once power source, 4 batteries of aa SIZE, making a total of 6 volts (around 5.5 to 6 actually).

2. I added an additional transistor at output of 555 to drive the motor load.

3. To start the debugging i removed the motor and started checking the basic circuit. The schemetics is posted in file 555 and trigger circuit test.JPG

4. To start the debugging, i am closing the swith momenterially to give input trigger to 555 through a trigger circuit.

5. If i check the out put without connecing it to the motor driving transistor q1, the output behaves as designed, ie. the out put is monostable pulse of designed time. the led D1, when gounded, glows for designed time.

6. but the moment i connect the output to base of transistor q1 to use it as a switch which is supposed to drive the motor load, the out put continuously become high, i.e the load LED D2 never shuts down. This happens even if the input is not connected or there is no trigger signal. Can you let me know why?

its like the transistor Q1 is pulling the output of 555 and not allowing it to go back to zero again. I believe his must be the reason why the motor is continuously running.

File size:
35.4 KB
Views:
25
16. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
Dear Bill, i believe i have used the same circuit for debugging, taking your advice of another transistor ofcource...!!!

but the problem is that once the output is high, the load transistor is not allowing it to go down...

17. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
Dear Bill, i think its working at the de-bugging stage, without connecing the motor. I was connecting the load at the collector side and it was not working, but the moment i connected the load (led+resistor) at emitter side, its working well now...the output of load transistor q1 is following designed timing...will connect the motor now and post the responce

18. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
Ummmm, I messed up a bit. C6 is backwards. Here is the revised schematic.

I was hoping to fix it before you noticed...

File size:
4.7 KB
Views:
51
19. ### devalvyas Thread Starter Active Member

Nov 11, 2008
80
0
yup..its working. Any idea why it did not work when i put the motor in collector side but worked when i put the motor at emitter side?

Also, the speed of the motor is not there as required. i mean without the feedback, the motor is rotating at full speed, but with the feedback, the speed is very slow. Its however rotating for the designed time pulse of 555.

Kindly suggest.

20. ### Wendy Moderator

Mar 24, 2008
20,772
2,540
The 555 has a darlington output going high, and we have another transistor in series. We are dropping around 2.1 volts through all the various base emitter junctions. Suppose that might contribute? I have some ideas on how to fix this, but for now it is bed time. One thought occurs, you could replace the 555 with a CMOS version, but it would have an incredably weak output. If the draw from the transistor/motor is low enough it won't matter.

I'll get back with you.