User Tools

Site Tools


digispark:tutorials:relay

This is an old revision of the document!


Relay Shield Kit Tutorial

Product Description:

relay1.jpgrelay7.jpgrelay6.jpg

The Relay Shield Kit connects a Omron G5Q relay to the Digispark development board. This allows the Digispark to turn AC and DC loads on and off up to 250 VAC. The relay is rated for 3 A @125 VAC, 3 A @250 VAC, and 5 A @30 VDC.

This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.

Parts:

Part Quantity Identification
Relay Shield PCB1
Omron G5Q Relay1
3.5mm pitch 2-pin screw terminal1
2N3904 NPN Transistor1
10k Ohm 1/4W 5% Resistor1 Brown - Black - Orange
1N4001 Diode1
1x40pin male 0.1“ pitch header 9 pins worth

Soldering: If you are new to soldering we recommend the following tutorials: Soldering Basics (http://www.sparkfun.com/tutorials/106) and Soldering Crash Course from the folks at Sparkfun (http://www.sparkfun.com/tutorials/354). How to solder from the Curious Inventor: http://store.curiousinventor.com/guides/How_to_Solder

Adafruit has this excellent guide that starts with the tools needed and then shows detailed pictures, including some of the common problems that beginners experience (http://learn.adafruit.com/adafruit-guide-excellent-soldering)

We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!

Assembly:

Empty kit bag (or if using a raw PCB, aquire parts) and verify contents. Note for Kickstarter Backers and Pre-orders: Headers are not included in each kit bag, but the entire order came with more than enough headers for all kits.

relay1.jpg

Insert resistor and diode - the diode goes on the bigger outline with the line on one side. Be sure the direction line on the diode is on the same side as the line printed on the board. Solder the leads and clip off the excess.

relay2.jpg

Insert the transistor, matching the shape with the printing on the board. Solder the leads and clip off excess.

relay3.jpg

Insert the 2-pin screw terminal with the hookup openings facing outward. Solder the two pins.

relay4.jpg

Insert the the relay and solder all pins.

relay5.jpg

Cut a length of male headers 6 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin.

relay6.jpg

Tip: Inseting the headers into a breadboard and then placing the board on top can make this process easier.

Note: If you are using stackable headers, use them here instead of the standard male headers.

CAUTION: Care must be used with working with live AC loads, Digistump LLC takes no responsability for injury, damage, or death that may result from imporper connection of the relay shield.

Programming:

The relay can be turned on and off by simply setting P5 high or low (just like blinking the LED in the blink demo). The relay is normally open, so it will be off unless P5 is set high.

The relay can also be connected to P2 by cutting the thin trace between the solder number next to P5 and bridging the other solder jumper with solder.

void setup() {                
  // initialize the relay pin as output
  pinMode(5, OUTPUT);         
}

void loop() {
  digitalWrite(5, HIGH);   	// turn the relay on
  delay(1000);              // wait for a second
  digitalWrite(5, LOW);   	// turn the relay off
  delay(1000);              // wait for a second
}
digispark/tutorials/relay.1364565352.txt.gz · Last modified: 2013/03/29 06:55 by PeterMortensen