3 different inputs to trigger one output

Discussion in 'Automotive Electronics' started by stillgrowingup, Jul 15, 2015.

  1. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    Hi all

    I am wanting to build a module that can be controlled by 3 different inputs.

    This will be used in my car to supply a 12vdc (13.8vdc max) 10 amp output to my aftermarket electronics.

    I have stated that there are 3 inputs. BUT only ONE input out of the 3 will be used during the life of this circuit. I do not know which style of input will suit my needs till I actually try this in the real world. So I am wanting to prepare for worst case scenario and be ready to use ANY of the inputs to activate my 10 amp output relay, as indicated on my diagram.

    I also will be using the negative 1 Amp 12vdc ground output to power up to 2 external standard 12v relay for the life of this circuit.

    I have a 3 pin selector jumper to prevent feedback to the 7805 regulator, in case I only use 5v MCU triggered input.

    I have attached my diagram circuit for feedback and verification that this circuit will work.

    Thank you so much for any info/guidance that you can give me.

    TONY
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    A few comments:

    You only need the one diode across the relay. The other 1N4004 diodes appear to serve no purpose.
    The PNP needs to have the collector and emitter reversed for proper operation. Incidentally you don't even need the PNP unless the Trigger input to ground is not capable of carrying the relay currents.
    (What is the relay resistance? Depending upon that value, the 1K base resistor to the NPN may be too large.)

    Note that convention is to draw the plus power at the top of the schematic. It makes it easier for the rest of us to understand the schematic.

    Edit: I don't see the need for the 7805. Just add an extra resistor in parallel to the base of the NPN so that either the 12V Trigger or the MCU 5V can turn on the NPN.

    [​IMG]
     
    Last edited: Jul 15, 2015
    stillgrowingup likes this.
  3. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,813
    1,105
    The diode to the right of the fuse is reversed.
    Is the LED cathode connected to the 1n4004 pair?
    I would use a higher value than 330 Ohms in series with the LED (assuming it's rated for 30mA max).
     
    stillgrowingup likes this.
  4. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    crutschow

    Note that convention is to draw the plus power at the top of the schematic ... The PNP needs to have the collector and emitter reversed for proper operation ... I don't see the need for the 7805.
    I have redone the drawing per your advice.

    The other 1N4004 diodes appear to serve no purpose.

    If you are referring to the 1n4004 to the right of 1A fuse. I have that to prevent possible feedback from external 12v coil. Would this not be needed?

    Incidentally you don't even need the PNP unless the Trigger input to ground is not capable of carrying the relay currents.
    The 12v ground input I would be tapping into on my car, also illuminates a 12v LED in my car when active. I was thinking that the PNP would prevent this LED from falsely illuminating from a ground being back fed in this circuit. Is my thinking correct?

    I don't see the need for the 7805. Just add an extra resistor in parallel to the base of the NPN so that either the 12V Trigger or the MCU 5V can turn on the NPN.
    Being that this input would be a 12v High and not a 5v High from the MCU. What resistance would I need on the 12v High to activate the NPN?

    Alec_t


    The diode to the right of the fuse is reversed.
    I have that to prevent possible feedback from external 12v coil. I don't want an external relay to trip this relay in my circuit.

    Is the LED cathode connected to the 1n4004 pair?
    Yes, since the output from either the NPN or PNP would a ground. The placed the pair of diodes there to protect from interference from either transistors. I am not familiar with transistor to know if that is a possibility. I figured, better safe than sorry.

    I would use a higher value than 330 Ohms in series with the LED (assuming it's rated for 30mA max).
    This is my 2nd attempt at building this circuit. I used a 550 ohm resistor before and the LED did not come on. The data sheet for this LED says steady current is 12mA.

    The LED in this circuit is to give user feedback that the circuit is active when lit.


    Thanks for feedbacks guys. Keep it coming. :)

    TONY
     
    Last edited: Jul 15, 2015
  5. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    Much better. Another schematic note, there are two ways to show whether or not two crossed lines are supposed to be connected. One is to put a dot on the connection point. A better way is to stagger two of the lines so there is no longer a single connection point. For example in your drawing shift the line from the LED slightly to the left, and the line from the fuse slightly to the right. This makes it perfectly clear which lines touch which lines.

    Here is how to figure out the base resistor values. Start with the relay coil resistance and Ohm's Law (or the data sheet) to get the nominal relay coil current. This is the transistor collector current, so you can use this to select the transistor. Divide the collector current by 10 or 20 to get the base current needed for hard saturation. With the base current and the input signal voltage (- 0.7 V for Vbe) use Ohm's Law to calculate the base resistance. Check with the transistor datasheet to make sure that its max base current is not exceeded.

    ak
     
    stillgrowingup likes this.
  6. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    The diode in series with the 1A fuse will do nothing to prevent feedback from the relay coils. The diode needs to be across the relay coil.
    And I was also referring to the two diodes in series with the transistors, which appear to do nothing useful.
    Yes the PNP will prevent that.
     
    stillgrowingup likes this.
  7. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    I placed dots on the diagram now to show connections. Thank you.

    I think I understand. I will show my work. If you or anyone could verify that I did this correctly. I would appreciate. Also I will swap the 2n3906 PNP for a BD140 PNP. Seems to have higher tolerance values.

    Relay resistance = 320 ohms (I miss stated this resistance previously)
    Nominal relay coil current = 450mW
    Voltage = 12vdc
    ======
    nominal relay coil current = 37.5mA

    Max BD139 transistor collector current = 1.5A
    Max BD140 transistor collector current = 1.5A

    All good there.
    -----------------------------
    Here's where I get confused, so the following is probably wrong.

    collector current = 1.5A
    hard saturation (/10) = .15A
    input signal voltage = 12v

    base resistance = 80 ohms

    collector current = 1.5A
    hard saturation (/10) = .15A
    input signal voltage = 5v

    base resistance = 33 ohms

    So does this mean I need a 33 ohm resistance on the 5v input to the NPN and a 80ohms resistance to the 12v input to the NPN?

    Thank you. I will remove it.

    Thank you. I will keep the diode there then.

    I've upload new diagram.

    TONY
     
  8. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    crutschow said:
    And I was also referring to the two diodes in series with the transistors, which appear to do nothing useful.

    I have removed these from my diagram. Thank you.

    Good feedback here. Thank you guys. I need it.

    TONY
     
  9. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    The 1.5A is the maximum allowed transistor operating current. You size the base resistor for the actual maximum operating current.
    For a maximum of 3 relays on at once the maximum current would be 3 x 37.5mA = 112.5mA.
    The base resistors needed are then:
    (5v - 0.7V) / 11.3mA = 380Ω for the 5V signal.
    (12V - 0.7V) / 11.3mA = 1kΩ for the 12V signal.
     
    stillgrowingup likes this.
  10. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    Thank you.

    I see you included the 2 external relays I mentioned earlier. Good call. I completely forgot those also needed be figured in. However, the 2 external relays would be standard 12v Automotive socket relays. Something like these:
    http://www.digikey.com/product-detail/en/1432785-1/PB680-ND/807757

    I came up with Nominal relay coil Current of 133.3mA for these automotive relays.
    Relay resistance = 90 ohms
    Voltage = 12vdc
    ======
    nominal relay coil current = 133.3mA

    So (.1333 x 2) + .0375 = 266.6mA
    I see that in your maximum current equation you converted the answer of 112.5mA, in to 11.3mA when you calculated the base resistance. I do not know why, but I followed your example. Also, I presume the 0.7V that Analog Kid first mentioned is for the Vbe (Base-emitter voltage), but on my datasheet for the NPN and PNP only shows a MAX value of 1.0v ... Not 0.7V. Is this a Problem? I do think it would. But just in case, I'm mentioning it.

    PNP NPN Datasheet: http://www.st.com/web/en/resource/technical/document/datasheet/CD00001225.pdf

    Using the calculations that crutschow demonstrated above. I have came up with 190 ohms for the 5v input and 424 ohms for the 12v input. Would this be correct? Also, do I use 424 ohms on the base of the PNP to trigger it with a 12v Ground?

    Does the mA of the LED illumination also have to be figured into when calculating the base resistors needed?

    LED Datasheet: http://www.lumex.com/content/files/ProductAttachment/SSL-LX3044ID-12V.pdf

    Thank you

    TONY
     
  11. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    I used 11.3mA since that's approximately 1/10th of the collector current (rule of thumb to have the base current 1/10th the collector).

    1V is a worst-case base-emitter voltage that you likely only see for the worst units under maximum base current. 0.7V should work fine for nearly all typical design calculations for base current resistors.
    I came up with 161Ω for the 5V and and 424Ω for the 12V.

    The PNP is operating as an emitter follower so doesn't need a base resistor.

    Yes I neglected to add the LED current which should be added for completeness.
     
    stillgrowingup likes this.
  12. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    This is GOOD info to know. Thank you.

    I used 5v, not 4.3v in my calculations. Thanks for catching it.

    Adding the 12mA for the LED to the 266.6mA for the Relays. I get 278.6mA changing the resistance needed. 5v is now 155 ohms and 12v is now 420 ohms.

    Since the PNP will be getting its 12v ground signal from a share output with an LED. I do NOT need a resistor to limit the PNP draw from the LED? I won't want the PNP to 'starve' the LED for power. Or am I just overthinking it?

    I updated my drawing, unless I do need a resistor for the PNP. Is this circuit done? Is there something I am over looking?

    TONY
     
  13. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    One more question. If the other 2 external relays are NOT being used to consume the other 133.3mA from the transistors. How does this affect the resistor sizing being used or the actual transistors themselves?

    Does this even matter?

    TONY
     
  14. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    I don't understand what you mean by 'starve' the LED for power. :confused:
    In an emitter-follower circuit the transistor base takes only the current it needs to supply the emitter current.
    Looks okay, except you may need to add a diode in series with the emitter of the PNP, as you had previously. I forgot that the base voltage could be 12V which would exceed the maximum reverse base-emitter transistor voltage rating (5V) when its emitter is pulled to ground by the other inputs. :oops:
    You size the resistors for he maximum current. If the collector current is less than the maximum, then the transistor just goes a little deeper into saturation. There is no other effect.
     
    stillgrowingup likes this.
  15. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    I was referring to the source LED that will trigger the PNP to activate my circuit. I don't want the source LED to seem dim, because the 12v ground to soucre LED is supplying 2 things now, not just one.

    As you stated, the PNP will only take the power it needs. SO until I see it in action, I believe I am overthinking it. :)

    I did re-add that diode into my circuit and attached it.

    Great! Thank you

    ---

    I do have a question about the difference on wiring up the PNP and NPN pins. I look at their pins and see B-base, E-emitter and C-collector. At first glance, I believe B is the trigger, E sends OUT the current and C receives IN the current to supply E when B is triggered.

    But, when I showed that style of thinking in my 1st drawing. It was said to be wrong and changed it. The PNP C pin was the input, E was the output and B was the trigger. But .... the NPN is different. C is the output, E is the input and B is still the trigger. I'm confused??

    TONY
     
  16. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    I did realize that I placed the diode for the PNP upside down in the drawing and have corrected it.

    TONY
     
  17. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    A PNP has the reverse voltage and current polarity of an NPN.
    It's easy to remember since the current (conventional current from positive to negative) goes in the same direction as the emitter arrow.
    Thus in a NPN the current direction is from collector to emitter and from base to emitter (collector and base positive with respect to the emitter).
    In a PNP the current direction is from emitter to collector and from emitter to base (collector and base negative with respect to the emitter).
    If you follow that you will see why the PNP needs to be connected as shown in your last schematic.
     
    stillgrowingup likes this.
  18. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    Thank you for the education on this. It is making sense to me now .... slowly. :)

    If a NPN goes to base to emitter and PNP emitter to base. How can the base and emitter be different types of voltage? example ... 5v triggers the base. but the Emitter sends/receives a ground.

    I presume that base is internally separated from the collector and emitter. Like the coil of a relay is separate from the switching. Even though they're all in the same component, they have separate functions to serve the same purpose. Am I even close to being correct?

    TONY
     
  19. crutschow

    Expert

    Mar 14, 2008
    13,055
    3,245
    Closer.
    The base-emitter junction and base-collector junctions look like diodes if you measure them individually.
    The two diodes have the anodes connected together for an NPN and the cathodes connected together for a PNP.
    The means that, for normal bias voltages, the base-emitter junctions are forward biased and the base-collector junctions are reverse biased.
    There is no collector current if there is no base-emitter bias voltage (or current).
    Any base-emitter bias voltage above about 0.6V (which starts base-current to flow) generates carriers in the transistor substrate which causes a collector-emitter current.
    The base-emitter current value is amplified by the current gain (Beta or hFE) of the transistor to give the collector-emitter current value.
    This is the normal transistor action of a BJT.

    Make more sense now?
     
    stillgrowingup likes this.
  20. stillgrowingup

    Thread Starter Member

    Jul 15, 2015
    146
    2
    It sure does, thanks.

    So if I was to use 12v power to the BD139 and BD140, instead of a ground. Would I need to put the 12v to the collector of the NPN and the output would be emitter? Then 12v to the emitter of the PNP and the output would be the collector?

    TONY
     
Loading...