Introduction: LinkIt One Tutorials - #3 Talk to External Device

About: Focussing currently on supplying open source software to the masses. I supply linux CDs and DVDs across Europe, as well as mirror various open source projects. Currently I mirror openoffice.org http://rsync.…

I hope you followed my previous two LinkIt One tutorials and all worked well.

For this tutorial we are going to connect an external device (in this case an LED (Light Emitting Diode)) to the LinkIt One board.

This will demonstrate controlling external devices and is the first step to interfacing with the real world.

Step 1: Materials Required

MediaTek LinkIt One
If you followed the previous tutorials you should already have one, look for a light that is on until you press a button.
Micro USB cable
If it is not plugged into your LinkIt One, go ask your significant other where the phone charger lead went (again!). Breadboard
Available anywhere that sells electronics components such as resistors.
1K resistor
Available anywhere that sells electronics components such as resistors.
Male to male jumper wires
Available anywhere that sells electronics components such as resistors. You should have some from my previous tutorial.
LED
Available anywhere that sells electronics components such as resistors. Get 5MM LEDs, they are easier to handle. For this tutorial the colour of the LED is irrelevant.
Arduino IDE This was installed if you followed the first tutorial.

Step 2: Wiring the LED and Resistor to the Board

Have a look at the LED. One leg will be slightly longer than the other one.
The longer leg is referred to as the "anode" and connects to the positive voltage.
The shorter leg is referred to as the "cathode" and connects to ground (gnd).
If you look closely at the plastic on above the shorter leg you will see that there is a flat notch on the ring at the bottom. This is an easy way to determine polarity should the legs be trimmed.

Remember in the previous tutorial I discussed how breadboards work.

Insert the two pins on the LED, one into each column. The columns are the numbers and the rows are the letters.

Take the resistor and bend the legs so the resistor goes from being straight to looking like an n shape.

Insert one end of the resistor (it doesn't matter which) into the same row as the positive (long) leg of the LED. Insert the other end into an empty column.
Viewed from the side the resistor and LED should make an m shape.

Take one of the jumper wires and plug it into the column which only has the resistor in. The other end of the jumper wires does not need plugging into anything just yet.

Take the other jumper wire and plug it into the column which only has the LED in. The other end of the jumper wires does not need plugging into anything just yet.

Take floating end of first jumper wire (the wire connected to the resistor leg) and plug it into the LinkIt One board in the hole marked D13.

Take the floating end of the second jumper wire (the wire connected to the LED leg) and plug it into the LinkIt One board in the hole marked GND.

Step 3: Program the LinkIt One

Start the Arduino IDE and ensure it is still set up as in the first tutorial.

For this step we will be doing the same as in the first tutorial ( https://www.instructables.com/id/LinkIt-One-Tutoria... ) so pardon the blatant copy/paste :)

Click on File-Examples-01.Basics-Blink

A new IDE window will open (don't get me started on that one!) with the contents of the Blink program.

Click on Tools-Upload and wait a short while until all the text at the bottom of the screen stops scrolling.

If all went well you should see "Done uploading" on the IDE and no error messages.

If you look at the LinkIt One it should happily be blinking on and off once a second. The LED on the breadboard should be flashing at the same time.

If the external LED is not flashing there are some things to check:
Try taking the LED out of the breadboard, rotating it so that the legs are swapped and plugging it back in.
Make sure the wires are in the correct holes on the LinkIt One board (D13 and GND).
D13---resistor---LED anode (long leg)---LED cathode (short leg)---GND.

If you got any error messages here, leave them in the comments section below and I will try to help you.

Step 4: Where Next?

We have just seen how easy it can be to expand the LinkIt One and control things in the real world.

While we are not yet ready to control devices that use higher voltage or high current than the LinkIt One can handle it is just a matter of time before we get there.

Warning:
Never try to connect a high voltage or high current device directly to the LinkIt One as it is a low voltage, low current device and really BAD things can happen.

Never omit the resistor from the circuit. The resistor stops the LED drawing too much current which will permanently damage the LinkIt One.

Although a 1K resistor is not optimal, it is a good catch-all value that works with a wide range of LED colours.