Connecting the Raspberry Pi to the Particle Cloud (beta)

You may have heard from Particle and their range of microcontroller boards such as the Core, Photon and Electron. Their platform, the Particle Cloud, offers many interesting features for IoT projects: remote firmware upgrade and code upload, secure and encrypted communication to the web and much more. And now, the Particle Cloud supports the Raspberry Pi, allowing you to run Arduino code on your Pi!

The initial beta has launched, and a first batch of people have been given access. Should you be interested in trying this with your own Pi, you can sign up for the beta here to gain access in the near future.

In this post, I cover the setup of the particle agent on the Raspberry Pi, including some examples.


You will require the following before getting started:

I’ve set up my Raspberry Pi completely headless. After flashing the latest Raspbian image to my SD card, I copied my “wpa_supplicant.conf” file to the SD card. When the Pi first boots, this config is copied to the right location and the Pi should connect to the network automatically. You can then retrieve the Pi’s IP address from your router in order to access it via SSH.


As of 25/11/2016, SSH has been disabled by default on every new installation of Raspbian.
To restore SSH access, add an empty text file called “ssh” to the SD card. 

screen-shot-2016-12-03-at-17-41-49 screen-shot-2016-11-23-at-10-15-14

Particle Agent

The Particle Agent is required on the Pi so it can connect to the Particle Cloud. The installation couldn’t be easier, as it requires you to execute only a single command:

At the end of the installation you will be prompted with some questions so the agent can be linked to your own Particle account.

If at any point, you would like to change the values you entered, such as the Pi’s name for example, simply re-run the setup of the agent:

That’s it! Your Pi should now appear in the Particle IDE and be ready for programming with Arduino code.



I’ve created two examples to show some of the capabilities, a basic one, and a more advanced one.


The “Hello World” of many electronics projects: blinking an LED. More specifically, the Pi’s green status LED.

The status LED is connected to the Pi’s GPIO19, which according to Particle’s datasheet, maps to pin “D7”. So by constantly toggling D7, the status LED blinks.

screen-shot-2016-11-27-at-00-36-03 particlepi-blink

The code:

Temperature Warning

This more advanced project involves running commands on the Raspberry Pi from Particle, retrieve the output and use it to trigger different actions.This project can be split into following parts:

  • retrieve the Pi’s temperature via command line
  • if temperature exceeds certain value (e.g. 60°C), trigger:
    • a local warning by flashing LEDs
    • a remote warning by sending a notification

Retrieving the temperature

The temperature of the CPU can be retrieved from the command line of the Pi:

This same command can be run from the Particle program using the “Process::run()” call. The returned value can then be used to make decisions within the program.

Local Warning

The local warning is created by blinking a Pimoroni Blinkt in red. This can be achieved by using the “” example included in the Blinkt installation and passing the RGB values for red and black in an alternating fashion.

Remote Warning

The remote warning relies on an IFTTT (“If This, Then That”) applet which listens for Particle messages. These messages are sent from the code using the following command:

So if an event is published on theParticle channel, for device “fvanPiOne”, with event name “cpu_temp”, then trigger the Notification channel to send a message containing the value of the event (the temperature).

screen-shot-2016-12-03-at-18-16-20 screen-shot-2016-12-03-at-18-16-37 screen-shot-2016-12-03-at-18-17-21


Assembling all the pieces, the full code for this project becomes:

To see this code in action, check the demo below.


In this demo, the “stress” application is launched to heat the CPU. When it reaches 60°C, the LEDs start blinking and a notification is triggered. After some time, the notification appears on the phone.



The software is easy to install and I haven’t encountered any real problems yet myself. Since this is still in beta, updates are being pushed frequently, so it’s important to update your installation on a regular basis! Make use of the community forums to read about issues other users have experienced, or to submit your own. This beta has a lot of potential, though a lot of work is still required to make the online libraries compatible with the Pi (MQTT, NeoPixel, …). Let’s see how things evolve.


Is it something you would consider using? What would you program with it? Let me know in the comments!

One thought on “Connecting the Raspberry Pi to the Particle Cloud (beta)

Leave a Reply

Your email address will not be published. Required fields are marked *