Introduction: LinkIt One Relay Light

Picture of LinkIt One Relay Light

Intro: Hey Builders! This is an instructable on using or controlling an AC light with the micro controller LinkIt ONE http://www.seeedstudio.com/depot/LinkIt-ONE-p-2017.html . This board is excellent as it uses the Arduino Environment to be programmed with. Also the board pin layout is very similar to the known Arduino's layout. So to the project itself, this project is made so that a AC load can be controlled with the Microcontroller, the load can be toggled through multiple ways including wifi, bluetooth etc. This instructable will show you how to switch it on and off every 1 minute( this can be changed to your need). This project uses simple parts which could be found at radio shack or anywhere online. It is important as it gives us control over the things at we use so commonly in our day to day life.

BEFORE YOU PROCEED: This project requires working with AC voltage which can cause harm or even death if dealt with irresponsibly. Only work with it while every thing is plugged out and you are in a safe open place. I TAKE NO RESPONSIBILITY FOR ANY TYPE OF DAMAGE CAUSED BY THIS PROJECT.

Now that we're done with that:), its actually safe if you work carefully and use common sense.

Lets get into the parts needed for the project.

Step 1: Step 1: Get the Parts

Picture of Step 1: Get the Parts

  • LinkIt One Board
  • SPST 5v Relay ( 120-250VAC) 60HZ ( Check your country's HZ, this differs in most countries) ($1)
  • 1N001 Diode ($ .30)
  • Bulb fixture( AC load) ( this can be anything you want to control) ($2)
  • Usb cable ( $1)

TOOLS:

Solder Iron

Solder wire

Electrical wire

Wire cutter

Once you have to parts you are ready to move on

Step 2: Solder the Diode

Picture of Solder the Diode

You can either follow the schematic above or follow the instructions. This step covers soldering the diode on to the relay and soldering wires on to the pins of the relay.

  1. First keep the diode across the two points as shown, these two points are its control pins ( for the electromagnet inside). We use a diode to prevent the overflow of current going back to the Microcontrollers pins.
  2. Solder the diode on to both pins while making sure that the center pin isn't in contact with the diodes legs
  3. Take two pieces of wires both of different colors and solder them to the points where the diode its soldered.
  4. Make sure all joints are clean and move on to the next step.

Step 3: Connect the Bulb

Picture of Connect the Bulb

Now take the light and cut the wire somewhere around the middle as we have to attach the relay.

1. After cutting the wire you will find that these wires can spilt if pulled apart, take one wire from each division and connect it( Doesn't matter which one as AC signal doesn't have polarity.)

2. Solder the connection and put tape over it to be safe.

3. Now take the side coming from the AC input side( the side you plug in to the wall) and connect the wire to the center pin of the relay( As shown Above). Solder it and cover it with tape.

4. Take the other wire and connect it to one of the pins on the parallel side of the 3 pins. ( On which of the 2 pins you solder the wire matters after trying it out. ( Come back to this step and switch the pin you chose if your light turns on directly after you plug it into the wall.)

5. Check all connections and make sure nothing is shorting.


Step 4: Test It

Picture of Test It

Test it by plugging in the light into the wall. Everyone ok? Nothings on fire? Then good. If your light turned on directly after plugging it into the wall socket without it being connected to the micro controller then refer back to the last step.

Step 5: Code It

Picture of Code It

This is a simple code for the Microcontroller. It will turn on the light after the board starts in 10 seconds and keep the light on for 1 min and then turn it off.

  • Insert the red wire to one of the digital Pins ( for example: pin 9)
  • And insert the black wire into the GND

This instructable assumes you have already setup the board and is fully functional. For help with Getting Started Up visit: https://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/get-started/index.gsp

Code:

int light= 9;// the relay is connected to pin 9

void setup()

{

pinMode(light, OUTPUT); // stating that it is an output

}

void loop() {

delay(10000); // wait for a minute

digitalWrite(light, HIGH); // turn it on

delay(60000); // keep it on for 60 seconds

digitalWrite(light,LOW); // turn it off

return;

}

Step 6: Final Test and Conclusion

Picture of Final Test and Conclusion

This project touches the basics of controlling a household item. This can be further advanced and improved by controlling it with wifi or some other form of human interface. If you have any questions be sure to ask them in the comments. Happy building and be aware of the AC voltage.

Comments

Mukund parelkar (author)2015-10-21

you can also connect a transistorto 555 output. In that case, you can use 6v o,12v relays also.

Mukund parelkar (author)2015-10-21

most microcontroller source current is small. You will have to interface with transistor or iic. Simplest is 555 ic. Connect pin no.1 to ground or0 volts. 4 and 8 to 5v supply. Connect relay to pin 3 and 5v. Connect pin2 and 6 to microcontroller output. Connect a 0.1 mf capacitor between pin 5 and 0 volt.

russ_hensel (author)2015-10-20

This is great, but the mcu is so overkill to be used as a timer. Anyway I found: DC "Current Per I/O Pin:1mA" so unless this is in error, your device may not last too long.

Do you have any info that your driving of the relay is in spec?

Also driving relays to mains voltage often uses an optical isolator so there are fewer electrocutions. If you can spend that much on the mcu you should be able to afford a few more parts to stay safe.

ShaddamH (author)2015-10-19

greaattt... love this simple one

robo10302 (author)ShaddamH2015-10-19

Thank You:)

robo10302 (author)ShaddamH2015-10-19

Thank You:)

gregoryfenton (author)2015-10-19

A good instructable. I would like to make a few points if I may:
When dealing with higher than 9 volts always consider the safety benefits of putting the circuit in a case.
You cut both sides of the cable going to the lamp. You only need to cut one of the wires.
You have left the legs of the diode hanging over the sides of the relay. They should ideally be trimmed flush with the top of the solder.

robo10302 (author)gregoryfenton2015-10-19

That is true about the safety when dealing with 9v, Ill will add that in. Thank you for the advise:)

DIY Hacks and How Tos (author)2015-10-18

Great way to control appliances.

About This Instructable

2,485views

39favorites

Bio: I started this hobby when I was in 5th grade and since then I have gained a lot of knowledge I would love to help ... More »
More by robo10302:SLAMP( Smart Lamp )LinkIt One Wifi Cam Turner ControlLinkIt One Motion NightLight
Add instructable to: