If you’ve amassed a collection of smart devices, sensors, actuators and various other Internet-connected gadgets, how do you turn your Internet-connected components into an Internet of things (IoT) project?
Cayenne is a mobile app, online service and dashboard that aims to make the world of IoT more accessible. Once you have Cayenne installed on your Raspberry Pi, you’ll be able to build IoT projects simply by navigating various menus and selecting different buttons.
For newcomers, Cayenne takes a lot of the complexity out of creating IoT and home automation networks, while more experienced users will be able to use Cayenne to jumpstart their projects – cutting through all of that boring setup and boilerplate code, to get straight to the good stuff.
You’ll learn how to get Cayenne up and running on your Raspberry Pi, register all of your sensors, actuators and devices, and then create a simple temperature-based trigger in this article.
What is Cayenne?
Cayenne consists of the following components:
- Software that runs on your Raspberry Pi and is responsible for managing commands, triggers and alerts. You can install this software using the Cayenne mobile app or by running Terminal commands directly on your Raspberry Pi. Both methods are covered in this tutorial.
- The Cayenne cloud, which processes and stores all of the data from your Raspberry Pi.
- An online dashboard, which provides a graphical environment where you can build your IoT projects and manage all of the components you’ve registered with Cayenne.
What you’ll need
To complete this tutorial, you’ll need:
- Raspberry Pi 4
- SD card
- Laptop or computer where you’ll download the Raspbian system image
- Power cable that’s compatible with your model of Raspberry Pi
- Ethernet cable if not connecting over Wi-Fi
Depending on the method you use to install Cayenne, you may also need:
- External keyboard and way to attach it to your Raspberry Pi
- Micro HDMI cable
- External monitor
- Smartphone or tablet using Android or iOS
Once you have your tools, you’re ready to set up Cayenne.
Install the Raspbian operating system
To install the Raspbian operating system:
1. Download the latest version of Raspbian to your laptop or computer.
2. Insert the SD card into your computer or laptop.
3. Download and install Etcher if you haven’t already.
4. In Etcher, click “Select image” and choose the Raspbian file you just downloaded.
5. Click “Select target” and choose your SD card.
6. Etcher will now flash Raspbian to your SD card. Remove the SD card from your laptop or computer and insert it into your Raspberry Pi.
The next steps will vary, depending on whether you’re installing Cayenne using the mobile app or running Terminal commands directly on your Raspberry Pi.
Method 1: Using the Cayenne mobile app
Install Cayenne on your Raspberry Pi using the Cayenne mobile app:
1. Attach your ethernet cable to the Raspberry Pi.
2. Plug your Raspberry Pi into a power source. The device should boot automatically.
3. Download Cayenne to your mobile device.
4. Install and launch the app.
5. Tap “Open -> Create my free Account,” and register with Cayenne.
6. Log into your new Cayenne account.
7. Tap the “Find Raspberry Pis” button to locate your Raspberry Pi.
8. When your Raspberry Pi appears, give it a tap.
Cayenne will install the libraries and agents to your Raspberry Pi, reboot your Raspberry Pi, and finally install the software and drivers. This may take a few minutes, so it’s the perfect time to go grab a coffee!
Once all the necessary software has been installed, your Raspberry Pi will appear in the Cayenne dashboard.
Method 2: Running Terminal commands
Alternatively, if you don’t want to use the mobile app, install Cayenne on your Raspberry Pi using Terminal commands:
1. Attach your external monitor, keyboard and optional ethernet cable to your Raspberry Pi.
2. Attach a power cable, and your Raspberry Pi should boot automatically.
3. Complete the usual configuration, including connecting to Wi-Fi if you’re not using an ethernet cable.
4. Head over to the Cayenne website and create your free account.
5. Once you’re signed into your account, select “Add New -> Device / Widget.”
6. Select “Raspberry Pi.” The Cayenne console will generate an installer script you can use to download all of the necessary software to your Raspberry Pi.
7. On your Raspberry Pi, open a Terminal window by clicking the Terminal icon in the toolbar.
8. Type the Cayenne installation script into the Terminal and press the Enter key on your keyboard. Raspbian will now download all the necessary software to your Raspberry Pi.
After installation, your Raspberry Pi will reboot automatically. Following a successful reboot, your Raspberry Pi will appear in the Cayenne dashboard.
Troubleshooting: Cayenne can’t find my Raspberry Pi!
If Cayenne is struggling to locate your Raspberry Pi, then:
1. Check your network
Cayenne can only detect a Raspberry Pi that’s connected to the same network. Regardless of whether you’re using Cayenne for Android, iOS or via the web browser, check that you’re on the same network as your Raspberry Pi.
2. Search based on IP address
Whenever you scan for a device, you should see an option to “Search with an IP address.”
If Cayenne is struggling to locate your Raspberry Pi, then you may get positive results by clicking this link and entering your Raspberry Pi’s IP address.
You can retrieve this IP address by launching the Raspbian Terminal and running the following command:
Monitoring your Raspberry Pi with Cayenne
Use the Cayenne dashboard to view some stats about your Raspberry Pi, including its CPU, RAM and temperature.
Any of these statistics can be tapped as well to view the data that Cayenne has logged over time, which can help you identify trends in your device’s health and performance.
Building your IoT network: adding sensors and actuators
If you have any sensors or actuators on your network, you can add these components to Cayenne, at which point you’ll be able to monitor and interact with these components from the Cayenne dashboard. Note that the following steps are via the mobile app, so the user interface may be slightly different if you’re accessing the dashboard via the web browser.
1. In the Cayenne app, select your Raspberry Pi device.
2. Select the little speedometer icon in the toolbar.
3. Tap the little “+’ icon in the upper-right corner.
4. Find the sensor or actuator that you want to add and give it a tap.
5. Complete the subsequent form, and then tap either “Add sensor” or “Add actuator.”
You can now work with this component.
Create a temperature trigger
There are many different tasks you can perform from the Cayenne dashboard, but we’re creating a simple temperature trigger. In this workflow, Cayenne will generate a notification whenever this component exceeds a certain temperature threshold , which can be useful for ensuring components don’t overheat or for triggering broader home automation workflows, such as switching your heating on and off.
In the Cayenne app:
1. Select the Raspberry Pi device you want to work with.
2. Tap the little “Play” button in the toolbar, then tap the “+” icon in the upper-right corner.
3. Give this trigger a name, such as “Too hot” used here.
4. Tap the blue “+” button.
5. Find the sensor or actuator that you want to monitor and tap its accompanying “Temperature” button.
6. Select a temperature threshold.
7. Make sure “Sensor above” is selected.
8. Tap “then -> +”
9. Choose how you want to receive your notification, over email or SMS. Enter the necessary information and then tap “Done.”
10. When you’re happy with the information you’ve entered, tap the “Save” icon in the upper-right corner.
11. To activate your trigger, make sure the “Play” button is selected and push the slider into the “On” position.
You’ll now receive a notification every time this component exceeds the specified temperature threshold.
Now that you’ve set up Cayenne and familiarized yourself with the essential Cayenne workflow, you can continue adding devices, sensors and actuators, and use Cayenne to create triggers and rules for all of your IoT components, or better still, turn your Raspberry Pi into a edge gateway.
Our latest tutorials delivered straight to your inbox