Connect with us

Using pnp and npn transistor as 1 pole 2 throws switch

Discussion in 'General Electronics Discussion' started by Esteban, May 24, 2015.

Scroll to continue with content
  1. Esteban

    Esteban

    15
    0
    May 24, 2015
    Hi!

    So I'm doing a small project it is a 4 bits DAC with a R-2R resistor ladder, what I have to do is to control the 4 outputs from the resistor ladder with 4 electronic switchs which are controlled by a microcontroller.

    Each switch must have 2 throws, one must be connected to ground, the other throw must be connected to a sum node, and it must have 1 pole so only one throw can be connected at the time.

    I'm using a bc327 bjt pnp transistor and a bc547 bjt npn transistor, both of them have its base connected to the same microcontroller bit output, the μC 4 bit sequence its a simple counter (0 to 15), the idea is simple: 4 outputs of the μC will be connected to 4 pairs of pnp and npn transistor.

    What I 've done is that when the μC sets a 0 on one output, its respective pnp will be close and its respective npn will be open, also when the μC sets a 1 (5V) on the same output, its respective pnp will be open and its respective npn will be close.

    I checked the logic with a pair of transistors, a pair of 100kΩ Rb for both bases , a LED and a 330Ω Re (for the pnp) and another led and 330Ω Rc (for the npn).

    So its almost working, I mean that when the μC sets a 0 on the bit output, the led from the pnp transistor is on and the led from the npn transistor is off. When the μC sets a 1 on the bit output, the led from the pnp transistor is weakly on and the led from the npn is completely on.

    What it means is that the pnp is not completely open when I put a 5V on its base, I'm supplying the leds with a 6V battery and the idea it's ok for a simple on-off leds, but it's a big problem since the R-2R ladder works currents smaller than 0.5 mA.

    Is there a way to make a pnp operate as a completely open switch?

    [​IMG]
     
    Last edited: May 24, 2015
  2. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    It's because you have 6 Volts for your power supply and the PIC is running, I hope from 5 Volts. When the PIC pin goes to 1, there is not enough voltage to turn the transistor fully off.
    Thanks
    Adam
     
  3. Esteban

    Esteban

    15
    0
    May 24, 2015
    Thanks Adam for answering!, how much voltage do I need to turn the transistor fully off? is it depends on the power supply voltage or just the type of transistor?
     
  4. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    You need to match the supply voltage ideally. So running from 5 volts will work. If you need a higher voltage for the load then you will have to add some more transistors that are running from the same supply as the PIC so they can switch the transistor connected to the higher voltage.
    Thanks
    Adam
     
    Esteban likes this.
  5. Colin Mitchell

    Colin Mitchell

    1,417
    313
    Aug 31, 2014
    Just do this:
    84sove-1.gif
     
    hevans1944 and Esteban like this.
  6. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    That's a good idea Colin. You may have to change the resistor value to change the brightness of the LED because this circuit will draw a few mAs less than the original design. But it may not be an issue.
    Adam
     
  7. Esteban

    Esteban

    15
    0
    May 24, 2015
    Can you tell what is the difference on changing the led position?
    Regards.
     
  8. Harald Kapp

    Harald Kapp Moderator Moderator

    11,307
    2,588
    Nov 17, 2011
    Putting the LED into the emitter leg of Q2 will drop additional voltage across the LED which in turn reduces the effective voltage at Q2's emitter. Therefore now the 5V from the PIC a re sufficient to turn Q2 off.
     
    Esteban likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-