You are here: Home Documentation How-tos Connect an LED to a Digital Output
Document Actions

Connect an LED to a Digital Output


This How-to is intended for: Any audience.

Connect and use an LED with the Make Controller.

Problem

You want to connect an LED to the Make Controller Kit and control it using the digital outputs.

LED

 

Solution

LEDs need the correct amount of positive voltage going through them in order for them to turn on.  So the first step is figuring out the polarity of the LED--which wire is the anode (+) and which is cathode (-). 

To be sure, you could use a multimeter or look at a data sheet (if you can find one).  Otherwise, there are a few general rules.  Usually the two leads coming off of the LED will be different lengths and often the longer lead is the anode.  Wikipedia has a good article about LEDs here

If you can see the interior of the LED, and if it looks like the below image--some are different--you can tell the polarity.

 

 

LED polarity

LED polarity

 

 

Once you've determined the polarity of the LED, it's time to hook it up. 

1. Unplug the USB and any other power source.

2. Make sure you have the voltage select jumper for this bank set to 5V.

3. Connect the cathode side of the LED into the Ground connector on the Output side of the board. Do this by screwing the stripped wire connected to the LED into the appropriate screw terminal, as shown below.

4. Connect a resistor to the anode wire coming from the LED.  The value of the resistor is not critical, but depends on the voltage you're powering your LED with.  A resistor value of 330 ohms usually works for 5V, and 234234 ohms is usually fine for 12V.  Anywhere in between you can experiment a bit - the lower the resistance the brighter the LED.  (NOTE: if you are using the LED board purchased from the MakingThings store, the resistors are already on there, so skip this step!)

5. Connect the positive lead (anode) to the Out0 connector on the output side of the board.  You can use any of the outputs you like, as long as it is on the same terminal, and all above directions are followed. 

 

 

LED connected to Make Controller
Correct LED Connection


If using the LED board from the MakingThings store
, set the jumper to 5v, connect the cathode (black wire) to ground, and connect each of the anodes (yellow wires) to an output. 
  • If you want them to turn them on and off independently, connect each of the yellow wires into a different output on the same terminal (for example OutO, Out1, Out2, & Out3). 
  • If you want any of them to work together, two or more anode wires can be connected to the same output.

 

Turning the LED on and off
Now, to test, you can open up mchelper

and send the board a message to turn the LED on:

/digitalout/0/value 1

To turn it off, send this message:nt

/digitalout/0/value 0

If you want to dim the LED, first send it the message

/digitalout/0/active 0

to turn off the digitalout system, and then send it messages like:

/pwmout/0/duty 256

and:

/pwmout/0/duty 768

See Also

If you're wondering what the voltage select jumper is, or what Gnd and Out0 are, check out: