Introduction: How to Make a Computer Controlled Ac Outlet

About: Hi I'm kyle I'm 15 and I love technology and science. I stink at english the only reason I can spell english is because of autocorrect and even that sometimes messes up (alot like me). I love finding electroni…


In this tutorial I will teach you hiw to controll a AC device with your computer

Step 1: Utilities

you will need

-arduino UNO microcontroller
-windows so or better
-no sodder breadboard
-jumpers
-alagator clips
-serial cord
-some sort of power supply
-exction cord
-cutter
-seeed relay sheild
-9v battery and hookup
-flathead screwdriver
-time
-the ability to code in C language
-motor or LED

Step 2: Lets Get a Nice Housing

I used a cutter to cut the boc and put a hole in for a screw to hold in the arduino.

Step 3: Lets Get a Nice Housing

I used a cutter to cut the boc and put a hole in for a screw to hold in the arduino.then I screwed the arduino in.

Step 4: Add the Seeed Relay Sheild

I just had to cut the box so I could have room for the shild but it is a tight fit.

Step 5: Lets Wire It Up for a Test

The yellow jumper is the common wire and the green one is the noramly closed one. I like to keep normally closed positive,and the common negative it makes it much easier for me the one to the right of the yellow one is the normally open which without a current going through the relay is open so on the normally closed one without a current going to the relay is normally closed which means its off. The red and black wires are positive and negative the red one is positive the black one is negative. The red and black wires are used to switch the relays.

Step 6: Still Wiring for the Test

The red and white wires are positive and negative the top green in the top blue are the ones that go to the motor the bottom green in the bottom yellow are the ones that go to the relays on the arduino.

Step 7: Lets Code It

I went to my Windows XP computer for this because my Windows 7 computer currently crapped it's pants.

here is the code

void setup() {
 Serial.begin(9600);
pinMode(7, OUTPUT);
}

void loop() {
  while (Serial.available() == 0);

  int val = Serial.read() - '0';



  if (val == 2) 
  {
 delay(1000);
  }
    if (val == 1) 
  {
 Serial.println("Light on");
 digitalWrite(7 , HIGH);
  }
    if (val == 0) 
  {
    Serial.println("Light off");
    digitalWrite(7 , LOW);
  }

  else
  {

  }
Serial.flush ();
}

Step 8: Upload and Test

Once you upload the code to the
arduino you can try it out by clicking the magnifying glass on the right top hand of the Aduino coding page it will bring you to serial they were you can input the number one, zero and or two to see if it activate or deactivate's the relay. Make sure you have the nine volt power supply on.

Step 9: Time for an Upgrade

Take a cord and cut it like this


Disclaimer
-I am not responsible for what mistakes you make if you are confused do not attempt if you are new working with AC power which can hurt/kill you.

Also the seeed relay sheild does have limitations read up on what your plugging in before you do it it may fry your stuff, I personaly limit my self to one plug.

Step 10: Wireing

I cut a special hole in the top just to be safe.

Step 11: Lets Test It

Just plug it in like you would normally and then type the code to turn it on or off into your computer.

if you have any questions regarding this subject here is my email
kylemoran06@gmail.com