Another blog about transistors. As before, a quick qualification: this isn't teaching material, I'm just experimenting and following

my curiosity where it might lead. It's all a bit ad-hoc and spontaneous - if I did it again it would be more organised, but then we'd

lose the experimental flavour.


I'm going to repurpose the board I used for the switching experiments. This time the load will be a small solenoid I found in a box of

old bits. It measures 53.16mH, 54.4ohms with the plunger partly out and 62.66mH, 54.3ohms with the plunger in. The inductance varies

because the plunger forms part of the magnetic circuit. It says "5V d.c." on the side, but I'm going to run it on 8V - with a

resistance of 54 ohms that will be a current of 150mA which the 2N3904 can manage. It's only going to be energised for short periods

(one second or less), so it can easily cope with the excess dissipation. I'm sure you all know where I'm going with this - when you

first read about the transistor as a switch, you usually get told that switching inductive loads can destroy a transistor and that's

what I'm setting up here.


Here's the circuit.




You can see I'm starting with a 1N4148 signal diode to provide the protection for the transistor. The part can handle the initial

150mA easily and it's fast, it can switch in under 4nS, so it won't have any problems catching the coil voltage as it goes up.


Here's the board (another example of my award-winning photography - I won't tell you what the award was or where it came from).

[Just realised that this shows the board from later on when I'd swapped to three zeners. Never mind.]




and the solenoid




And here's the sketch for the Arduino that is producing the switching waveform.


void setup() {
  DDRB =DDRB | 0x10;

void loop() {
    PORTB |= 0x10;
    PORTB &= ~0x10;
    while(1) {


This time it's simulating a monostable. It waits a while, takes the input high, waits a while, takes the input low and then sits there

and twiddles its thumbs. The scope is set to trigger on the falling edge so I can see what happens when the transistor turns off,

interrupting the current flowing, leaving the poor solenoid with a whole load of energy in its magnetic field that it has to dispose

of. Here's a trace showing the collector waveform - the trigger is coming from the input wavform on the other channel which isn't

being displayed. This trace is slightly embarrassing because you'll notice that just before the trigger point, where the transistor is

on, the transistor isn't quite bottoming. Basically, I don't have enough base current and that's because the DC current gain (beta or

hFE on a datasheet) falls considerably at higher collector currents but, without thinking, I've just chosen the kind of base resistor

you'd use at a collector current of 10mA where you know the gain will be at least a hundred. I'm just going to leave it because it

doesn't make any real difference to what I'm doing.




Anyway, what's going on when the transistor turns off? The top end of the solenoid coil is anchored to the positive rail, the bottom

end is now free and no longer clamped to ground by the transistor. The coil has to, somehow, keep the current flowing and it does that

by raising the voltage at the free end until the current does flow. It will be very aggressive about it and fast. Aggressive in that,

if you could magically make the transistor just disappear, it would break the air down to achieve a path. Nature won't accept a step

change in a magnetic field that's created by a current flowing in a wire. In this case, when the voltage gets to a diode drop above

the supply rail, the diode becomes forward-biassed and starts to conduct the current. The energy in the coil is then dumped into the

supply rail (which, hopefully, is well enough decoupled that it doesn't move around too much).


Now for a slight change. This time, instead of the diode across the coil, I've used a zener diode to catch it.




I've actually used three 12V zeners in series [since that was what I had to hand], which will clamp at about 36V. It could have been one 12V

zener; this is for illustration so we can see the way the coil lifts the voltage and how fast it is but without the transistor

breaking down (Vceo max is 40V). This time the energy is being directed to ground, which might be an advantage if you were switching

several solenoids simultaneously and didn't want all that disturbance to the positive rail (as long as your ground was nice and solid,

of course).




Here in a bit more detail




I don't think that the tail afterwards is energy from the coil, I would imagine that it's the zener and transistor capacitance

gently discharging from the 36V.


The zeners clamp nice and cleanly (the coil is only trying to keep the 150mA going, so they're not hit in the way a TVS diode

would be trying to clamp a large transient).


Now, finally, I'm going to throw caution to the wind, remove the protection components and let the transistor have a go.




This was my first go. I haven't got the scales right, not knowing what to expect, but it does show that the situation is messier than

with the zeners even though the collector breakdown is, in theory, an avalanche effect and I would have expected it to look something

like the zener case.




Above is the start in more detail [initial breakdown is around 80V] - and what's evident is that I've created an oscillator. I suppose it's a 'relaxation oscillator' in

form. The transistor avalanches, the voltage comes down, the coil ramps it up again, and it repeats. It's running at about 5MHz.

Essentially, the avalanche gives us a negative resistance which can support oscillation. That was unexpected, but really neat.




Here it is on a longer scale (the raggedness is aliasing of the scopes sampling). After about a millisecond the coil's energy is dissipated and it

finishes. Amazingly, the transistor survives all this abuse. I'm pretty sure it would fail if I made it repetitive, though.


Finally, to get a different view of the initial breakdown, I removed the solenoid and substituted a 39uH coil (ESR  0.8ohms) in series

with a 47ohm resistor. This produces this trace




and we can see that here the initial breakdown is about 65V.Neither is the BVceo figure (Breakdown Voltage collector-emitter base open),

because that would be measured with no base drive and at a lower current, but they show how the transistor behaves in a real situation.


Well, that was a bit chaotic and disorganised - just as well I'm not a teacher. Since pictures seem to be the order of the day, have a

doodle - this is two canine engineers, leaders in their field (yard?), discussing transistor characteristics in front of the latest in IoT kennels.