With the Internet of things, it's best to start by using a developer board for prototypes -- and Photon has the singular advantage of connection to the cloud Credit: Shutterstock An interesting problem faces hardware and software developers building Internet of things products: How do we connect them to the wider Internet? It’s fine building directly connected Arduinos or using Raspberry Pi’s built-in Ethernet port. But if we’re going to get the most from a world full of sensors and actuators, we’ll need to build on wireless technologies — the Wi-Fi and cellular networks that we use to connect ourselves and our devices. Unfortunately, a major problem stands in the way: The wireless world isn’t really designed to handle devices, especially single-purpose units infused with firmware rather than software. Luckily, we have options. We could build on the machine-to-machine model used by cellular operators, with unique device identifiers (IMEIs and phone numbers) that handle authentication and connection, treating our devices like apps. Alternatively, for such hardware as the Arduino Yùn, we could use a hybrid of firmware and software, with a wireless application processor sharing memory with a microcontroller’s firmware. Photon’s cloud connection Particle’s $19 Photon board presents another option. I picked up a dev kit at the Maker Faire back in May, and I’ve been playing with it since then. Like many developer boards, it uses the ARM Cortex M3 processor and features plenty of I/O ports. The Photon’s connectivity sets it apart with a Wi-Fi module built around a Broadcom Wi-Fi chip set, allowing 802.11b/g/n access to the Internet. More important is Particle’s cloud device connection service, which provides a bridge between the device and your applications, along with an environment for writing code and updating and managing devices. Getting started with Particle’s service and developer boards is easy enough — simply download an iOS or Android application. Use the app to create a Particle account, which gives you access to your devices through the company’s cloud service. You then use the phone app to connect to a Photon developer board and configure its Wi-Fi connection. The first time you connect, it downloads a firmware update. Writing code on Photon Once you’re set up, you can start writing code. You’ll find working with Photon very much like working with any other developer board, using a C-like language with direct access to the Photon’s digital and analog ports. However, unlike other boards, Particle’s firmware includes functions that handle connection to its cloud service — which you link to your board during setup. Cloud API calls use Spark.function calls, linking a cloud call to a local function — for example, a cloud function led can be linked to a local ledblink() function. The approach simplifies linking firmware functions with external applications, providing an easy way of mapping the two sides of an application. A Spark.function always takes a string as an argument and always returns an integer. Sending a string makes sense: Your device-side code can use different strings to toggle different options, allowing you to set digital outputs on and off or change the combination of outputs that are being controlled. It’s also easier to send back an integer, because analog-to-digital converters normally deliver integer outputs. You can use component specifications to convert the resulting integer return to a temperature or light level. The Particle cloud Particle’s cloud service can be best thought of as a Twilio for the Internet of things. It’s actually the heart of the company’s business; the developer boards and the Wi-Fi module are on-ramps to the service. The idea is that Photon is for prototyping only. Particle caters to companies that may scale to manufacturing hundreds of thousands or millions of devices — which, at that level, will use their own silicon. Particle helps its customers develop their own modules in conjunction with its silicon partners. As with Twilio, you work with a cloud REST API, where each device has a hard-coded ID. You use your account ID to authenticate calls — so you’ll pass calls through server apps to ensure users don’t get access to your tokens. With REST support in most platforms, there’s no need to work with public pages, especially if you use tools like Node-red to build your IoT applications. Devices can be renamed, so you’ll probably want to want to create a naming scheme for all your devices to simplify building code that can call multiple devices. Build it yourself Particle’s Photon dev kits come with components and a breadboard to help you get started with hardware design, and the phone app provides a useful set of tools for working directly with the hardware without writing a line of code. The basic Photon firmware comes with a UI that lets you work with sensors and outputs, so you can build circuits and understand how they interact with the Photon board before you begin programming. It’s important to remember that Photon code is firmware and best considered as a way of linking sensors and actuators to the cloud — where most of your business logic will run. You’ll find a copy of the basic Tinker firmware in the Web IDE, so it’s easy to fork your own versions and start building your own applications. You can also flash devices directly over USB, so you can use ARM development tools and compilers to build your own low-level code. This option makes sense if you’re going to use Particle’s module and services as the basis for your hardware. Boards like Photon are great for anyone who wants to explore the Internet of things. You get an easy-to-program set of cloud APIs for your applications, as well as a cloud IDE that makes it easy to write I/O code for hardware. While the hardware and development tools are interesting, the APIs make the most sense. Simplifying the connection between cloud and devices means you can concentrate on what really matters: building applications and services. Technology Industry