Maker Pro
Maker Pro

Variation on the 5v -> 12v newbie question...

I'm making a simple electronic-transmission controller for my car, but
I seemed to have run into a problem. The basic idea is to control
three solenoids with a BASIC stamp. I've got everything working like
it should, but I'm having trouble on the output circuits to the
solenoids. Here's the problem: I need to send 12v out of the control
box and to the solenoid (they are grounded internally in the
transmission) with transistor switches. I can't for the life of me
however, figure out a way to send out 12v from the controller,
controlled with the 0-5v of the Stamp pins (doesnt matter if the Stamp
needs to switch high or low). I have the 12v available to me in the
controller, so its really a matter of switching the 12v in the box to
the solenoid 3 feet away. I guess what I'm getting stumped on, is that
with everything I try to setup, theres always a voltage drop from what
I want to switch (the 12v) to the base (0 or 5v, its always lower...)

Some specs:
solenoids, 10ohm
transistor im using (NTE11)- NPN, Hfe minimum of 230, max current
capacity 5A

Any ideas?

Thanks in advance...
 
L

Larry Brasfield

I'm making a simple electronic-transmission controller for my car, but
I seemed to have run into a problem. The basic idea is to control
three solenoids with a BASIC stamp. I've got everything working like
it should, but I'm having trouble on the output circuits to the
solenoids. Here's the problem: I need to send 12v out of the control
box and to the solenoid (they are grounded internally in the
transmission) with transistor switches. I can't for the life of me
however, figure out a way to send out 12v from the controller,
controlled with the 0-5v of the Stamp pins (doesnt matter if the Stamp
needs to switch high or low). I have the 12v available to me in the
controller, so its really a matter of switching the 12v in the box to
the solenoid 3 feet away. I guess what I'm getting stumped on, is that
with everything I try to setup, theres always a voltage drop from what
I want to switch (the 12v) to the base (0 or 5v, its always lower...)

Some specs:
solenoids, 10ohm
transistor im using (NTE11)- NPN, Hfe minimum of 230, max current
capacity 5A

That is going to be hard to use for a ground referenced solenoid.
Any ideas?

View with fixed-width font.
1K
___
.-|___|-o------o +12V
| |
| |< KSB834
o-----| (or other 1A,
| |\ Hfe>30, 60V)
|/ |
IN o-| 2N3904 |
|> o------o RELAY
| |
| -
.-. ^ 1N4002
| | |
130 | | |
'-' |
| |
'-------o
|
===
GND
(created by AACircuit v1.28.4 beta 13/12/04 www.tech-chat.de)

Adjust the 130 Ohm R if you do not have 5V CMOS drive.
The drive polarity is high input to energize the solenoid.
Thanks in advance...
Welcome.
 
B

Ban

I'm making a simple electronic-transmission controller for my car, but
I seemed to have run into a problem. The basic idea is to control
three solenoids with a BASIC stamp. I've got everything working like
it should, but I'm having trouble on the output circuits to the
solenoids. Here's the problem: I need to send 12v out of the control
box and to the solenoid (they are grounded internally in the
transmission) with transistor switches. I can't for the life of me
however, figure out a way to send out 12v from the controller,
controlled with the 0-5v of the Stamp pins (doesnt matter if the Stamp
needs to switch high or low). I have the 12v available to me in the
controller, so its really a matter of switching the 12v in the box to
the solenoid 3 feet away. I guess what I'm getting stumped on, is
that with everything I try to setup, theres always a voltage drop
from what I want to switch (the 12v) to the base (0 or 5v, its always
lower...)

Some specs:
solenoids, 10ohm
transistor im using (NTE11)- NPN, Hfe minimum of 230, max current
capacity 5A

Any ideas?

Yes, The transistor needs to be PNP (NTE12), because the solenoids are
grounded. And you need another NPN like 2N3906 to make a level translator.

12V PNP
o-----o------ -----------o
| \ v |
| --- |
| ___ | |
'-|___|-o |
10k | |
.-. |
| |560 |
| |0.5W |
'-' |
| 1N4001 |
INPUT | .---o
___ |/ | |_
o-|___|-o---| NPN - )|
4k7 | |> ^ )|
.-. | | ._)|
| | | '---o
10k| | | |
'-' | ===
| | GND
=== ===
GND GND
(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)
View/font fixed
 
C

CheapscateDave

Is it possible to just use relays with n/o contacts rated to handle
the current?
Dave
 
They have to switch pretty fast and I won't really have room. (and its
right next to the steering column--the clicking may be audible)

Larry and Ban-- thanks a lot! Those look a lot better than what I was
coming up with, I'll try em out!
 
J

Jonathan Kirwan

I'm making a simple electronic-transmission controller for my car, but
I seemed to have run into a problem. The basic idea is to control
three solenoids with a BASIC stamp. I've got everything working like
it should, but I'm having trouble on the output circuits to the
solenoids. Here's the problem: I need to send 12v out of the control
box and to the solenoid (they are grounded internally in the
transmission) with transistor switches. I can't for the life of me
however, figure out a way to send out 12v from the controller,
controlled with the 0-5v of the Stamp pins (doesnt matter if the Stamp
needs to switch high or low). I have the 12v available to me in the
controller, so its really a matter of switching the 12v in the box to
the solenoid 3 feet away. I guess what I'm getting stumped on, is that
with everything I try to setup, theres always a voltage drop from what
I want to switch (the 12v) to the base (0 or 5v, its always lower...)

Some specs:
solenoids, 10ohm
transistor im using (NTE11)- NPN, Hfe minimum of 230, max current
capacity 5A

I also wondered why, if you are trying to "send out 12v," you are then
trying to drive the solenoid with an NPN? That would be sending out
0V, when ON, right? Larry and Ban are right to point that out. But
I'm still curious why you were thinking NPN, here.

Second, I prefer Larry's arrangement to Ban's (mostly because I don't
think there is distinct benefit for the extra parts.) However, I
wouldn't use Larry's KSB834 because I can't get them from Digikey or
the hobbyist suppliers I checked.

I might use an STmicro STX790A, which is equivalent to the Zetex
ZTX790A. The STmicro part is less than half the cost of the Zetex and
readily available from Digikey (actually, both are.) But one of the
reasons also is that it is also going to have a very low Vce, even
with modest drive current.

Notes: When you apply the 12V to the solenoid, it's probably going to
take some 10s of milliseconds to rise up to the 1A or so you might
expect with the 10 ohms (V/L effect.) Similarly, it's going to also
be even slower to lose its energy, because using the diode will only
allow a small voltage across the inductor during turn-off. Finally,
there may be a bit of voltage "ringing"/oscillation at the PNP's
collector as the solenoid's inductance "fights" with the non-linearity
of the diode near the point where the inductor's energy is nearly
spent. And finally, I'm a hobbyist and not a designer, so take
everything I say in that vein.

Jon
 
L

Larry Brasfield

Jonathan Kirwan said:
On 25 Jun 2005 10:34:26 -0700, [email protected] wrote: [snip]
However, I
wouldn't use Larry's KSB834 because I can't get them from Digikey or
the hobbyist suppliers I checked.

Parts you can get are the best kind.

[snip]
Notes: When you apply the 12V to the solenoid, it's probably going to
take some 10s of milliseconds to rise up to the 1A or so you might
expect with the 10 ohms (V/L effect.) Similarly, it's going to also
be even slower to lose its energy, because using the diode will only
allow a small voltage across the inductor during turn-off.

That is a common misconception. When the solenoid having L = Ls
and R = Rs is turned on by applying Vs, its current begins ramping at
Vs/Ls A/S and asymptotically approaches Vs/Rs with an exponential
decay time of Ls/Rs. When the switch is turned off, the current begins
ramping down at (Vs+Vd)/Ls A/S (where Vd is the forward voltage of
the clamp diode, treated as constant) and asymptotically approaches
-Vd/Rs with an exponential decay time of Ls/Rs. The current not only
ramps slightly faster, it is headed for a value on the other side of zero.
So the current decay is definitely faster than the onset.

If such a circuit is slower to release the solenoid than energize it, the
reason is either dissymmetry between pull-in and drop-out voltages,
or an increase in inductance when the moving element is in the
energized position. The clamp diode should only be blamed for
not dropping the voltage as fast as would be possible by applying
a larger reverse voltage to bring the current to zero.

If you doubt this, I urge you to simulate it and study the result.
Finally,
there may be a bit of voltage "ringing"/oscillation at the PNP's
collector as the solenoid's inductance "fights" with the non-linearity
of the diode near the point where the inductor's energy is nearly
spent.

I have looked at lots of diole-clamped solenoids without seeing
such a thing. The circuit will certainly not support oscillation. The
usual appearance is a more rapid drop toward zero Volts across
the diode as its current approaches zero and its impedance goes up.

[snip]
 
J

Jonathan Kirwan

Jonathan Kirwan said:
On 25 Jun 2005 10:34:26 -0700, [email protected] wrote: [snip]
However, I
wouldn't use Larry's KSB834 because I can't get them from Digikey or
the hobbyist suppliers I checked.

Parts you can get are the best kind.

[snip]
Notes: When you apply the 12V to the solenoid, it's probably going to
take some 10s of milliseconds to rise up to the 1A or so you might
expect with the 10 ohms (V/L effect.) Similarly, it's going to also
be even slower to lose its energy, because using the diode will only
allow a small voltage across the inductor during turn-off.

That is a common misconception. When the solenoid having L = Ls
and R = Rs is turned on by applying Vs, its current begins ramping at
Vs/Ls A/S and asymptotically approaches Vs/Rs with an exponential
decay time of Ls/Rs. When the switch is turned off, the current begins
ramping down at (Vs+Vd)/Ls A/S (where Vd is the forward voltage of
the clamp diode, treated as constant) and asymptotically approaches
-Vd/Rs with an exponential decay time of Ls/Rs. The current not only
ramps slightly faster, it is headed for a value on the other side of zero.
So the current decay is definitely faster than the onset.

If such a circuit is slower to release the solenoid than energize it, the
reason is either dissymmetry between pull-in and drop-out voltages,
or an increase in inductance when the moving element is in the
energized position. The clamp diode should only be blamed for
not dropping the voltage as fast as would be possible by applying
a larger reverse voltage to bring the current to zero.

If you doubt this, I urge you to simulate it and study the result.
Finally,
there may be a bit of voltage "ringing"/oscillation at the PNP's
collector as the solenoid's inductance "fights" with the non-linearity
of the diode near the point where the inductor's energy is nearly
spent.

I have looked at lots of diole-clamped solenoids without seeing
such a thing. The circuit will certainly not support oscillation. The
usual appearance is a more rapid drop toward zero Volts across
the diode as its current approaches zero and its impedance goes up.

[snip]

I first admit I'm just a hobbyist on this score. But I didn't need to
simulate it, as I've seen it before. Damped oscillations in the 50kHz
range. I chalked it up to that non-linearity issue. But, of course,
I could be wrong.

So, I just simulated it. And there it is! The simulator seems to see
it, too.

Jon
 
J

Jonathan Kirwan

That is a common misconception. When the solenoid having L = Ls
and R = Rs is turned on by applying Vs, its current begins ramping at
Vs/Ls A/S and asymptotically approaches Vs/Rs with an exponential
decay time of Ls/Rs. When the switch is turned off, the current begins
ramping down at (Vs+Vd)/Ls A/S (where Vd is the forward voltage of
the clamp diode, treated as constant) and asymptotically approaches
-Vd/Rs with an exponential decay time of Ls/Rs. The current not only
ramps slightly faster, it is headed for a value on the other side of zero.
So the current decay is definitely faster than the onset.

If such a circuit is slower to release the solenoid than energize it, the
reason is either dissymmetry between pull-in and drop-out voltages,
or an increase in inductance when the moving element is in the
energized position. The clamp diode should only be blamed for
not dropping the voltage as fast as would be possible by applying
a larger reverse voltage to bring the current to zero.

If you doubt this, I urge you to simulate it and study the result.

I just did, and it shows something I didn't expect but also not what
you say above. The decay time appears to be quite similar to the rise
time. About twice as long, actually, for the decay as for the rise.
But not nearly as much longer as I suspected. I need to look more
into this.

Jon
 
P

PeteS

On the original issue, be sure to put a clamp of some description ( a
decent TVS rated below the max coil voltage of the relays) across the
12V input line.

Vehicle supplies are not 'clean' in any sense of the word (60V
transients on 'batt+' for instance). In the words of a Linear Tech app
note 'the power supply from hell'. A typical automotive power feed can
be expected to drop to about 4V during cranking and jump to between 50
- 80V during load dump.

I design automotive equipment in my current incarnation, and the main
power feed is one of my biggest issues (not only for the great power
feed, but also because I have to meet pretty tight standards on
conducted and radiated emissions into the power system from my
equipment).

Cheers

PeteS
 
J

Jonathan Kirwan

On the original issue, be sure to put a clamp of some description ( a
decent TVS rated below the max coil voltage of the relays) across the
12V input line.

Vehicle supplies are not 'clean' in any sense of the word (60V
transients on 'batt+' for instance). In the words of a Linear Tech app
note 'the power supply from hell'. A typical automotive power feed can
be expected to drop to about 4V during cranking and jump to between 50
- 80V during load dump.

I design automotive equipment in my current incarnation, and the main
power feed is one of my biggest issues (not only for the great power
feed, but also because I have to meet pretty tight standards on
conducted and radiated emissions into the power system from my
equipment).

Cheers

PeteS

I had heard these things and, in fact, had found a technical paper
detailing the ranges of behavior. Nasty.

However, this does beg a question. I don't know if the relays in
question are ones that are already normally in service in a car and if
the OP is just rewiring the control or if they are just picked from
the usual electronic stock. But if they are normally in use, don't
they already have to deal with this "unclean" supply?

(Of course, any electronic circuit would also need to deal with these
issues, so that would, at least, suggest the use of a PNP with a
larger Vceo capability, yes? As well as concerns about how the +5V is
actually generated in the OP's circuit?)

Jon
 
L

Larry Brasfield

Jonathan Kirwan said:
Jonathan Kirwan said:
On 25 Jun 2005 10:34:26 -0700, [email protected] wrote: [snip]
Finally,
there may be a bit of voltage "ringing"/oscillation at the PNP's
collector as the solenoid's inductance "fights" with the non-linearity
of the diode near the point where the inductor's energy is nearly
spent.

I have looked at lots of diole-clamped solenoids without seeing
such a thing. The circuit will certainly not support oscillation. The
usual appearance is a more rapid drop toward zero Volts across
the diode as its current approaches zero and its impedance goes up.

[snip]

I first admit I'm just a hobbyist on this score. But I didn't need to
simulate it, as I've seen it before. Damped oscillations in the 50kHz
range. I chalked it up to that non-linearity issue. But, of course,
I could be wrong.

Ringing, if it occurs, is due to a passive LC resonator with low
enough losses that the resonance is underdamped. The diode's
contribution is to simply add its capacitance to the (now open)
collector's capacitance. Once the diode begins to turn off, its
resistive impedance is high compared to the solenoid coil's.
While the diode capacitance happens to be non-linear, that
does not contribute to the fact of ringing; it merely alters the
shape of the waveform.
So, I just simulated it. And there it is! The simulator seems to see
it, too.

I do not doubt that such can show up in a simulation, where
the Q of the ersatz solenoid can be very high. With a real
solenoid, there is no effort made to preserve high Q. The
magnetic structures are typically solid metal with high eddy
current losses at the frequencies set by solenoid inductance
and stray capacitance, tending to spoil resonance.

This is a case where simulation should be regarded with a
lot of skepticism. A real solenoid should be consulted.

As I stated, I've not observed such resonance in real
solenoids. Perhaps, if I had looked more closely at
the region where the diode has just turned off, some
short lived, small ringing could have been observed. I
doubt the circuit Q would be high enough to justify use
of the term "oscillation".
 
L

Larry Brasfield

Jonathan Kirwan said:
I just did, and it shows something I didn't expect but also not what
you say above.

I also just did so, and it shows exactly what I say above.
The decay time appears to be quite similar to the rise
time. About twice as long, actually, for the decay as for the rise.

Then you are not measuring those times in a meaningful
way, or you have simulated something else.

With 18 mH and 12 Ohms, I see a 1% to 63% rise time
of 1.492 mS and a 99% to 37% fall time of 1.335 mS.
The initial current rise rate is 657 A/S and the initial current
fall rate is 698 A/S. Note that the ratio well reflects my
claim, with Vs = 12V and Vd = 720 mV averaged over the
relevant period. (698/657 = 1.062, (12+0.72)/12 = 1.06)

I chose 1% and 99% to ensure that transistor switching
was (mostly) completed, and 37% and 63% because of
their relation to the well known exponential decay time
and because they approximate pull-in and drop-out.
But not nearly as much longer as I suspected. I need to look more
into this.

Yes. If you have trouble sorting it out, you can post the
ASCII content of an LTSpice schematic.
 
J

Jonathan Kirwan

With 18 mH

I'm not using 18mH. I looked up on the web for automotive style
solenoids to get some idea and came up with something on the order of
50mH to 200mH. I will post my LTSpice schematic, if you'd like.

Jon
 
L

Larry Brasfield

Jonathan Kirwan said:
I'm not using 18mH. I looked up on the web for automotive style
solenoids to get some idea and came up with something on the order of
50mH to 200mH.

The size of the inductance hardly matters. Changing it
will only scale the waveforms in time. Their shape is
not affected except at a transistor switching timescale.
I will post my LTSpice schematic, if you'd like.

Before doing that, I suggest you state your criteria for
rise time and fall time. Be sure you saturate the switch.
 
J

Jonathan Kirwan

The size of the inductance hardly matters. Changing it
will only scale the waveforms in time. Their shape is
not affected except at a transistor switching timescale.

I'm not disagreeing with this. Just pointing out what I used and why.
Before doing that, I suggest you state your criteria for
rise time and fall time. Be sure you saturate the switch.

For a control signal I chose a rise time of 20ns and a fall time,
similarly. This is the actual times I have measured from a PIC, some
time back. Yes, the switches are saturated. In fact, I've also used
your values for the resistors, as well. As the PIC is, indeed, CMOS
these days, and since the drive current is in the low hundreds of uA,
the output voltage will be dropped by no more than about 20mV at the
output from the supply rail. I've also used that figure.

Jon
 
L

Larry Brasfield

Jonathan Kirwan said:
I'm not disagreeing with this. Just pointing out what I used and why.

I had guessed that you had some associated point to make.
For a control signal I chose a rise time of 20ns and a fall time,
similarly. This is the actual times I have measured from a PIC, some
time back. Yes, the switches are saturated.

The criteria I mentioned relate to how you define the times
you reported when you posted: "The decay time appears to be
quite similar to the rise time. About twice as long, actually ..."
That result is contrary to what a simple analysis will predict
and contrary to what a simple simulation shows. So I wonder
how you have derived those times.
In fact, I've also used
your values for the resistors, as well. As the PIC is, indeed, CMOS
these days, and since the drive current is in the low hundreds of uA,
the output voltage will be dropped by no more than about 20mV at the
output from the supply rail. I've also used that figure.

For that low an input drive, I would revise that circuit, probably
with a NMOSFET or Darlington in the first stage.
 
J

Jonathan Kirwan

I had guessed that you had some associated point to make.


The criteria I mentioned relate to how you define the times
you reported when you posted: "The decay time appears to be
quite similar to the rise time. About twice as long, actually ..."
That result is contrary to what a simple analysis will predict
and contrary to what a simple simulation shows. So I wonder
how you have derived those times.

Simply used the cursors in LTSpice. Quite easy to do and it reads off
directly.
For that low an input drive, I would revise that circuit, probably
with a NMOSFET or Darlington in the first stage.

I meant only that this is all the current that is actually used by the
NPN. A PIC can drive much more, as its high side impedance is along
the lines of 90-120 ohms and its low side impedance something a little
lower, perhaps 65-70 ohms. However, the circuit really doesn't need
that much, since the NPN's beta divides down the base drive to the PNP
by quite a bit. With a decent PNP, at a little more than an amp for
the collector current, the base really only needs some 50th of that (I
tried planning a variety of base currents based on /20, /30, /50, and
even /100, and the Zetex has a Vce of less than 0.2V across the range
of them. So the NPN collector really only needs to supply a little
more than that (just enough extra for the resistor to +12.) Divided
by its own beta, which because it is not operating saturated is rather
high, leaves very little need for base drive to the NPN.

Jon
 
L

Larry Brasfield

Jonathan Kirwan said:
On Sun, 26 Jun 2005 12:21:23 -0700, "Larry Brasfield"

The time has come for that, IMHO.
Simply used the cursors in LTSpice. Quite easy to do and it reads off
directly.

"Criterion" means some rule for deciding something.
What I'm asking is: How do you decide where to place
those cursors before you read off their time difference?
In another post, I mentioned the 99% to 37% fall time
and the 1% to 63% rise time. The criteria for how one
would measure those are evident. (I suppose I should
mention that they relate to current changes, not voltage.)
Your criteria remain a complete mystery. What precisely
happens between the start of your "rise time" and the end
of it? Repeat the question for your "decay time".

....
I meant only that this is all the current that is actually used by the
NPN. A PIC can drive much more, as its high side impedance is along
the lines of 90-120 ohms and its low side impedance something a little
lower, perhaps 65-70 ohms. However, the circuit really doesn't need
that much,

Ok, I misunderstood you.

--Larry Brasfield
email: [email protected]
Above views may belong only to me.
 
Top