Connecting leds to your raspberry pi using cayenne

 The first component that I will cover is the humble LED. A right of passage for all Raspberry Pi owners is to get a LED to blink using a few lines of code and some simple circuit building. With the use of Cayenne, the LED can be connected to the PI without the need for a single line of code to be written, and then can be controlled from a computer or smartphone anywhere in the world! Smart, huh? 

What you'll need: 

As the T-Cobbler is simply a way of connecting all of the Pi's GPIO pins to a breadboard, this is completely unneccessary, however it makes it a lot easier to connect the components, and as the system gets more complex with other components, it becomes more and more useful. Without a T-Cobbler, male to female jumper leads can be used to connect the individual GPIO pins to the breadboard for use with the components.


How to connect an led to cayenne

  1. Connect your Pi Cobbler to your breadboard as shown on the right.
  2. Connect the GND pin on the Cobbler to the negative power rail on the breadboard with a Male-to-Male Jumper wire.
  3.  Insert the 270Ω Resistor into the negative power rail and row 4 of the breadboard. Then insert the short leg of the LED into the same row, and the long leg into row 5. 
  4. Connect row 5 of the breadboard to #16 on the cobbler.
  5. Finally, connect the ribbon cable to the socket on the Cobbler, and to the Raspberry Pi's GPIOs, ensuring that the cable leaves the Raspberry Pi facing outwards. 

The circuit diagram below shows the layout of the circuit.

(Pictures from left to right, top to bottom)




(These instructions based on using a desktop PC, however a smartphone could also be used)
  1. Log onto Cayenne  on your desktop computer, and ensure that your Pi is powered on and connected to the system, as shown here. 
  2. Navigate to the 'Add new...' menu in the top left of the screen, then click on 'Device/Widget'. Your screen should look like the screenshot on the right.
  3. Then click on the 'Generic' option in the 'Actuators' section.
  4. Next, select 'Digital Output'.
  5. Fill in the boxes, ensuring to select 'Integrated GPIO' in the 'Connectivity' box, and '16' in the 'Channel' option. When complete, the options should look like the screenshot to the right.
  6. Once complete, click on the 'Add Actuator' button. You should now be taken back to your dashboard where a new widget, like the one shown below, will be shown. Clicking on the button will toggle the LED between on and off.

Log onto Cayenne and start setting up your IoT life by clicking here.


(Click to enlarge pictures above)