Welcome back on our IoT discussion and projects. We have completed the cayenne setup in the previous post. If you have not done yet kindly go through the post simple iot drag and drop app builder cayenne app
In this tutorial we will see how we can use Cayenne to control a device specifically to say a LED which is connected to one of the GPIO pin of your Raspberry pi. If you have not have setup your Raspberry Pi for the project, kindly refer my post setup raspberry pi 3 for your iot projects to know how to install the operating system and configure the Raspberry pi. You can also setup SSH configuration which will help you to control the Raspberry pi easily from your laptop. Refer the link how to enable ssh in raspberry pi
This tutorial is pretty simple as Cayenne gives us a software package with loads of features, we will use the basic features & keep it straight forward and pretty simple. I will be using Cayenne app for future projects, the main benefit for beginners is that you don't need to do any coding when using Cayenne.
What do you need:
The setup is similar to the one we had in controlling led with python script, refer the link lighting led with raspberry pi python script.
The circuit with Raspberry pi ( I have used Raspberry Pi zero W) Connect the PIN 7 which is GPIO 17 to the anode of LED & the PIN 6 which is the GND(ground) connect to the other end of resistor. Refer the above pic. Once we have the circuit setup & the raspberry pi is powered on, it is now time to configure cayenne app.
Go to https://mydevices.com and click on Sign in or you can go to https://mydevices.com/cayenne/signin/ directly to login to cayenne. You should have already setup the account if not follow my tutorial on it. Enter your registered email and password.
Once you login in cayenne , you will be able to see the dashboard page which gives the details of your raspberry pi. The dashboard gives you on the left the connected Raspberry Pi devices, if you have more than one devices connected it show all of them. If the device is online the color will be Red , if not it will be grey. Once you select your Raspberry Pi which is online, on the top right you will see the details of your device. For me it show as OS: raspbian 9 and Hardware: Raspberry Pi Zero W, yours will differ depending upon the OS & Pi you are using. The dashboard also shows the CPU , RAM and Storage usage. Also the temperature of Pi, network speed, you can also do reboot of shutdown of the Raspberry pi using the buttons on the dashboard.
Now we have to add the device LED and it should be connected to the GPIO PIN 17. Kindly check the link for GPIO pin details.
Click on Add New -> Device/Widgets which will take it to the screen to select the device.
Select Actuators -> Click on Generic -> Digital Output.
Once you click on Digital Output, we will get the options to configure the widget.
Select the Device --> Raspberry Pi MQTT ( in my case)
Connectivity -> Integrated GPIO
Channel -> Channel 17
Choose Widget -> Button
Choose Icon -> LED
And click on Add Actuator
The Widget is added to the home dashboard now & we are done. You can click on the LED Widget and the LED connected in Breadboard to your Raspberry Pi will Turn On . You can click again & the LED will Turn OFF. Isn't it very simple and no programming needed to do all these. You can do all these configuration in Cayenne through mobile application which is completely similar.
I hope you guys enjoyed this , We will see in upcoming tutorial with more interesting projects.