//
you're reading...
Uncategorized

Lab 3 : Relay & 120 Volts of Raw Wall Power!

Lab 3 – Relays and 120vac 

Today I am going to talk you through and demonstrate how to connect a 5v relay through your arduino to get use of 120 BIG volts. This allows you to access things that need a lot of power- lights, hair dryers, fans, projectors, blenders, you get the idea.

It’s a simple circuit technically, but a fairly complicated concept, so for Monday we’ll just focus on the how & why, and start the lab. Wednesday you’ll get to practive & work with the code some more.To prepare for the lab, read through the steps, and have your arduino programmed to the “button” code that runs a simple switch off pin 2.

A relay is a mechanical or solid state component that allows the arduino to control a device that requires 120-240v ac.
Data sheet for relay http://www.sparkfun.com/datasheets/Components/G5V-1.pdf
This relay operates by supplying current to a coil. When the coil receives the current in contracts and moves a contact to the opposite pole of the relay. It’s basically a switch, but with a pin for an external power supply. A relay keeps our two circuits -the switch coming from the arduino and the lightbulb going to wall power- separate.

Step 1:

You should solder headers on your relay pins, if you are reasonably comfortable with soldering. Once the little pins on the relay bend off or break, the relay is useless, and you’ll have to go to radio shack to replace it ($4.79). If you don’t want to solder, be careful with those little pins!

Parts list:

Arduino
5v relay
breadboard
ceramic light bulb socket
light bulb
AC plug
braided wire
wire caps (2)
electrical tape

Step 1: Place the relay on the bread board with the “valley” running down the middle of the relay. Three legs on one side of the valley, two on the other. The text side of the relay should be on the left.

relay

Step 2:

Connect the arduino power and ground pins to the correct vertical buses on the bread board

(just like we are doing any other normal  circuit)

Step 3:

Jump from the ground bus to one of the coil pins on the relay. If your relay is oriented correctly, this will be one of the top right pins. I use the second pin to go to ground. ( You can see the wires in my picture) The relay is non polar- this means you can reverse the wires- just know what you are doing.

relay_wired

Step 4:

Jump from digital pin 13 to the other coil pin on the relay.
that’s where the orange wire is going in my picture above. The brown wire is going to the ground bus.

Step 5:

Make your switch circuit, using pin 2, like we have been doing:
-Jump the resistor from ground to a horizontal bus on the bread board
-Jump from that same bus to digital 2 on the arduino.
-Connect switch between that horizontal bus and the power bus
relay_switch

Step 6:
Program the arduino with the basic button code from Examples >digital >button. You can now test the relay by closing the switch and listening for the mechanical click. If you here “chattering” , that is the relay going off and on quickly, it means your switch circuit is not grounded or you forgot the resistor.

Step 7:
Connect one end of the AC plug wire to the input pin on the relay. MAKE SURE THAT THE AC PLUG IS NOT PLUGGED IN!!

Connect the other end of the AC plug to one of the poles on the relay output. One pole is “always on” and the other is “always off”

 

Step 8:

Verify that your circuit is correct…

Remove the USB cable from the arduino, and power your arduino with wall power. Check FIRST!! to hear for the “click” of the relay switch. This means your relay is correctly wired. if your switch is wired correctly the LED on pin 13 should light as the button is pressed.

Step 9:

Plug in the AC plug and watch the magic!! BEFORE moving any wires at this point, TURN THE POWER OFF!!

About these ads

About Miriam

finally getting around to documenting what we're doing at NMHU in terms of exhibit design/dev and physical computing. The real point is to use this space to update my labs & demos for my students. Disclaimer: There's no subsitute for coming to class- meaning, this is just an outline to support those 4 hours a week that we meet. So remember: electricity can be dangerous, but It's more scared of you than you are of it - @arduinogirl

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Twitter Updates

  • @kbayans that sounds great! Last night I went to a haunted house in a corn maze. Not digital, not scary, but well engineered maze design. 23 hours ago
  • RT @santaferealtime: New advancements in tuberculosis testing in New Mexico: Researchers at the University of New Mexico are working… http:… 1 day ago
  • @venvoisey Hey! I've been wondering what you've been doing since leaving Roswell behind. Miss NM? 4 days ago
  • RT @starksart: autodesk -- "python: good." 4 days ago
  • In more news, hardware continues to be hard.Here's a serious narrative of a prototype ->market<-prototype experience medium.com/@mikeestee4 days ago
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: