Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Design an adjustable voltage switch

Status
Not open for further replies.
I am tearing my (little that I have) hair out trying to get more symbols in LTsplice. That "pot" thing wouldnt show in the components list in "misc". There was only 1 POT sym in that zip file. It was just called "pot" and had about 694kb. Can you share with me where to get more libraries? I couldnt find any info on the website.

Stu
One pot symbol is all you need. You change the value and the percent rotation.once it's on the schematic.
Pot.asy is 699 bytes, pot.sub is 195 bytes.
Show us the complete path to each file on your computer (C:\program files\...).
 
I have only the one, but I do not have the 195byte .sub.

I have "pot" in c:/programs/LTC/LTspiceIV/lib/sub and again in/sym. Problem I guess is I am unable to unzip it for some reason. Says something about it being "empty" yet it has properties.

Stu

One pot symbol is all you need. You change the value and the percent rotation.once it's on the schematic.
Pot.asy is 699 bytes, pot.sub is 195 bytes.
Show us the complete path to each file on your computer (C:\program files\...).
 
OK here is a screen shot of the issues I have trying to open this "zip" file

Stu
 

Attachments

  • Pot Zip.jpg
    Pot Zip.jpg
    19 KB · Views: 165
Not sure why you're having trouble with Zip files. My computer recognizes them and apparently unzips them automatically.
Here's another way. Copy and paste the following to Notepad. Save it as pot.asy in C:\Program files\LTC\SWcadIV\lib\sym\misc.
Code:
Version 4
SymbolType CELL
LINE Normal 16 88 16 96
LINE Normal 0 80 16 88
LINE Normal 32 64 0 80
LINE Normal 0 48 32 64
LINE Normal 32 32 0 48
LINE Normal 16 16 16 24
LINE Normal 16 24 32 32
LINE Normal 40 64 64 64
LINE Normal 40 64 48 56
LINE Normal 40 64 48 72
WINDOW 0 36 32 Left 0
WINDOW 3 36 88 Left 0
WINDOW 39 36 128 Left 0
SYMATTR Value Rtot=10K wiper=.5
SYMATTR Prefix X
SYMATTR SpiceModel potentiometer
SYMATTR Description Resistor Potentiometer, must include potentiometer.sub
SYMATTR ModelFile pot.sub
PIN 16 16 NONE 0
PINATTR PinName A
PINATTR SpiceOrder 1
PIN 16 96 NONE 0
PINATTR PinName B
PINATTR SpiceOrder 2
PIN 64 64 NONE 0
PINATTR PinName C
PINATTR SpiceOrder 3
Copy and paste the following into Notepad and save as pot.sub in C:\program files\LTC\SWcadIV\lib\sub.
Code:
* This is the potentiometer
*      _____
*  1--|_____|--2
*        |
*        3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS
 
You should definitely have a regulator for the LM393 and the zener. I would use 8 volts. If you can get them, LM78L08 or LM317L (programmable) are good.
Change the zener bias resistor from 1k to 220Ω or 240Ω.
Automobile DC power can be very noisy, with high voltage spikes which can destroy a regulator.
Attached is one way to protect the regulator.
I'm not sure if the regulator will solve your problem, but it might.
 

Attachments

  • Car regulator.PNG
    Car regulator.PNG
    11.8 KB · Views: 208
WOOT~! That worked.

Thnks

Stu


Not sure why you're having trouble with Zip files. My computer recognizes them and apparently unzips them automatically.
Here's another way. Copy and paste the following to Notepad. Save it as pot.asy in C:\Program files\LTC\SWcadIV\lib\sym\misc.
Code:
Version 4
SymbolType CELL
LINE Normal 16 88 16 96
LINE Normal 0 80 16 88
LINE Normal 32 64 0 80
LINE Normal 0 48 32 64
LINE Normal 32 32 0 48
LINE Normal 16 16 16 24
LINE Normal 16 24 32 32
LINE Normal 40 64 64 64
LINE Normal 40 64 48 56
LINE Normal 40 64 48 72
WINDOW 0 36 32 Left 0
WINDOW 3 36 88 Left 0
WINDOW 39 36 128 Left 0
SYMATTR Value Rtot=10K wiper=.5
SYMATTR Prefix X
SYMATTR SpiceModel potentiometer
SYMATTR Description Resistor Potentiometer, must include potentiometer.sub
SYMATTR ModelFile pot.sub
PIN 16 16 NONE 0
PINATTR PinName A
PINATTR SpiceOrder 1
PIN 16 96 NONE 0
PINATTR PinName B
PINATTR SpiceOrder 2
PIN 64 64 NONE 0
PINATTR PinName C
PINATTR SpiceOrder 3
Copy and paste the following into Notepad and save as pot.sub in C:\program files\LTC\SWcadIV\lib\sub.
Code:
* This is the potentiometer
*      _____
*  1--|_____|--2
*        |
*        3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS
 
I have found what I need for the hysteresis. I have a circuit I just tested that was made by others (professional). ALthough I would love to just use it because it works, it is way too big. So after my testing this other circuit, it does not oscillate at all. When I bench test it at a 4.5v trigger, it drops to 3.65v. Best I can get on mine is from 4.5v to about 4.1v. Not enough. I am wondering now If it is even possible to get this large of a drop. By the way, the "range" for this circuit will never be below 4.0v. More like the range will run at 4.3v to 4.7v. Which it works great for this. If I can "lick" this 4.5v--> 3.65V drop it will work.

So I tried working this LTspice and I am stumbling a bit. Have to read more. I tried your math on calculating the hysteresis and stumbled there as well. So I hope I can figure this out, but if you have a quick suggestion for acheiving this hysteresis, i am all ears (-:

Stu


I got my EE in 1966. I retired in 2007. Two old farts.:D I would probably take out the cap and see if it still acts the same, but that's just me. You could also go by the old adage, "If it works, don't fix it.".

Hysteresis is calculated by simple math. It's just the change in voltage at the noninverting input when the output switches. In this case, first calculate the voltage swing at the comparator output. Since R6>>R5, you can safely ignore R6 for this calculation. The swing will be from ≈0V to ≈1.4V, or about 1.4V p-p. This gets attenuated by the network consisting of R6, R9, and the resistance looking into the pot wiper. The wiper impedance varies from zero to about 8k, depending on where it is set. Thus, your present hysteresis is approximately
Vh=1.4*((R9+Rpot)/(R6+R9+Rpot). This calculates out to be a range of 88mV to 150mV.
Actually, the circuit won't trigger when the wiper is at max voltage, but simulation shows Vh=152mV with the pot voltage at minimum, almost exactly what I calculated.
If you try to leave R9 at 10k, the change in pot resistance will cause your hysteresis to vary even more wildly if you lower the value of R6. That's why I suggested changing R9 to 100k.
 
I have found what I need for the hysteresis. I have a circuit I just tested that was made by others (professional). ALthough I would love to just use it because it works, it is way too big. So after my testing this other circuit, it does not oscillate at all. When I bench test it at a 4.5v trigger, it drops to 3.65v. Best I can get on mine is from 4.5v to about 4.1v. Not enough. I am wondering now If it is even possible to get this large of a drop. By the way, the "range" for this circuit will never be below 4.0v. More like the range will run at 4.3v to 4.7v. Which it works great for this. If I can "lick" this 4.5v--> 3.65V drop it will work.

So I tried working this LTspice and I am stumbling a bit. Have to read more. I tried your math on calculating the hysteresis and stumbled there as well. So I hope I can figure this out, but if you have a quick suggestion for acheiving this hysteresis, i am all ears (-:

Stu
Too much information here.:confused: What range do you want for the threshold when the input voltage is rising? How much hysteresis do you want? Or do you want the threshold to drop to 3.65V, independent of the rising threshold?
 
Too much information here.:confused: What range do you want for the threshold when the input voltage is rising? How much hysteresis do you want? Or do you want the threshold to drop to 3.65V, independent of the rising threshold?

OK.... My Vset will always be from 4.5 to 4.7v. No less, no more. The Vsrc (sensor) range is from 3.0v to 5.v.
Now, assuming a Vset at 4.5v I need a hysteresis of 3.65 once it has triggered. This is a critical bottom threshold to acheive. If not, it will oscillate (loop)
What happens, is when it triggers at 4.5v, the Vsrc immediatly drops to 3.7v. (just the way it is)
So all my previous circuits do not have this great of hysteresis range for my Vsrc drop. So it was going to a "loop" cycle. 0n-off-on-off-on. I want it t go on and stay on until I start over (back to car idle)
 
OK.... My Vset will always be from 4.5 to 4.7v. No less, no more. The Vsrc (sensor) range is from 3.0v to 5.v.
Now, assuming a Vset at 4.5v I need a hysteresis of 3.65 once it has triggered. This is a critical bottom threshold to acheive. If not, it will oscillate (loop)
What happens, is when it triggers at 4.5v, the Vsrc immediatly drops to 3.7v. (just the way it is)
So all my previous circuits do not have this great of hysteresis range for my Vsrc drop. So it was going to a "loop" cycle. 0n-off-on-off-on. I want it t go on and stay on until I start over (back to car idle)
The definition of hysteresis is a delta (change in) voltage.
With a Vset of 4.5V, do you want it to drop to 3.65V? And if Vset is 4.7V, do you want it to drop to 3.85V?
 
The definition of hysteresis is a delta (change in) voltage.
With a Vset of 4.5V, do you want it to drop to 3.65V? And if Vset is 4.7V, do you want it to drop to 3.85V?

With a vset at 4.5v I do not want the circuit to go "off" until the Vsrc has gone below 3.7v. I will always keep the 10K pot at this desired Vset (ref). To answer the question, if I "raise" the Ref Vset to 4.7v, do I still want the 3.65v?. If possible, yes. I do not know if this is possible being this requires a greater drop? Basically, it appears that no matter what Vset I choose, it will always drop to 3.65v. which is why when I select a real low Vset (ref) if starts to not loop because the 3.65 gets closer to the Vset.
 
I still don't understand.
With the threshold set at 4.5V, when the sensor voltage reaches 4.5V, what voltage do you want the threshold voltage to drop to?
With the threshold set at 4.6V, when the sensor voltage reaches 4.6V, what voltage do you want the threshold voltage to drop to?
With the threshold set at 4.7V, when the sensor voltage reaches 4.7V, what voltage do you want the threshold voltage to drop to?
 
Last edited:
I still don't understand.
With the threshold set at 4.5V, when the sensor voltage reaches 4.5V, what voltage do you want the threshold voltage to drop to?
With the threshold set at 4.6V, when the sensor voltage reaches 4.6V, what voltage do you want the threshold voltage to drop to?
With the threshold set at 4.7V, when the sensor voltage reaches 4.7V, what voltage do you want the threshold voltage to drop to?

ALL Above need to be at a threshold drop of 3.65v. I assume making the 4.7v at 3.65v, the other lower 2 will fall into the same range.
 
ALL Above need to be at a threshold drop of 3.65v. I assume making the 4.7v at 3.65v, the other lower 2 will fall into the same range.
So, independent of the threshold voltage, you want the relay coil current to go off when the sensor voltage goes above the threshold voltage, and stay off until the sensor voltage drops below 3.65V. Am I interpreting this correctly?
I know I sound stupid, but you and I don't interpret electronics language exactly the same way, and i hate spending a lot of time designing something, only to find that I misunderstood the specs.
 
So, independent of the threshold voltage, you want the relay coil current to go off when the sensor voltage goes above the threshold voltage, and stay off until the sensor voltage drops below 3.65V. Am I interpreting this correctly?
I know I sound stupid, but you and I don't interpret electronics language exactly the same way, and i hate spending a lot of time designing something, only to find that I misunderstood the specs.

YES SIR~! EE to dumb EE ha..ha.. that is exactly what I want.

BTW, if your interested in seeing the circuit that "does" work, I can send it to you as a PM. It is too elaborate and more universal. Hence why I prefer to make mine simpler and more specific.
 
YES SIR~! EE to dumb EE ha..ha.. that is exactly what I want.

BTW, if your interested in seeing the circuit that "does" work, I can send it to you as a PM. It is too elaborate and more universal. Hence why I prefer to make mine simpler and more specific.
OK, I looked at the PDF you PM'ed. Have you noticed that it is very similar to your circuit? If you add the voltage regulator, which I recommended, it is even closer. You could get rid of the zener if you add the regulator.
 
I will eventually add that into the final design ONCE i figure this damn drop voltage I need. Any luck or ideas so far? Did you note the 1M in-line resistor after the Vref? There resistance for hysteresis is from the 1M pot. I should take that pot out and read it's resistance. I suppose I could copy there 2 values. But it is enough different, that may not be all in the equation.

Stu
 
I will eventually add that into the final design ONCE i figure this damn drop voltage I need. Any luck or ideas so far? Did you note the 1M in-line resistor after the Vref? There resistance for hysteresis is from the 1M pot. I should take that pot out and read it's resistance. I suppose I could copy there 2 values. But it is enough different, that may not be all in the equation.

Stu
I'm working on it. I've been busy on other stuff today. I might get back to it tomorrow afternoon.
 
OK, here's what I came up with. I'm hoping you aren't using the other half of the LM393 for anything. I used it so we can get full output swing on the first one, making the hysteresis easy to attain. If the other section is not available, there are other possible solutions.
I think you were trying to build this with parts on hand. Let me know what you don't have. If it is not difficult to get parts, I recommend the values shown - except for the 2N2222, which might be susceptible to CE breakdown due to spikes on the car's battery rail. Something like 2N5550 would be much better. A small MOSFET could also work, which would also eliminate the need to use the 2nd half of the LM393.

The adjustment labels probably look like they are swapped, but they are not.
 

Attachments

  • MAP switch1 sch.PNG
    MAP switch1 sch.PNG
    42.2 KB · Views: 187
  • MAP switch1.asc
    3.8 KB · Views: 148
Ron,

Thanks for spending time on this. I am well aware of ones "spare time"

If you go back to the beginning of this thread, these components were given to me by various people. I think Eric might have been the guy who rec'md the 2N2222.
I will use my own 8V Vreg, or the one posted a page back. (Although not sure why I need an adj one.)

I think using both sides of the LM393 is just as good. A MOSFET would require adding in another component which takes away board real estate.

I am going to start over and make all new boards. I will order any new stuff from digikey. So if you feel that other components are worth changing, LMK and I will order those as well.

Please verify components:

U1 = POT 1K?
U3 = POT 500K? (adj Hysteresis )
LM393 Vcc = 8V ? ( I assume since you have an "8" below the Vreg symbol.

Lastly, I do not see any Zener's here. Does this new design eliminate them? Since adjusting the Vsrc is so limited for my usage (4.0 to 4.7 range)

Lastly, this new circuit above, is it totally complete? I ask because the configuration on R1 and R2 is different than my original that has caps and Zener's to the left.

Stu
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top