Finally having re-submerged from project chaos, I finally have a little time to spend playing with circuits again. While I’m toying with pieces to ultimately automate the entire house, like an RFID-based garage door opener. I figured I might as well post about individual pieces along the way.
The first one is a relay driving circuit. The goal is to simply drive a single relay (for now) from one of the Arduino data pins. Since I want to use the built-in 5V power, I opted for a simple 5V relay. It’s powerful enough to drive 5 amps on 220V, so that should be enough for most applications. I can’t recommend you hooking up 110V or 220V to a breadboard though! Getting circuit boards printed for this will be my next undertaking, but let’s dive into the circuit a little first.
- A 5V Relay like the Omron G5SB ($1.95 at Sparkfun)
- 470Ω, 1kΩ, 10kΩ resistors (one each)
- A NPN resistor capable of driving the relay (2n2222 or these do the trick)
- A diode such as a 1N4001 or 1N4148 (like this one or this one)
- An LED (every circuit needs LEDs!)
- A breadboard and some cables
The circuit itself is fairly simple. The signal from the Arduino data pin goes into pin 4 via the resistor R1 to the transistor which switches the relay on and off. Notice R3 which is pulls the data line to ground (reduces unwanted triggering of the Relay while the Arduino is not initialized). The diode is also required as it protects the circuit and ultimately the Arduino from so-called back EMF current.
Fun stuff, but all it really does it go click-click-click. But it is controlled via C-code! I omitted the code here because it’s as simple as 1-2-3. If needed, go to the Arduino site and read about how to make an LED blink.
Stay tuned for a write-up about getting the RF Link transmitter-receiver pairs going and hooked up to this.