Switching a relay with a transistor for 12V LED red light - Page 1
Forum section: electronics / beginners

author: originalscottyg
author_rank: Newbie
timestamp: June 27, 2016, 08:47:40 pm
content: Noob alert... please be niceI am trying to switch on a red "On Air" light (12V LED strip) using the GPIO Tally outputs of a popular audio console. The idea is that when the talkback mic is on, the "On Air" light turns on so the clients know when the talent can hear them. The console's documentation on how to use the tally outputs are fairly vague, saying only"All tallies are open collector pull down using 47R series resistor". The console's tally output is a logic signal that goes high when switched on. I have measured the voltage on this output using a Fluke 177 and it measures about 0.585V when switched on, referenced to the 0V pin on the console's multi-pin GPIO connector. I was advised by the manufacturer to use a transistor to switch a relay to supply the 12V to the red light. So far so good.Below is the circuit that I've wired up on a proto-board.Unfortunately it doesn't work.When I originally asked the question to the manufacturer, I was using a 1K base resistor, because that's what I saw in sample circuits that they had sent me. Their response was"...So, if you need to sink 40mA through the collector and you're sending half a volt to the base, referenced to the LED supply negative, try a 12 ohm resistor in place of the 1K. You could probably just remove the resistor all together with the same result...."This seems strange to me because the datasheet for this 2N3904, which is one of the ones that they recommended, shows the turn-on voltage starting at 0.6V and rising from there depending on various parameters. My thought is that the 0.585V that the console is putting out is not enough to exceed the turn-on voltage for the transistor, so no base current is flowing and therefore no collector current is flowing and the relay isn't switching. When I connect this circuit to a bench supply at home and feed the base with 0.7V or more, the circuit seems to work fine. I did try several value of base resistor and I tried bypassing the base resistor and sending the 0.585V from the console directly to the base.Am I correct in thinking that the voltage coming from the console is too low to turn on the transistor? Is there a way to make this work using the existing voltage from the console (0.585V)?Also, just to clarify, the 12V supply is a SMPS "wall wart" type that measures quite high ?19VDC unloaded. Not sure if this affects the operation of the transistor.Thanks for the help!

author: rstofer
author_rank: Super Contributor
timestamp: June 27, 2016, 09:06:03 pm
content: Because the output is 'open collector', it is only capable of pulling a voltage down. It does not pull the transistor base up. It also doesn't provide voltage which is what your circuit requires.So, assuming your output circuit can withstand 12V, use a 1k Ohm resistor to pull the base up and let the open collector pull it down directly. Of course, this is logically backwards in that the open collector pulls the base down when it logically needs to rise. You could reverse the contact connections on the relay but this is ugly.You can use a PNP transistor. Connect the emitter to +12V and connect the collector to one side of the relay coil and the other side of the coil to ground. Connect a 10k resistor between the base and 12V and a 1k resistor between the base and the open collector output.The 1k resistor could be larger if I knew what transistor you were using and how much current the coil took.Like figure 8.2 here:http://www.w9xt.com/page_microdesign_pt8_pnp_switching.html

author: danadak
author_rank: Super Contributor
timestamp: June 27, 2016, 09:09:39 pm
content: When you want to use a transistor as a switch, drive it into saturation,the rule of thumb is to supply Ib = Ic / 10, so if you want 100 mAin the collector then supply 10 mA to the base and the output shouldstay in saturation.The high output of .585 V is very marginal to turn on the 2N3904,one usually uses (at room temp) .7 V as Vbe turn on. You need to findout from manufacturer what the voltage source looks like , the .585,is it low Z out or high. Stated another way how much current can it deliverat that V ?The whole thing sounds fishy to me, eg. an active high that can only generate.585 V. If thats the real case you might gave to use a RRIO OpAmp / Comparatorto get an adequate drive source for the 2N3904.Regards, Dana.

author: danadak
author_rank: Super Contributor
timestamp: June 27, 2016, 09:13:05 pm
content: If its open collector with a pulldown R then its probably a PNPpulling to the supply rail to generate the high voltage. Or aMOSFET or.....manufacturer should show in its datasheet whatthe interface signal path looks like.Its also odd that the pull down is 47 ohms, the manufacturermust think energy costs nothing. There is something we do notunderstand about this output.Regards, Dana.

author: originalscottyg
author_rank: Newbie
timestamp: June 27, 2016, 09:31:47 pm
content: Thanks for the responses! I am a sound re-recording mixer and I have no electronics background whatsoever, aside from some light reading. So I'm a bit out of my depth here.The general circuit configuration is what was recommended to me by the manufacturer of the console. They sent me a sample circuit (that I can tell they pulled directly from google) that I have attached below.I also attached the page of the manual that has the pinouts of the GPIO connector, and the notes regarding the "open collector" configuration. I am using Pin 10 "TB All Tally" and Pin 2 0V, as can be seen in my original schematic. I am using the TB All Tally outputs because they are switched on with the talkback switch, and not the "Red Light Relay contacts", as those are not tied to the talkback and are actuated with a separate switch.Thanks again for the help!!

author: originalscottyg
author_rank: Newbie
timestamp: June 27, 2016, 09:37:39 pm
content: Quote from: rstofer on June 27, 2016, 09:06:03 pmThe relay and transistor are external to the console, with the console's tally output is feeding the base of the transistor. The 12V supply is an external SMPS that is powering the transistor and relay, as well as the supply for the red light. The console's 0V pin is referenced to the negative side of the external 12V supply. The transistor is 2N3904, the relay coil takes 37.5mA and is 320 ohms coil resistance. I am not sure what the note about the open collector pulldown is referring to in the console's manual.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: June 27, 2016, 10:03:41 pm
content: QuoteYep. I'm wondering what kind of logic system uses 0.585V for a "high" logic state.hint:rstofer said:Quote

author: MatthewEveritt
author_rank: Unknown
timestamp: June 27, 2016, 10:17:32 pm
content: Quote from: danadak on June 27, 2016, 09:13:05 pmI read it as meaning a transistor (npn) pulling down with \$47\Omega\$ in series between the connector and the collector for protection.Quote from: alsetalokin4017 on June 27, 2016, 10:03:41 pmSounds about right for bipolar open collector with no load.

author: rstofer
author_rank: Super Contributor
timestamp: June 27, 2016, 10:20:50 pm
content: Quote from: MatthewEveritt on June 27, 2016, 10:17:32 pmThat's the way I read it. Some kind of open collector arrangement like an NPN transistor with a resistor in the collector to prevent overcurrent.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: June 27, 2016, 10:25:48 pm
content: QuoteAnd where does this voltage come from? The collector is open, except it is pulled down to ground by the 47R, no? And the emitter is grounded, no?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: June 27, 2016, 10:34:50 pm
content: Quote from: rstofer on June 27, 2016, 10:20:50 pmThis makes sense because the open-collector circuit is generally used to _sink_ current rather than to source it, isn't it? Turn the transistor with the open collector on and it provides a path to ground through the emitter. So the example circuit provided to the OP by the technician is not correct for this application.

author: MatthewEveritt
author_rank: Unknown
timestamp: June 27, 2016, 10:42:49 pm
content: Quote from: alsetalokin4017 on June 27, 2016, 10:25:48 pmIf it were a pull down resistor then you're right, there would be no voltage (0V), but that's not what I think is happening. I've attached a picture of how I think the output works. EDIT: Looks like you found one already.Note that in neither picture is there a resistor pulling the output directly down to ground.Honestly I'm not entirely sure why this happens (but I am sure that it does). What Ithinkhappens is that the output is very weakly pulled high by the diode between the base and collector (the imperfect diode leaks a little current), and the action of the 'on' transistor can only pull down to about 0.6V as it has its own bandgap to contend with.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: June 27, 2016, 10:56:50 pm
content: Why call it a pulldown resistor then? Here's what I think is happening. I think rstofer nailed it.The 47R is a pulldown resistor between the 'open collector' and ground. It forms one half of a voltage divider. The other half is the external pull-UP resistor connected from the positive rail to the base of the external switching transistor, and that pulls the base of the external switching transistor UP (and relay coil on) when the console logic output state is LOW. When the state goes HI, the open-collector transistor shorts the 47R, which allows the base of the switching transistor to go low, turning the relay coil off.So why is it "ugly" to use the NC contacts of the relay instead of the NO to switch the LED?

author: MatthewEveritt
author_rank: Unknown
timestamp: June 27, 2016, 11:09:32 pm
content: Quote from: alsetalokin4017 on June 27, 2016, 10:56:50 pmThey don't, they call the transistor an open collector pulldown, and then say that it has a series resistor. No mention of pulldown resistors or pullup transistors.

author: rstofer
author_rank: Super Contributor
timestamp: June 27, 2016, 11:14:20 pm
content: I didn't mean to imply that I thought the internal 47 Ohm resistor went to ground, I meant that it probably was in series with the collector to limit the current. Of course 47 Ohms and 12V is still a lot of current 256 mA.I don't like using the NC contacts because this would mean the relay was energized when the sign was off - and vice versa. If that's ok with the OP, it works for me!We still don't know how much current the relay takes and lacking that, we are just stumbling around trying to size the base resistor.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: June 27, 2016, 11:25:05 pm
content: Quote from: MatthewEveritt on June 27, 2016, 11:09:32 pmAh... OK, I see now that I was misinterpreting the phrasing, thanks. But even so, the system still appears to be designed to sink current rather than to source it. So this still means that the circuit provided by the console manufacturer's technician is incorrect for this application.So you'd use the NPN switch circuitry that rstofer described (which I'm too lazy to draw out on my "DaveCAD" at the moment) and the NC contacts of the relay.Quote from: rstofer on June 27, 2016, 11:14:20 pmSure, means 3 Watts dissipated in the series resistor, which surely isn't right, you can't apply 12 volts directly to the Pin 20. But the current will be limited by the external pullup resistor in your circuit.QuoteIt would seem to be the simplest solution...QuoteActually the current is specified as a bit under 40 mA.

author: MarkF
author_rank: Super Contributor
timestamp: June 27, 2016, 11:36:13 pm
content: I would test the output by putting a 10k resistor from the output pin to 12V and measuring the output pin voltage when it's turn on and then off.Assuming it's an open collector to GND, the driver could look like the attached circuit.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: June 27, 2016, 11:51:54 pm
content: Makes sense. Eliminates the relay. Simple!(But do we have a PNP transistor on hand?)

author: originalscottyg
author_rank: Newbie
timestamp: June 28, 2016, 08:30:25 pm
content: Hi all. Thanks for all the responses!!It will take me a little while to go through them and digest the info, most of which is a bit over my head at this point.A few updates...I took my circuit home and put it on my bench last night to double check it. It works perfectly when I feed it appropriate voltages from my bench supply. The transistor turns on at about 0.6V to the base, and reaches saturation at about 0.7V, pulling about 40mA through the relay. When I have the voltage to the base just slightly below 0.6V, to simulate the 0.585V that the console is putting out, the transistor stays in cut-off and the relay doesn't switch.It is possible that the console is just not putting out the correct voltage. I did have to replace one of the power supplies late last year, so it is possible that something is just broken.Also, I haven't heard back from the tech at the manufacturer. I thinks it's fair to let him have a chance to respond before I jump to any conclusions. I just find it strange that he implied in his previous response that this circuit should be able to work with half a volt on the base.Thanks once again to everybody that responded. I'll take some time when I get home from work to try to wrap my head around all the ideas posted and of course I'll let everybody know how things turn out.

author: originalscottyg
author_rank: Newbie
timestamp: July 01, 2016, 02:56:49 pm
content: Hi everybody,Thanks again for all the input. Turns out the manufacturer had given me some incorrect info initially. The circuit I built worked perfectly on the bench but not with the console because it is the wrong circuit for this application.Quote from: alsetalokin4017 on June 27, 2016, 10:25:48 pmThis seems to be the correct internal configuration of the console's open collector output. The tech told me that the 0.585V that I was measuring was most likely a voltage drop across my DMMs internal resistance.So all I need to do is connect my relay and diode between my external power supply and the tally output (collector of internal transistor). Hopefully I'll get a chance to test this out later tonight after all my recording sessions are done.I attached a new schematic of how I plan to hook this up.Thanks!!