1. Workshops
  2. pi
  3. Control an LED!

Control an LED!

Build an IoT project with Cayenne on your Raspberry Pi

Created by @1061999

Edit

Raspberry Pi has become an integral part of IoT projects.

The Internet of Things (IoT) is a system of interrelated computing devices, mechanical and digital machines, objects, animals or people that are provided with unique identifiers and the ability to transfer data over a network without requiring human-to-human or human-to-computer interaction.

In this project, we are going to use a “drag and drop” IoT project builder platform called Cayenne. With this platform, we can read sensor data, control actuators, etc. without having to worry about complicated code writing.

First of all, we are going to control an LED bulb using the Cayenne app (Cayenne can also be accessed through a browser).

Things Needed

All equipments are available for purchase from most electronic retailers. A great place to find them may be where you purchased your Raspberry Pi.

Turn on your Raspberry Pi and connect it to your network.

Then download the Cayenne app from the Google Play Store or Apple Store, or you can use the online version on their website.

  1. Create your free account.

Cayenne Sign In

  1. Click the + on the right top side to add new devices.

Cayenne List

  1. Select the Raspberry Pi icon

Add Device

  1. Follow the instructions and search for your Raspberry Pi

My Devices

Looking for Devices

  1. Cayenne will automatically detect your Raspberry Pi. If it did not automatically connect you, you can also manually type in the IP address of your Pi. See this workshop for how to find your IP address.

Your Raspberry Pi

  1. Select your Raspberry Pi and click setup. This will then initialize the installation of required files on to the Raspberry Pi.

Setup Button

  1. It will take 5 min or so to complete this setup. You can go enjoy a a nice afternoon snack while you wait, or you can just sit back and relax.

Installing Libraries

  1. Once it is done, select your device from the interface.

Select Device

  1. You will be able to see various parameters on the screen, and on the other tab you can see the state and details about GPIO.

Device Dashboard

Pin Dashboard

  1. Now connect your LED to your Raspberry Pi using a breadboard and two jumper wires. Follow the diagram below.

Circuit

Positive end of the LED should be connected to GPIO 17 of Raspberry Pi. The negative end can be connected to any of the GND available in the Raspberry Pi.

Follow the Raspberry Pi GPIO specification sheet for clarification.

⚠️ Don’t forget the resistor - directly connecting the LED will sometimes damage it!

  1. Click the + icon on the top right section of the first tab and select light from the actuators and then light switch.

Add Light

  1. Fill in the information needed as specified below:

  2. First field: Name it as Light switch

  3. Second field: Select Raspberry Pi

  4. Third field: Select Integrated GPIO

  5. Fourth filed: choose 11, since we have connected our LED to GPIO 17 which is on pin 11.

  6. Enable Invert Logic

  7. Leave the other two fields as is.

  8. Then click add button below.

Add Light 2

That’s it, you have successfully configured your Raspberry Pi. A button should appear on the interface. Now click that button that you have created, and you should see the LED turning ON! 💡

You have completed your very first IoT project. Since Cayenne is very easy to use, you can make your own projects by hooking up different modules and sensors. All you need is that maker mind and that passion to learn how things work. If you have any questions, Google is always your best helper!

We will be adding projects to this series in the future. For now, you can check out Cayenne’s website for more beginner-friendly tutorials!

Hack it away!

How was this workshop?

(your feedback is anonymous + appreciated 💚)

Made something rad?

Share it! 🌟

(posts are editable)

Twitter
Facebook

Want to edit this workshop?

Edit on GitHub