Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

transistor switch problem

I am trying to switch a solenoid for an air valve (130 mA current req'd) using the digital output of my USB-6008 DAQ Card. I am using a PNP transistor to control the 12V source needed to drive the solenoid. I got the switch to work properly using a 5V voltage source for the base, but when i hook the base up to the digital output I get no activity. From what I understand about PNP transistors, current should flow through the collector and emitter when the base is grounded and should cease when a voltage is applied. I checked current levels through the base, and they are well below 25mA for the digital port. Are there limitations to the digital ouputs that prevent this switch from working? Would I be better off using an NPN transistor? Thank you for your help,
 
-Kevin
Kevin
UTHSC-Houston
0 Kudos
Message 1 of 6
(4,822 Views)
You should never connect the base of a transistor directly to a voltage source. It is much better to use a series resistor connected between the transistor base and the voltage source.

Which resistor value to choose? You should know about the beta value (current amplification) of the transistor, Usually this value is well beyond 100 for small-power transistors. Now divide the current the relay will consume by this value and you will get the base current needed to de-saturate the PNP transistor. Select the resistor such that there is will be a minimum voltage of around 0.8V (also referred to as base threshold voltage) when this current flows through the resistor.

Does the card you use for control have an open-collector output or a TTL (AKA push-pull or totem-pole) output? And if it has an open-collector output, does it have a pull-up resistor on the output? This resistor would act like the series resistor above, and if it is too high base current will be limited, i.e. the transistor will not be completely desaturated. In case it is a TTL level output keep in mind that in most cases these outputs are guaranteed to rise to 2.8V only (actually they usually go up to more than 3V in most cases). Calculate the resistor value such that you still have the base threshold voltage.

Resistor value is not critical in this case since the beta values of transistors have large tolerances. To make sure the transistor works you can select 1/2 the calculated value. But you should use a resistor in order not to destroy the transistor by excessive base current.
0 Kudos
Message 2 of 6
(4,819 Views)

Thanks for the reply,

I did have a resistor to limit the current. In fact I was very wary of connecting the transistor circuit until i was sure that the current was below the maximum levels.

I believe the usb-6008 has TTL logic, and I read 5 volts from the meter when I turned the digital port to "on".

In the end, I changed my transistors to an NPN type(still using the resistor in series), and the switch works fine. Very little current is needed from the digital output, and it barely comes up on my meter when the switch is activated.

Kevin
UTHSC-Houston
0 Kudos
Message 3 of 6
(4,807 Views)
You should also include a reverse-biased diode across your solenoid coil, a 1N4001 should suffice, to snub inductive transients generated by the coil when it is switched off. Not using one may eventually destroy the transistor and/or DAQ card.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 4 of 6
(4,803 Views)
Oops... forgot to mention this. For low-power relays a 1N4148 will be sufficient, they work fine in many of our applications.
0 Kudos
Message 5 of 6
(4,793 Views)
When driving circuits with higher voltages than 5V you should take care that the higher voltage does not damage the control system in case of driver failure. In case of catastrophic failure of the driver transistor 12V will be present at the control system output and very probably will damage it.

In these cases I use photo-MOS relays (such as the AQV212 from Matsushita) as driver and isolator. They can be driven by any TTL output directly and switch several hundreds of mA.
0 Kudos
Message 6 of 6
(4,792 Views)