Switching idea

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Hmm, it might be more sensible to ensure that the Vin is always going to be +ve, then I could get away with a normal comparator instead of a window comparator.

Is there such a device that can leave a +ve voltage alone, but change a -ve voltage to a positive one?

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
An inverting opamp can have a negative input voltage on its input resistor, and the negative feedback through its feedback resistor causes its output to be positive.
The circuit can't have much gain to avoid having the opamp's input from becoming negative.

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Wouldnt an inverting op-amp cause any positive voltage on the input to change to negative?

The Vin for the circuit is from the sense resistor from one leg of the motor H-bridge. Depending on what the motor is doing, it could be positive or negative.

If it's positive, it needs to stay positive. If it's negative, it needs to be inverted.

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
An inverting opamp with only a positive supply will have a positive output voltage with a negative input voltage and its output will be close to ground with a positive input voltage.

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
So if the inverting opamp receives a decent +ve input, then it will still only be close to ground for the output?

Have you had any experience with absolute value circuits? I think thats what I need, so I can preserve the value of the input (regardless of whether its positive or negative).

That way I can set up current limitations for forward, reverse, forward regen and reverse regen on the motor.

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
A absolute value circuit is a full-wave rectifier that uses two opamps. Usually one of the opamps needs negative and positive supplies.

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
STOP THE PRESS!

How about this setup? Would you care to pass your eyes over this please.

Trigger7.png


According to my theory (which we've established is a bit shakey), this should act as an absolute value comparator, which switches high (and turns on the LED) when the absolute value of Vin is greater than V ref.

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
I think the 1st opamp should have the diode across it removed to allow its output to protect its input from going too negative. Then your absolute value circuit will do what you want. You made some good thinking. ;D

Except:
1) The LED won't light because the CTRL input of the Cmos doesn't use any current.
2) Nothing pulls the CTRL input of the Cmos to a logic low.
3) Whether it lights or not, the sum of the output saturation voltage of the 741 opamp plus the LED's voltage drop creates a logic high voltage that is too low to reliably control the Cmos.
The problems are solved if you uas a separate transistor to drive the LED. Then the output of the 741 opamp can connect directly to CTRL and the high-value resistors in a voltage divider that drive the transistor won't load down the output of the opamp.

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Trigger8.png


How does that look.

Removing the diode across the 1st op-amp isnt going to mess up it's gain is it?

How does that transistor/diode setup look?

I put the pull down resistor on the output to pull the CTRL of the Cmos to low when the comparator is off.

I also put the feedback on the comparator to latch it on, but I'm not sure if I've done it properly.

I know this sounds a bit dumb, but could you explain how you think this circuit will work please?
 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Whoops. Made a few mistakes in that last one. This one should be better

Trigger9.png


If i'm correct, the switch should stay off while the absolute value of Vin is above Vref. Once Vin drops below Vref, the comparator should switch on, thus turning on the switch and lighting the LED. The comparator should stay latched on after that.

Will a reset of the system be achieved by cutting power to it all?

Does that look and sound correct now?

I figured I dont really need to stop Vin from being too negative, since I will use an LM4558 dual op amp which has +/- 15v on the inputs.

My only question is whether the circuit will allow a negative value on the 1st inverting op-amp since it has no negative supply rail. Should I perhaps connect PIN 4 of the dual opamp to a -ve supply?

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
Hi Mr. Heckles,
I was incorrect about the 2nd diode. It is needed to prevent the input of the 1st opamp from going negative. I added it but removed a few parts from your schematic to see its operation clearer.

Your Schmitt trigger has the outputs of two opamps shorted together. Which one will win?
It need a resistor from pin 7 of the 2nd opamp to pin 3 of the 3rd opamp. It also needs a resistor from pin 6 of the 3rd opamp to its pin 3.

The 10k pull-down resistor isn't needed. Opamp outputs are driven to within a volt of the supply with low loading.

View attachment 38148

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Hows this look

Trigger10.png


I wasnt sure what values to put on the resistors you mentioned, so I took a punt on 1k for both.

Are the op-amps going to be able to produce negative voltage output, even though there is no negative supply?

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
You are right. The 1st opamp must have a negative supply.
Philips had a little stereo power amplifier that was like two LM386's in one. Since its inputs could have a negative voltage, it could do what you want without a negative supply.

EDIT:
My text wiped out a resistor. It is re-installed.

View attachment 38150

 
Last edited by a moderator:

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Right then. One negative supply coming up.

Can you have a +12v and a -5v supply into one op amp? or do they have to be equal?

Is the comparator set up correctly so that it will latch on?

Thanks for all your help audioguru, got big plans for christmas?

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
MrHeckles said:
Right then. One negative supply coming up.

Can you have a +12v and a -5v supply into one op amp? or do they have to be equal?
A -5V negative supply severely restricts the range of input and reference voltages. Use -12V.
The 741 opamp has a limited input common-mode voltage range so it should also have a negative supply.

Is the comparator set up correctly so that it will latch on?
My analysis shows that it will work fine. Isn't its operation backwards?

Merry Christmas in a few hours. My family is getting together to feast on a huge turkey here. ;DView attachment 38151

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
I keep getting confused by these bloody op-amps and comparators and what constitutes "on" and "off".

I wanted this to have the transmission gate turn on when the voltage in was less than the reference voltage, and then latch on. And to have the transmission gate off when the voltage in was higher than the reference (assuming it hasnt already been latched on). How would I set this up?

We've still got a day or so to go before christmas. Whats with you northerners and turkeys? We tend to stick with the variety of meats, chicken, ham, beef, maybe some lamb too.

 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
I was driving along on a hot summer day and saw a huge farmer's field full of snow.
Snow on a hot day in summer??
I got closer and saw millions of white turkeys. So many that they were holding each other up.
I got a nice big one and froze it for Christmas.

I've inverted the comparator for you. Play with the 1k resistors to make it latch.

View attachment 38155

 

MrHeckles

Jul 31, 2005
117
Joined
Jul 31, 2005
Messages
117
Thanks again for all your help, i'll have a go at building it all and see how it works.

Thats a whole lot of turkeys. I thought they were normally black anyway?

 
Top