Shop OBEX P1 Docs P2 Docs Learn Events
one more relay question — Parallax Forums

one more relay question

firealarmfreakfirealarmfreak Posts: 105
edited 2008-07-03 14:20 in BASIC Stamp
I am connecting a relay from pin7 on the board of education and pin 8. I have it conencted through a transister and it works fine however i was told you should use a protection diode to protect damage to the BOE. It seems to be working fine now but, Is this true? if so could someone explain where the diode is supposed to be conencted cuz im confused.

Thanks.

Chris.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-02 14:56
    Yes, absolutely you need a protection diode, otherwise everytime you de-energize the relay, the collapsing magnetic field generates a current spike which is forced through the I/O pin, which WILL destroy it eventually.

    The diode should be placed in parallel with·the coil, "reverse-biased". Meaning Cathode (the 'line') on the coil pin on +5, and the Anode (the 'triangle') on the other pin of the coil. This gives the current spike somewhere to go besides destroying the BS2 I/O pin.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-07-02 15:20
    It is not recommended to connect a coil relay directly to the I/O pin, even if it is a 5V relay. The safest method is to drive it from a transistor off the I/O pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • firealarmfreakfirealarmfreak Posts: 105
    edited 2008-07-02 15:31
    Sorry i already know that.

    I am using the I/O pin to activate a transister and then the tranistser activates the relay coil like you said too do. But do i also need a protection diode to prevent damage to the BOE? if so where do i connect it.?

    Chris.
  • firealarmfreakfirealarmfreak Posts: 105
    edited 2008-07-02 15:36
    allanlane5, so in my case i have a trsnsiter on a breadboard. Do i connect one side of the diode to the coil of the relay and the other side to +5 volts (vdd on the BOE)? and what kind of diode do i need. and theres too coils, how do i know which ones positive?

    Chris.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-02 15:48
    There's two ways to hook up a component. Let's use batteries as an example. You can hook up two batteries "In Series", like in a flashlight. This way, the voltages of the two batteries "add" together and you get 3.0 volts from 2 1.5 volt batteries

    You can also hook up two batteries "in parallel" -- plus to plus, negative to negative. This way the voltage stays at 1.5 volts, but you get twice the current.

    I'm belaboring this point because it's critically important and can come up A LOT. When I say "hook a diode up in parallel with a coil", that's a completely unambiguous statement.

    So, I'm assuming you have one pin of your coil tied to +5, and the other pin of the coil tied to the collector of the transistor. To protect the transistor from the "reverse surge of current generated by the coil's collapsing magnetic field" you place the Cathode pin of the diode on the pin of your coil tied to +5, and the Anode pin of the diode on the pin of the coil tied to the collector of the transistor. There's LOTS of examples in the "Interfacing" Nuts&Volts article.

    Almost any diode will work for this -- 1n4001 is good. The current surge is quite small and short, but it can generate destructive voltages if not given somewhere to go.
  • firealarmfreakfirealarmfreak Posts: 105
    edited 2008-07-02 16:25
    yes i do have one pin of the coil connected to +5 and the other pin of the coil connected to the collector of the transister. Thanks I think i understand the diode now. I just connect it between the rleays + and the transisters collector correct?

    Chris.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-02 19:06
    Correct, and don't disconnect anything you already have when you do that. So the relay coil remains connected between +5 and the collector, and the Diode is ALSO connected between +5 and the collector. Thus, "in parallel" with the coil.
  • jeffjohnvoljeffjohnvol Posts: 197
    edited 2008-07-03 14:20
    Not to digress, but the way you should view the coil of the relay (or any other inductor for that matter) is like a weighted water wheel, and the current to the coil is water pushing through. When you close the valve to the water wheel, a lot of pressure would build up and could bust a pipe. View the diode as a safety check valve that lets the current blow past preventing damage to the rest of your "plumbing". This always helped me visualize the circuit in a mechanical manner and helped me picture how the current would flow.

    Capacitors can be viewed in the same plumbing model, but act as water towers. The smaller the capacitance, the smaller the piple going up the tower, and the larger the charge capacity, the bigger the "bulb".
Sign In or Register to comment.