# Design an adjustable voltage switch

Discussion in 'General Electronics Chat' started by stuhagen, Sep 27, 2008.

1. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
Bipolar transistors (NPN, PNP) are off when no base current flows. They are on when sufficient base current flows. The base-emitter junction looks like a diode. When Vbe (base to emitter voltage) is less than ≈0.7V, the transistor will be off, and no current will flow from collector to emitter. In your circuit, the base voltage of the 2N2222 is approximately at 0V when the comparator - input exceeds the + input, due to an internal NPN at the output of the LM393 which diverts the current through R8, the 3.9k resistor, to ground. When the + input exceeds the - input, the transistor internal to the LM393 will turn off, allowing the current through R8, to flow into the base of the 2N2222. The base voltage will rise to ≈0.7V, and ≈1.87mA of base current will flow ((8V-Vbe)/3.9k=1.87mA). This current will get multiplied by the transistor current gain, saturating the transistor (Vce(sat)<0.2V). This will energize the relay.
So - for the second section of the Lm393, when the + input > - input, the relay is energized.

2. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
OK then this makes sense. I was'nt sure about whether the transistor was on or off when the base was at 0.7 or 0.0

I want to simplify what you have said, mostly because I think you were only talking about one side of the comparator.

On U2 (pin 2&3). When Pin 2 (-) is low to vset, then Pin #1 is 10v. Then Pin 5 (+) will be high (10v) in referance Pin 6 (-). (Divider shows Pin 6 at 4v). So then Pin 7 output is 0v. This means the 2n2222 base voltage is 0v. So the relay is off.

If I switch Pins 5&6...then Pin 5 (+) will now be Low 0v to Pin 6 and then Pin 7 will be 10v. This will drive the 2n2222 base voltage to 0.7v this triggering the relay.

Did I get it right?

Stu

3. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
Why are you talking about 10V? The schematic says 8V. If you try to use 10V, the circuit may not work unless the engine is running (alternator is spinning). I know that this is generally not a problem, but will you ever want to test the circuit when the engine is not running?

When pin 2 is low, and you have swapped pins 5 and 6, pin 5 will be at 4V, and pin 6 will be ≈8V. Pin 7 will be at 0V, and the relay will be off.
When pin 2 goes high (4.7V), pin 6 will be 0V, pin 5 will still be at 4V, so pin 7 will go open circuit to GND. This allows R8 to source current to the base of the 2N2222, energizing the relay. The base voltage of the 2N2222 will be ≈0.7V.

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0

Perfect. Sorry about the 10v thing, I wasnt paying attention. This answers ALL my questions. (-:

Stu

6. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Did I mess up? Or is this in error. In your post #112 Does U2b that is unused need to have the (-) pin go to GROUND? Or to 8V?. You show 8v here, but my final post #124 I show (-) going to ground. My proto boards are in and I have both Pins on U2b (5 & 6) going to ground. oops?

Stu

#### Attached Files:

• ###### Boost Circuit 2.asc
File size:
3.8 KB
Views:
159
Last edited: Jul 9, 2010
7. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
Check out post #114 (or read this):
Actually, it will work either way.

8. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Pfew...that's good. Maybe I knew that anyways~!

9. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Just tested the final unit and it works perfectly. Although I had no 200K resistors, so I used a 220K and it didnt seem to cause any issues. It doesnt "re-trigger" anymore.

I have a question. If I wanted to modify this a bit so it triggers down lower, like 2.8v to 3.2v range, what R values would you recommend for R6, R9? I would like to keep the 2 pots at the same value since I have 10ea of those (if possible). I am going to test this somewhere else. The trigger voltage there is more of a "switch" type. It runs at 2.0v then jumps straight to 4v. So I am picking something in the middle as the trigger volt.

Stu

File size:
3.8 KB
Views:
129
10. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
How much hysteresis will you need? Better yet, what should the threshold voltage drop to when the unit "fires"?

11. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Well, the voltage is very stable at 2.0v with little to no variance. Then the ECU sends a flat 4.0v signal at a specific engine rpm level, not a ramp up voltage, to trigger an internal function. So as long as the hysteresis doesnt go below 2v then I guess it really doesnt matter. I would be concerned it I use like 3.7v on the high side, or like 2.3 v on the low side becuase that's pretty close. Once the circut triggers, I would guess that a .5v hysteresis is sufficient. When the system goes back, it immediately drops from 4.0v to 2.0v. This signal is not linear. Almost like a switch. Hence why I was thinking around 2.8 to 3.4 or something with a .5v hysteresis.

Stu

12. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
With a digital input from the ECU, you shouldn't need hysteresis, or any pots. A simple comparator with a 3V threshold should be fine.
Are you driving a relay, or a VSV? Should the load (relay, vsv) be energized or deenergized when the input is high?

13. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Yes, I want this circuit to be in the "off" state at 2.0v. More for fail safe so if the circuit fries, I will maintain the "stock" configuration, When it sends the 4.0v trigger signal, I then want to drive a typical 30A relay. Then the relay will switch over to an aftermarket high volume Fuel Pump. When the 4.0v voltage then drops to 2.0v the relay will de-energise, which puts the car back to standard operation. A simple voltage divider as a referance would probably work out the best. I was trying just modify these new boards I had made with changing a part here and there. Hence why I asked about the R values. I had 10 proto boards made for the above circuit so I have extras to play with.

Stu

Last edited: Jul 14, 2010
14. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
Is the schematic of your board posted? If so, which post #? If not, please post it here.

15. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
This is the circuit I was using for awhile. But it has failed on me. It also wasnt doing what I wanted. I think. I wanted the relay to be de-energized at the 2.0v operation. As I remember, I had to swap Pin 87/87a on the relay because It was opposite of what I wanted. I am revisiting this because of all the new knowledge I have gained on hysteresis. As you can see in this schematic, there wasnt any components for it. So the circuit was oscillating at transition. I thought it was due to a snubber, so I added that. However, it did work for awhile, but I ditched it cause it was un-reliable. Now I want to re-visit the design and try again.

Stu

File size:
91 KB
Views:
170
16. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
My plan was to show you how to modify your most current board:
If you want to modify the board you posted in your previous post, we can try that. If you want to modify your most current board,
Let me know what you want.

17. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
My plan was to "modify" the Most Current board here. NOT the one I just posted. That one stinks ha..ha..

Stu

18. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
Hopefully, the third time's the charm:

19. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Just use Post #148 as the one I want to modify. "Boost Circuit 2" This is the one I want to use as many parts as possibly, or similar to, to achieve my new request in Post #152

20. ### RoffWell-Known Member

Joined:
May 16, 2003
Messages:
7,757
Likes:
89
Location:
Idaho, USA
OK, this should work. It sets the threshold at 3V, with no hysteresis.

File size:
26.8 KB
Views:
220
21. ### stuhagenMember

Joined:
Aug 13, 2008
Messages:
209
Likes:
0
Cool, that makes things simple. Do you happen to know anything about the LM2917 Frequency to Voltage converters? They are suppose to be able to take Tacho signals and convert it to a linear voltage output. Another project I am trying. It is the same as these types here, but using RPM signal for triggering rather than the map sensor. The attached is from another guy in the car tinkering business. I wasnt quite able to convert this to a standard 8-Dip 2917. I think all the components will work for my usage except I wanted my range more like 3000-6000rpm range.

Stu

Stu

File size:
87.5 KB
Views:
156
File size:
13.8 KB
Views:
175