Tristated output to two common Base transistor issue


Closed Thread
Results 1 to 40 of 55

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938

    Default Tristated output to two common Base transistor issue

    Hello,

    I have to power automotive LEDs that drain 50mA.

    I use twenty LEDS and have a 16F630, so my circuit connects two LEDs to 1 I/O port and I use the Z state to switch them OFF.

    To make this without destroying the PIC, I use transistors like this (one port example):
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1965&stc=1&d=118901631 5">

    Problem: when I have set the port direction to Input (=Z state), both LEDs still light; less than normal, but still enough to make this look not good.

    The SMD transistors have built-in 22k resistors like this (the PNP one has same connections):
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1964&stc=1&d=118901608 9">

    I tried to add 1k resistors at each Tr's Base, but... still the same.

    Is there a way to sort out this issue?

    NB: how do I put text beside the images???
    Attached Images Attached Images   
    Roger

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Hi, Roger

    Supposing your leds are 5v powered ...

    inserting 3x "1N4148" in series in EACH "base" connexion, AND two resistors ( equal high value ) to set "third state" output to V+/2 ...

    that should work !!!

    Alain

    PS: dis, tes montages tordus ..., tu vas les pècher où ??? ... LOL !!!
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Can the circuit be simplified?

    Is there a special reason that each LED must have its own transistor driver? And that one is PNP while the other is NPN?

    Have you considered using one transistor to drive two LEDs in series? (Two LEDs in series use the same 50 mA of current!) It would reduce your parts count a lot.

    Is there a special reason for setting the output pin to high-Z (input) to turn the LEDs off? (Are you then using the pin as an input?) Have you considered leaving the output pin as output, adding a pull-up (or pull-down) resistor, and simply toggling it high and low?
    Last edited by RussMartin; - 6th September 2007 at 00:50.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  4. #4


    Did you find this post helpful? Yes | No

    Default Your circuit is fundamentally flawed

    With no PIC or any other drive, the PNP and NPN transistors are both turned ON by each other and the two series resistors (not shown) which are inside the cases. If you used regular PNP and NPN without intrinsic series resistors the circuit would instantly blow up two transistors.

    IF the LED supply is the 12 volt auto battery things get worse. The PNP is always conducting because its base is at either 0 or 5 volts while the emitter is at 12 volts. The PNP base sees either 7 or 12 volts drive so it is always ON.

    A rethink is needed.

    HTH
    Brian
    Last edited by BrianT; - 6th September 2007 at 01:43.

  5. #5
    Join Date
    Aug 2007
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    I would think some diode isolation with a pull-up on the PNP base and a pull-down on the NPN base. Something along those lines anyway.

  6. #6
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Lightbulb

    I assumed on the basis of information given that the LED supply is 5 VDC:

    50 mA (current through LED) x 47 ohms (current-limiting resistor) gives a voltage drop of 2.35 VDC.

    Here is what Brian is trying to tell you:

    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1971&stc=1&d=118905553 3">

    R1a and R1b are built into Q1; R2b and R2a are built into Q2.

    As wired, the built-in 22K resistors create a voltage divider, shown in the circuit above. Brian is not quite correct in saying that "the PNP and NPN transistors are both turned ON by each other" (they are not), but he is right about the effect of the intrinsic resistors. When the input (at B) is in a high-impedance state (Z), the voltage at A is 3/4 of +VDC, at B, it is 1/2 of +VDC, and at C, it is 1/4 of +VDC.

    In other words, if +VDC is 5 volts, and the pin connected to B is high-impedance (Z), the voltage at A will be 3.75 volts, at B 2.50 volts, and at C 1.25 volts. The voltages present at A and C will keep the transistors turned partly on, which sounds like the problem you described.

    The effects of a logic high (nominal +5 VDC) or a logic low (nominal 0 VDC) at B I will leave as an exercise for those who are curious.
    Attached Images Attached Images  
    Last edited by RussMartin; - 6th September 2007 at 06:49.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

Similar Threads

  1. Help changing CCP3 output pin
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2008, 02:30
  2. Bit Banging input to output on PIC16F876A
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th June 2008, 19:50
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 14:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts