rebeltaz 36 Posted January 10, 2015 Share Posted January 10, 2015 I am trying to toggle a set of LEDs. I have two pins left available to use, but I would really rather not use both for this one feature if I can help it. I'd like to have a spare pin left over in case I need it later. What I am trying to do is to drive the MSP output positive to select one set of LEDs and negative to select the other set. Will this work without burning out the output pin? Or will the MSP even be able to pull the PNP base to ground far enough to turn it on? Usually, when switching PNP transistors with 12v on the emitter, I typically switch an NPN with the MSP and use that to bring the base to ground, but obviously (or so it seems to me anyway) I can't do that in this situation. Thanks as usual Quote Link to post Share on other sites
abecedarian 330 Posted January 10, 2015 Share Posted January 10, 2015 Digital SPDT switch ADG752 maybe? Quote Link to post Share on other sites
enl 227 Posted January 10, 2015 Share Posted January 10, 2015 This will damage the port pin in the MSP430, and may destroy the device. On or off, the pin will be exposed to 12V- the BE drop. I will reference you to the input stage of TTL logic as the basis for the attached. The transistor acts to isolate the pin on the MSP430 from the high potential, but all base current for the PNP transistor will be sunk by the MSP430. Edit: misplaced resistor in original. Quote Link to post Share on other sites
rebeltaz 36 Posted January 11, 2015 Author Share Posted January 11, 2015 @@enl -> This is the circuit I am using in the rest of the clock to switch the common anode segment displays: It works, but I can't implement that with my idea of toggling positive and negative on the same pin. @@abecedarian -> I like that switch, but looking at the datasheet, it looks like I would still need to have it switch between two transistors (since it can't handle more than 50ma by itself or Vss (the switched voltage) higher than Vdd. And if I were to run Vdd high enough to allow switching of 12v, then I'd need to switch the input of the switch IC with another transistor... and this is just getting complicated! lol... It is beginning to look like the simplest solution is just to go ahead and use the two remaining output pins. Or, I guess even easier would be to just use a small SPDT mechanical relay. Thanks, though guys Quote Link to post Share on other sites
rockets4kids 204 Posted January 11, 2015 Share Posted January 11, 2015 http://www.w9xt.com/page_microdesign_pt12_hv_pnp_switching.html Quote Link to post Share on other sites
enl 227 Posted January 11, 2015 Share Posted January 11, 2015 The circuit I show enables the LED's when the input is pulled low. the npn switch to ground in your circuit is fine for enabling the LEDs when the output is high. Note the edit above Quote Link to post Share on other sites
rebeltaz 36 Posted January 11, 2015 Author Share Posted January 11, 2015 @@enl -> ah... I gotcha now. Can I ask why use the transistor instead of a rectifier, though? Thanks Quote Link to post Share on other sites
enl 227 Posted January 12, 2015 Share Posted January 12, 2015 transistor isolates the output from the MSP430 from the higher voltage. General electronics content: The npn transistor is off (no base current) until the emitter is significantly - about 0.3 or 0.4v - below the base voltage of 3.3v. Yes, the base-emitter junction acts as a diode, But the relevant part is the emitter current and the base current act as the control current for the collector in the beta gain model of a bipolar junction transistor. As the transistor turns on (when the emitter is pulled below the base voltage), current can flow from the collector to the emitter. The collector acts as a pure current sink (ideally) with an infinite impedance, which isolates it from the emitter and base. Effectively, the potential at the collector is hidden from the emitter and the MSP430 pin can't be damaged by it. The base current of the pnp transistor will pass through the npn transistor (out the emitter) and needs to be sunk by the MSP430 output. From the point of view of CURRENT, it is the same (in opposite polarity) as driving the LEDs with an non transistor as a ground-side switch. In this circuit, the npn transistor is solely acting to isolate, not to amplify. A rectifier won't do this. The potential at the emitter of the npn BJT can not be pulled higher than the base by the collector (unless the transistor is damaged...) if only a diode was used, there would not be isolation. (I will note that there are a number of ways to put a diode in this circuit instead of the transistor... none of them will provide the isolation, though some of them will provide the desired operation for at least a little while) Quote Link to post Share on other sites
grahamf72 169 Posted January 12, 2015 Share Posted January 12, 2015 Why not just do something simple like this Apologies for the rough drawing, it was with my finger on an iPad. When the MSP pin is high, the left transistor turns on, turning on the LEDs in its collector. This pulls the base of the left transistor down to below its turn-on voltage, so no current flows through its base, turning its LEDs off. When the MSP goes low, the left transistor goes off. Because it is no longer sinking the bottom of the 2k2 resistor to ground, current is able to flow through the 2k2 resistor and 47k resistor, through the base of the right transistor, turning it and it's LEDs on. Because the 2k2 & 47k resistors form a voltage divider, the voltage drop across the 2k2 is less than the forward voltage of the left LEDs, so no current flows through them, and they remain off. Sent from my iPad using Tapatalk dubnet 1 Quote Link to post Share on other sites
rebeltaz 36 Posted January 12, 2015 Author Share Posted January 12, 2015 Well, now that's just too darn simple, isn't it? lol.. I will try that. Thank you. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.