Getting started with the Particle Photon

I love using all flavors of Arduino in the engineering classes I teach. They're great tools, and students do some truly awesome stuff with them. More and more, students want to build connected devices.  This used to require an expensive WiFi shield or Ethernet shield, or require the students to switch to developing on a Raspberry Pi.

Enter the particle Photon: a promising tiny Arduino-based micro-controller with WiFi for only $20.  This opens up a huge world of possibilities for Arduino-based projects... once you get it working

The web-based IDE

At its core, the photon was designed to be programmed via their app and their web-based IDE.  While in principle, this sounds great, I found the two hard to use and lacking functionality.  The first hiccup is the Photon couldn't get past the authentication page for my university's WiFi. Resolving this took a lot of patience working with our school's IT department, and while this isn't exactly Particles fault, it was still annoying.  Once running, it was easy enough to blink an LED and view sensor data from the cloud (very cool).

However; when I took my photon home, it took a lot of work to connect to my very old router. Here's the post that saved the day on that front.  After that I had problems with my photon loosing connection to said router every 5-15 minutes, and then locking up until i manually reset it.

Maybe I'm old school, but I  just want to write some code... and then flash flash it to my device over the USB cable, not the web. And I want my LEDs to blink, buttons to press, and servos to spin even when I don't have an internet connection....

CLI: the back door

On a Mac, the only errors I got were easily fixed by saying please. (or sudo)

The good news is all this is possible with the particle photon.  The bad news is at that next level that takes quite a bit of extra effort. The Command-Line Interface (CLI) lets you compile code and flash it using your own text editor and terminal prompt. Instructions to install the CLI are available for Windows and Mac, but on my windows computer I found it to be impossible to get working. (I think installing python 2.7 and visual studio are the two steps missing from the windows instructions... but the Microsoft visual studio installer kept crashing on my Microsoft Surface running Microsoft windows 10!)

Once you do get everything set-up, compiling and flashing your code is a breeze.

  1. Write some code in your favorite text editor. Mine is sublime text 2.
  2. Compile it from the command prompt. This is well documented on Particle's website. An example compile might look like:
    particle compile photon GitHub/smartLamp --saveTo firmware.bin
  3. Put your photon in DFU mode. Hold both buttons, then release the RST button. Wait for the light to flash yellow, and then release the other button.  This tells the photon there is some incoming code
  4. Flash your code. This is also well documented.
    particle flash --usb firmware.bin
  5. Enjoy! (Note: If you want to debug your photon, using the CLI or the web-IDE, you might

Some extra tips

I love me a good API, and the particle has a lot of really cool baked-in functionality that is well-documented. My favorites include:

Note: Many of these projects, and ones i've tackeled, have required you to start your code with


This maneuver seems to open a lot of functionality and control, but you also loose the ability to run the web IDE at this point.

I've got a couple projects i'll post shortly. In the meantime... happy hacking!