Shop OBEX P1 Docs P2 Docs Learn Events
Electromagnet Power Transistor versus Relay — Parallax Forums

Electromagnet Power Transistor versus Relay

Martin_HMartin_H Posts: 4,051
edited 2011-12-14 06:33 in General Discussion
I want to turn an electromagnet capable of lifting a small iron object on and off via a microcontroller. Now obviously a relay is a small electromagnet and I use a transistor to turn it off and on. So a power transistor should work for something bigger, but given the stronger magnetic field I wonder if something nasty might happen when I turn it off. For the relay I have a diode across the coil to handle this, but how big a diode would I need to use? A relay seems safer because it provides physical isolation between the circuits.

Comments

  • localrogerlocalroger Posts: 3,452
    edited 2011-12-13 07:01
    It depends on how big the electromagnet is. I've used opto modules which are solid state to switch some pretty hefty loads, but we use a device called a quencharc across the load instead of a diode; it's basically a RC circuit designed to drag out the inductor-off voltage pulse instead of totally absorbing it, as the name suggests so that the voltage spike won't arc across the relay contacts. You also need to watch shared power, because even if you use a relay if the relay and the uC are powered from the same source the inductor-off voltage pulse can sneak over through the power supply and mess up the uC.
  • ercoerco Posts: 20,259
    edited 2011-12-13 09:21
    Martin_H using a relay? What's next, me using mosfets? :)

    Both methods (relay or power transistor) work fine. As you know, I'm a fan of small relays that use 20 mA and don't even need a driver transistor (most uC i/o pins can source 20 mA). Radio Shack has a 5V reed relay that a Stamp can drive directly, might work at 3.3V. Those Omron 5V latching relays I advocate work fine at 3.3V. Any small flyback/snubber diode across the coil is fine, it's the spike off the relay coil (not your electromagnet coil) that you're suppressing. 1N4001 or 1N914 work well.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-12-13 09:47
    erco wrote: »
    Martin_H using a relay? What's next, me using mosfets? :).

    I know it's hard to believe, but I already have one wired up and read to go.
  • ercoerco Posts: 20,259
    edited 2011-12-13 10:04
    They're low tech, bulletproof, and no voltage drop. Actually quite cool to have several relays cycling on & off with LEDs, their switching sound is quite therapeutic. The Lost in Space robot was enamoured with a female robot in one episode and waxed romantically about hearing "her relays tinkling in the night".

    LEDs on each relay are also quite useful to indicate their power on state: http://www.youtube.com/watch?v=VzbKlwc4GWs
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-12-13 22:42
    My preference are relays and heavier ones than Erco likes. I have 10amp 12VDC relays that take about 60ma at 12VDC to drive. I use a 2N2222 transistor between the micro-controller and the relay and the relay coil has a fly-back diode to protect the transistor from spikes.

    If you need really hefty power - like 30amps at 12VDC; the 2n2222 can easily drive an automotive relay. And these are both easy to find and designed for environmental abuses that robots may have.

    So, 30amps at 12 volt DC would provide 480watts of power for lifting. IS that enough? There are even heavier relays available. They jump up in cost because higher DC voltages require best design of the relay contacts.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-12-13 23:10
    If you use a relay to switch an inductive load like an electromagnet, you need to protect the relay contacts from voltage transients in the same way you protect a transistor or micro from the relay coil's inductance. Otherwise, you will get arcing and pitting of the contacts and a shortened useful life.

    -Phil
  • Martin_HMartin_H Posts: 4,051
    edited 2011-12-14 06:33
    So, 30amps at 12 volt DC would provide 480watts of power for lifting. IS that enough? There are even heavier relays available. They jump up in cost because higher DC voltages require best design of the relay contacts.

    The problem is my current gripper is limited in what it can grab. I was fiddling around with Lego Technic to build a parallel jaw gripper when I realized that an electromagnet might be a better way to go. My plan is to build Styrofoam blocks, paint them different colors, and glue a thin sheet metal square to the top. The idea is to make some objects that look substantial, but are light and easy to pick up. I would then build an electromagnet and try different voltages to determine a voltage and current that can lift these blocks reliably. At that point I will need a way to switch that a load of that size. I'm thinking I would use between 6 to 12 volts and keep it under an amp, and the relay I have from Radio Shack is rated for up to 1A at 125V AC.

    Now this idea might fail spectacularly or it might work great. I don't really know. I know I can buy a better gripper, but flailing around is part of the fun for me.
    If you use a relay to switch an inductive load like an electromagnet, you need to protect the relay contacts from voltage transients in the same way you protect a transistor or micro from the relay coil's inductance. Otherwise, you will get arcing and pitting of the contacts and a shortened useful life.

    -Phil

    Good to know, thanks.
Sign In or Register to comment.