I think it was two years ago, at the IoTConf in Berlin, that a chap called Sven raved about a small little device called the “Spark Core”, but I disregarded that, because he said the word “cloud” several times in one sentence. ;-) I should have a) paid more attention, and b) looked more carefully.
A lot of water has since flowed down rivers, and I stumbled over a device called the Photon recently, only to discover that it is the successor to the Core. Be that as it may, I ordered a Particle Photon, the successor to the Spark Core. It took me 8 minutes to get it running and publishing via MQTT to my broker. I’ve fallen in love with the little beast, and I’ll tell you why.
The small device has on-board WiFi, an RGB LED, 18 GPIO peripherals, and is programmed as an Arduino is; before I forget, the Photon costs $19 which should be quite a bit less than an Arduino with WiFi…
When first starting a Photon, I can talk to it with an Android or iOS app by connecting to the wireless AP the Photon provides, or I can use the
particle-cli (which I did). Basically, I just specify my WiFi SSID and password, and the Photon can then happily connect to the Particle cloud. (It appears to me by a glance at the firmware that they use CoAP for cloud-communications. Yes, they do.)
When writing a sketch I don’t have to do anything for the Internet connection: it’s just there (i.e. no special code required). Furthermore, Particle provide functions with which I can post a few variables and have them visualized in their dashboard. Conversely, I can register a function which is invoked on the Photon when I HTTP POST to their API endpoint. This is how the default sketch (which Particle seems to call “firmware”, but I mean “app”) called “Tinker” works: the Android/iOS apps (for which the source code is also available) speak to an API endpoint which in turn invokes a function in the app on the Photon.
On Particle’s build site, I can create an app (an Arduino sketch, basically) using their Web IDE and compile that. One click of a button (top left of the screenshot above), and that app is transferred over the air (OTA) to the Photon which stores it in flash and resets itself to run the sketch. OTA software upgrades of your Things; think about that for a moment, by which I mean two things: ease of deployment and potential security implications. Let me think positively for a minute and concentrate on the first point: you’ve developed a Thing and want to change the code it runs; in the case of your typical microcontroller, you’d have to dismantle it and bring it back to your workspace to reprogram it; not with a Photon – you simply redeploy your code OTA. This is grand!
The question is, could I decouple a Photon from Particle’s cloud? It appears to be possible. Their firmware is available, and the instructions for building and flashing a Photon seem sufficient. (I haven’t tried this yet as I don’t yet want to brick my little Photon.) Looking around a bit, I see I can change the RSA keys used by the Photon to communicate with their API, and Particle also give us the source to an API-compatible server for devices which speak the Spark protocol, i.e. the Photon.
Particle’s documentation is excellent (and you can clone a copy for local use). There’s a lot to read (introduction, the guides, and the function reference), and there are plenty of examples. The How to build a product section of the documentation surprised me a little, until I realized that Particle sells what they call
P1, which are basically the chip and WiFi modules which I can embed in my own products; these are sold in quantities of 10 in their store.
Another interesting product on Particle’s horizon is the Electron, basically a Photon with GSM connectivity which includes a SIM card and data plan. I say interesting because it ought to be well suited for projects out in the wild, far away from WiFi. As far as I’m concerned though, offering O2 connectivity in Germany is not good, as their coverage is severely lacking in many areas.