7
\$\begingroup\$

https://i.stack.imgur.com/ad2ah.png

Ok, so this is what my relay looks like. I can't figure out what pins I hook the arduino and transistor to, and what pins to hook the the other device.

Please help.

\$\endgroup\$
10
\$\begingroup\$

Here's a well illustrated similar answer on a different forum.

http://letsmakerobots.com/node/528#comment-15665

(deeplinked images)

A schematic diagram of a relay showing the two coil pins and the three pin switch consisting of normally-open, normally-closed and common (power).

relay
(source: letsmakerobots.com)

A circuit using a transistor to drive the coil and a diode to suppress its back EMF.

driver
(source: letsmakerobots.com)

Don't forget to adjust for the different pinout of your relay.

\$\endgroup\$
4
\$\begingroup\$

Connect one end of the relay coil to the 5V rail. Connect the cathode end (the end with the bar) of a diode, such as a 1N4001, to that same end of the relay coil. Hook the other end of the diode to the other side of the relay coil. Connect this side of the relay coil to the collector of an NPN transistor. The emitter of the NPN goes to ground. Hook an output from the Arduino to the base of the NPN through a resistance of about 2.2K ohms.

When you set the output HIGH, check the voltage at the collector of the NPN. It shouldn't be more than about 0.2V; if you see 0.25 or more, try a smaller resistor, but don't go below 500 ohms or you'll be pulling more current from the arduino than you really need to.

\$\endgroup\$
  • \$\begingroup\$ Do I need a diode? And lets say that the top two are A and B and the bottom two are C and D. and that one by itself is E. Can you edit your explanation because I am still un sure. \$\endgroup\$ – ssfdr Jun 29 '10 at 23:34
  • 1
    \$\begingroup\$ Yes, you need the diode. Without it, when the relay shuts off, the energy stored in the coil will dissipate itself by burning out the transistor and possibly your arduino. \$\endgroup\$ – JustJeff Jun 29 '10 at 23:46
  • \$\begingroup\$ Using your lettering scheme, the relay coil would be C and D. \$\endgroup\$ – JustJeff Jun 29 '10 at 23:47
  • \$\begingroup\$ Those are all I have to use? the other 4 pins don't matter? \$\endgroup\$ – ssfdr Jun 29 '10 at 23:49
  • \$\begingroup\$ A,B, and E are the switching side of the relay, which in this case are equivalent to the SPDT switch you already have in the nerfgun. If you wire those in parallel with the existing switch, you should be able to use either the original switch or the arduino to fire the gun. \$\endgroup\$ – JustJeff Jun 29 '10 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy