• 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.

Transistor switch problem

Not open for further replies.


New Member
Dear all,

I am constructing a transistor switch which will use a TTL pulse generated from a computer to turn on and off a solenoid valve at the desired frequency.

The solenoid valves has a 2W rating and a requred pd of 24V. I have got a encapsulted 5W supply with a +12V and -12V and 0V outputs. However, when I put on the npn transistor and the emitter linked to the -12V rail and hook the base to the comp output which is either 0 or 5V. the transistor turns on no matter what base volt it is. I uderstand this is happening because there is already a 12V across the base and emitter to turn on the switch.

I tried offsetting this by uisng a differetial op-amp configruation with the inverted computer input (0 or -5v) and -12V as inputs. Therefore the base voltage would be -7 to -12V. However, I failed as the diff op-amp output will never be -12V as the power rail is at +/-12V and a lost is there.

Therefore, are there any solution which will solve this problem?
Thank you very much.


I think I understand what you are saying. How are you connecting the solenoid to the transistor. If you are using an independent power supply for the solenoid, and it does not have its 0 attached to earth ground, here is how I would do it. Choose R to limit the base current to 2mA or use optical isolation between your port and the circuit. If 2mA of base current doesn't give enough collector current, use a darlington to solve the problem. Depending on the load presented by your solenoid, you might need to heatsink the transistor. The diodes are needed to prevent the solenoid from backfeeding the circuit and burning your parts.



Active Member
Your power supply had +12V - GND -12V
Use the -12V as GND (connect everything GND to this, so also the pc GND) leave the real GND unconnected.

-12V of your supply is now equal to the GND level of your computer
So the +12V line will have +24V in reference with pc ground and you can use the transistor switch.


New Member
Thanks very much for you great advice.

I thought of connecting the -12V rail to the computer GND as well.
however, would i be in danger of burning anything within the computer outputs?

Just to give more information, I am using a National Insturments BNC external module which links to my laptop through PCMCIA and my computer signals comes out from this module.

Thanks again


You need to connect the ground on the bnc cable to the ground of the circuit I posted. As long as both supplies dont have their grounds tied to earth ground this is fine (and most likely they are not tied to earth ground).
Not open for further replies.

Latest threads

EE World Online Articles