How to run Particle on Raspberry Pi (Headless on Pi Zero W)

Hardware components:
475267 240424 01 front zoom kankcmvqdh
Raspberry Pi Zero Wireless
× 1
Software apps and online services:
Particle CLI
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

How to run Particle on Raspberry Pi (Headless on Pi Zero W)



In October of 2016 Particle announced that they would add support for Raspberry Pi on their IoT cloud platform. I was in the first community focus group and was one their alpha testers. Now that Particle has publicly announced their support for Raspberry Pi, anyone can sign up for the Open Beta.

Particle on Raspberry Pi allows you to bring the features of the Particle Cloud to the full features of Raspberry Pi and create amazing projects that could not have been easily created previously.

With Particle on Raspberry Pi, you can use the same C++ code for Particle’s other devices to create powerful solutions.

Particle on Raspberry Pi provides complete access to the forty IO pins on Raspberry Pi, allowing you to do digital and analog interactions with your favorite electronics. Additionally, Particle on Raspberry Pi allows you to create functions for calling virtually any Bash command or script present on Raspberry Pi, facilitating dynamic, flexible interaction from within firmware.

Currently, Particle on Raspberry Pi is optimized for the Raspberry Pi 3, the Raspberry Pi 2, the Raspberry Pi Zero, the Raspberry Pi B+, and the newly released Raspberry Pi Zero Wireless.

Basic Setup

Read below for full setup.

The first step is to make sure your Raspberry Pi is updated to the latest version of Raspbian Jessie and it is connected to your network. Update your Pi’s software using the following command:

 $ sudo apt update && sudo apt upgrade 

Next, once you have been accepted into the Raspberry Pi on Particle Beta, run the following command on your Raspberry Pi to install particle-agent:

 $ bash <( curl -sL ) 

During the installation of particle-agent, you will be asked to log in using your Particle credentials in order to claim your Raspberry Pi to your account.

Once the installation has completed, you can use your Raspberry Pi with Particle’s tools. You can build and flash firmware using the Web IDE, Particle Dev, particle-cli, or po-util to build locally.

Running bash commands with Particle

Particle on Raspberry Pi supports running bash commands and scripts as Linux processes from within the firmware. Input can be supplied with arguments and stdin, and output can can be captured for use in your firmware.

Here is an example for retrieving the internal CPU temperature of the Raspberry Pi:

# include "Particle.h"
int getTempC(String args)
  Process proc = Process::run("vcgencmd measure_temp");
  proc.wait(); // The output is temp=43.5'C, so read past the = and parse the number
  float cpuTemp = proc.out().parseFloat();
  Particle.publish("cpu-temp", String(cpuTemp));
  return 0;
void setup()
  Particle.function("getTempC", getTempC);
void loop()
  // Nothing in the loop

Input and Output

With Particle on Raspberry Pi you can control the numerous pins on Raspberry Pi. Many of them are digital inputs and outputs, with several of them able to perform protocols like I2C, SPI, and UART. A few of the pins are capable of analog write through PWM (Pulse Width Modulation). Raspberry Pi’s do not have native analog input capability, but one could use an ADC to obtain analog readings.

Read More: How to run Particle on Raspberry Pi (Headless on Pi Zero W)

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top