Introduction: 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
- 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
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.
- 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.
- Solder the diode on to both pins while making sure that the center pin isn't in contact with the diodes legs
- Take two pieces of wires both of different colors and solder them to the points where the diode its soldered.
- Make sure all joints are clean and move on to the next step.
Step 3: 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
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
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
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.