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
- A Raspberry Pi connected to the internet
- Breadboards
- An LED
- 220Ω resistor
- Female to male jumper wires
- An Android phone or a computer connected to the same network
All equipment is available for purchase from most electronic retailers. A great place to find it 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.
- Create your free account.
- Click the + on the right top side to add new devices.
- Select the Raspberry Pi icon
- Follow the instructions and search for your Raspberry Pi
- 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.
- Select your Raspberry Pi and click setup. This will then initialize the installation of required files on to the Raspberry Pi.
- 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.
- Once it is done, select your device from the interface.
- 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.
- Now connect your LED to your Raspberry Pi using a breadboard and two jumper wires. Follow the diagram below.
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!
- Click the + icon on the top right section of the first tab and select light from the actuators and then light switch.
- Fill in the information needed as specified below:
- First field: Name it as Light switch
- Second field: Select Raspberry Pi
- Third field: Select Integrated GPIO
- Fourth filed: choose 11, since we have connected our LED to GPIO 17 which is on pin 11.
- Enable Invert Logic
- Leave the other two fields as is.
- Then click add button below.
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!
This workshop was created by @1061999 for Hack Club. Full credits to all co-authors. Their original work is licensed under the CC BY-SA 4.0 which allows for the work to be redistributed.