Transistor / IC Protection

Discussion in 'General Electronics Chat' started by J.Green, Sep 7, 2008.

  1. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    Hi,

    I am building a circuit to control the indicator lights on a automobile. I am using a PIC microcontroller (+5v power) for the control and need to use something to turn on the cars indicators based on the output of the microcontroller. Car's indicators are 12v and draw a total of 1.75A per side.

    I was planning on using a npn transistor (TIP122) as the switch controlled by the microcontroller, but here is my problem: Down stream of the tranistor is a relay(s). The relays are there to allow the indicator to override the brake lights when the brake lights are on and the indicator is turned on. I can not put a diode between the relay's coil, as I understand is normally required to eliminate voltage spikes.

    I know I could use a transistor to operate a relay instead of only using a higher rated transistor. I would prefer to avoid using relays in the circuit to cut down on the size and improve longevity.

    Any suggestions on how I could protect the circuit from voltage spikes if I can't put a diode between the relay's coil? Any other suggestions on solid state switching methods to be used in conjunction with a microcontroller for this application?

    Thank you.
    JG
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Why you cant put protection diodes?

    A schematic of yuor circuit will be helpful.
     
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    The diode is placed in parallel with the relay coil. It could be soldered right on the terminals.
     
  4. Sonoma_Dog

    Active Member

    Jul 24, 2008
    99
    0
    Can you just use a voltage comparator to convert the output voltage from 5 volt to 12 volt? I am new to electronic and not sure if it will work, but here is the schematic i have in mind. I will let you figure out the Resistance and biasing for the NPN.
     
    • 1.jpg
      1.jpg
      File size:
      66.3 KB
      Views:
      75
  5. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    I'll post a schematic tonight.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The TIP1xx series Darlingtons all have intrinsic reverse-EMF protection diodes, as they're made for driving inductive loads.

    It really shouldn't be necessary to add more external diodes. However, you could add a small amount of capacitance (say, a 330pF ceramic) across the collector and emitter. This will have the effect of slowing the rise of a reverse-EMF pulse, giving the internal diode more time to turn on and conduct. This is starting to fall into the "maximum overkill" category, but why use a 2x4 when a 4x12 will work just as well? :)
     
  7. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    Attached is a schematic. I tried wiring this up tonight and no luck. The lamps would not come on.

    The transistors are TIP122. The coil resistance in the relay is 160 ohms. The transistors might be an overkill, but I want to build a circuit that can turn on a relay and turn on the lamp directly if no relay is used . The lamps draw 1.75 amps @ 12V.

    The microcontroller is a PIC. The software on the PIC works as it should when the outputs are connected to LEDs. The PIC outputs are normally low and the outputs go high with the inputs go low. The problem isn't with the PIC but with how I have wired the transistors/resistors?

    I am not really sure on how to size the resistors. I belive the TIP122 has a current gain of 1,000.


    Any suggestions on why the lamps won't light and how to fix?

    Thank you.
    JG
     
  8. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    should have added that I simplified the pdf of the circuit to exlude the brake switch and related wiring. The relays are only needed to override the brake lights if they are on.
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Have you looked at a datasheet for a TIP122?

    What are the values for R1 and R2?

    BTW, in the Eagle Layout Editor, you don't have to "hop" wires over each other. However, you MUST place junctions where more than two wires come together.
    "Hops" are old school. Junctions clear up anything arbitrary. Do an "Erc" to find out what it doesn't like.

    OK, the PIC is run at 5v, and it's outputs are limited to 25mA maximum. Let's go with 20mA for a "comfort zone". Running parts at max output tends to break them in the shortest possible time.

    I=E/R, so 20mA=5v/?
    Alternatively:
    R=E/I, so R=5v/20mA, so R=250. The closest standard value higher than that is 270, if you want reliability. 240 is a bit lower, and that will increase your current.
    I=E/R
    I=5V/240 Ohms = 20.8333... mA - it's your choice.

    [eta]
    You're showing that your TIP122 emitters have their path to ground via the relay coils. If that's the case, it's not going to work. TIP122 transistors are designed to sink current, not source it. You might get up to about 4.3v at the emitters, at best.

    If you want to source current, you need PNP Darlingtons. TIP125, TIP126, TIP127, etc.
    With all TIP resistors, those with a last digit of 5 or greater are PNP, with less are NPN.

    It would have been far better for you to post a schematic before you attempted to wire it up.

    Your TIP122's can still work - if you connect one side of the relay to +12v instead of ground.
     
    Last edited: Sep 9, 2008
  10. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    I only have 220 ohms currently. 5v / 220ohm = 22.7mA, still less than the 25mA max. I'll go with this for now and try 270 ohms when I get them.

    I rerouted the TIP122 and relay coil so that the coil is on the high side and the TIP122 on the low side. See the attached simplified schematic with "NPN" in the title. When I wire this up and execute the program to turn the PIC pin connected to the TIP122 high, I hear the relay 'click' closed and then immediately 'click' open again. When powering a LED, the PIC keeps the LED on for a few seconds as it is supposed to. The relay clicks closed and then opens instantaneously. It should stay on as long as when the PIC controls the LED.

    I have also attached a schematic showing the same type of arrangement, but using PNP transistors (TIP125). I don't have any TIP125 yet to try it out/

    I am concerned that I can't get the TIP122 to work when wired on the low side of the relay coil. Really appreciate all the help and suggestions getting the NPN transistors to work with the PIC before I try PNPs.

    thank you.
    JG
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, your 5v regulator - what is it, a 7805 or a 78L05?

    On the output of the regulator, add a 10uF cap. Put a 0.1uF cap across the Vcc/GND terminals of the PIC (pins 1 & 8). Add a much larger cap on the input of the regulator; perhaps 470uF-2,000uF.

    My suspicion of what is happening right now is that the load of energizing the relay coil is causing the Vcc on the PIC to dip, causing the PIC to enter brownout reset condition; basically "re-booting". That's why your relay is turning off right away.

    What gauge wiring are you using between your circuit and the electrical system, and how long is the wiring?
     
  12. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    The 5V regulator is a 78M05.

    The wiring between the circuit and the electrical system is 16 gauge. I've got a model of the electrical system build on my work table so the distance from the circuit to the electrical system is less than 12".

    I'll try adding the caps as you suggest tonight and let you know what happens.

    Thank you for the help.

    JG
     
  13. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    You want to be careful about using the PNP since the Emitter is at 12V and your VCC is at 5V -- you'll have a hard time turning off the PNP.

    When calculating the current you also need to subtract the Vbe of the TIP122 so you you'll have (5-Vbe)/R --> 3.5V/270 = 16mA. But you likely do not need nearly this much base current to turn on the relay. You can use a 10K resistor. A 160 Ohm coil will only pass 75mA through the transistor. A TIP122 seems like overkill but then it does have the built in diode.
     
  14. J.Green

    Thread Starter Member

    Jul 15, 2008
    26
    0
    I used a 470 uf at the input of the regulator, a 22 uf at the output of the regulator, and a 0.1 uF from Vcc to grnd. Worked like a charm using the TIP122. Thank you SgtWookie. For my own education, is there any 'simple' way to mathematically size the caps in this situation or is trial and error easier?

    Now for the TIP127...nanovate was right on. I can't shut it off. I rewrote the PIC program so that the output pin is high (ie relay coil not energized) and grounding one of the input pins on the PIC makes the output pin go low momentarly. As soon as I put the PIC in the circuit and powered it up the TIP127 allowed the relay coil to become energized and I couldn't shut it off. Do I need to use 12v at the base of the TIP127 to control it? If so, would I use an optocoupler to seperate the 5V from the 12V for that or something else?

    Thank you.
    JG
     
  15. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    The relay coil develops a positive voltage spike of about 200V. It will destroy the darlingtons and it might jump to the PIC causing it to reset.
    Diodes are needed across the relay coils, not the ones in the darlingtons.

    A PNP darlington will be turned on all the time since its base needs to go near +12V for it to turn off. The outputs of the PIC might be harmed with the voltage higher than 5V.
     
Loading...