IoT Development Platform: PlatformIO

PlatformIO logo

A number of IoT Platforms made the Codeguru list of “Top IoT Platforms for Developers,” including PlatformIO. In evaluating PlatformIO, the structure recommended in “How to Evaluate IoT Platforms for Developers” was used. This will make it easier for you to compare various IoT platforms.

Much more than an IoT Platform, PlatformIO is a free, open source ecosystem for IoT development. It comes with its own cross-platform IDE and unified debugger as well as remote unit testing and firmware updates.

To give you an idea of its scope, PlatformIO includes these features:

  • 23 Development Platforms
  • 13 Frameworks
  • 432 Embedded Boards
  • 61 Project Examples
  • 1,798 Libraries
  • 8,329 Library Examples

Key Features

IoT Hardware Support

PlatformIO currently supports over 400 boards from leading manufacturers, and are constantly adding new ones.

IoT OS Support

PlatformIO was designed to build the same source code for the different development platforms via a single PlatformIO run command without any external software or requirements dependencies. To do so, PlatformIO uses its own pre-configured platforms data, including build scripts, toolchains, embedded board settings, and so forth.

PlatformIO’s embedded and Desktop development platforms work under popular host OSes Mac, Linux (+ARM), and Windows. These are described in more detail below.

Embedded Platforms:

  • Atmel AVR
  • Atmel SAM
  • Espressif 32
  • Espressif 8266
  • Freescale Kinetis
  • Intel ARC32
  • Lattice iCE40
  • Maxim 32
  • Microchip PIC32
  • Nordic nRF51
  • Nordic nRF52
  • NXP LPC
  • Samsung ARTIK
  • Silicon Labs EFM32
  • ST STM32
  • Teensy
  • TI MSP430
  • TI TIVA
  • WIZNet W7500

Desktop Platforms:

  • Linux ARM
  • Linux i686
  • Linux x86_64
  • Native
  • Windows x86

Key Sensor Support

Hundreds of popular libraries are organized into the platform with advanced search-by keywords, missed or known headers, and so forth. These include drivers for just about every conceivable device and sensor. For example, here’s a driver for the Adafruit DHT Temperature and Humidity Sensor:

// DHT Temperature & Humidity Sensor
// Unified Sensor Library Example
// Written by Tony DiCola for Adafruit Industries
// Released under an MIT license.

// Depends on the following Arduino libraries:
// - Adafruit Unified Sensor Library:
//    https://github.com/adafruit/Adafruit_Sensor
// - DHT Sensor Library:
//    https://github.com/adafruit/DHT-sensor-library

#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

// Pin which is connected to the DHT sensor.
#define DHTPIN      2

// Uncomment the type of sensor in use:
// #define DHTTYPE        DHT11      // DHT 11
#define DHTTYPE           DHT22      // DHT 22 (AM2302)
//#define DHTTYPE         DHT21      // DHT 21 (AM2301)

// See guide for details on sensor wiring and usage:
// https://learn.adafruit.com/dht/overview
...

Here are just a few of the supported libraries:

  • Adafruit BME280 Library@1.0.4
  • Adafruit BMP280 Library@1.0.2
  • Adafruit BMP085 Library@1.0.0
  • ArduinoJson@5.8.4
  • DHT sensor library@1.3.0
  • OneWire@2.3.2
  • DallasTemperature@3.7.7
  • DNSServer
  • ESP8266HTTPClient
  • ESP8266WebServer
  • ESP8266WiFi
  • ESP8266_SSD1306
  • ESP8266httpUpdate
  • ESP8266mDNS
  • EspSoftwareSerial
  • OneWire
  • SPI
  • SparkFun HTU21D Humidity and Temperature Sensor Br@1.1.3
  • Ticker
  • mikalhart/TinyGPSPlus#88c9db5c7491a2877bdd29edac6f8fff40862215
  • WifiManager@0.12
  • Wire
  • LiquidCrystal_I2C

IoT Data Considerations

Device libraries also include routines for managing data. For example, the FlashStorage library aims to provide a convenient way to store and retrieve a user’s data by using the non-volatile flash memory of microcontrollers.

There are also libraries for serialization of data, FAT16/FAT32 file system for SD cards, and an Arduino library for real-time logging and streaming data to online plotly graphs.

IoT Security Considerations

Security is not baked right into the platform as it is with some of the larger ones, but it does offer security-related libraries such as SpritzCipher. It’s a Spritz library for Arduino, CSPRNG, cryptographic hash and MAC functions, as well as symmetric-key data encryption.

Development and Deployment Considerations

A feature of PlatformIO, called PIO Remote, allows you to work remotely with devices from anywhere in the world. By running a small and cross-platform PIO Remote Agent on a remote machine, you are able to list active devices (wireless + wired), to upload firmware (program), to process remote unit tests, or to start remote a debugging session via Remote Serial Port Monitor.

By using PIO Remote, you also can share your devices with colleagues across your organization or friends. In combination with Cloud IDE, you can access your IoT projects at any time. You just need a free PIO Account to work with PIO Remote.

PlatformIO Core PIO Remote builds project on a host machine and deploys final firmware to a remote device.

Cost and Licensing of IoT Platforms and Solutions

There are four pricing options available:

Community

Includes the following features:

  • PlatformIO IDE
  • PlatformIO Core
  • Continuous Integration
  • Standalone IDEs Integration
  • 30-Days Free Trial for Basic Plan

Basic

Includes everything in Community, and:

  • PIO Remote™
  • PIO Unified Debugger
  • PIO Unit Testing
  • Cloud IDEs Integration
  • Static Project Analysis
  • Cloud Builder

Professional

Includes everything in Basic, and:

  • Unlimited PIO Remote™
  • Access to PlatformIO Club
  • Premium support with 8 hours response time
  • Hot bug fixes
  • PIO Delivery™

Enterprise

Includes everything in Professional, and:

  • Volume Licensing
  • PIO Cloud Enterprise Server
  • Comprehensive Consulting
  • Technology Services
  • System Integration
  • Premium support with 1 hour response time
  • Priority features

See http://PlatformIO.org/pricing for full details.

PlatformIO

Company: PlatformIO

Key features:

  • IDE
  • Build system
  • Unified debugger and library manager
  • Support for more than 400+ development boards, 20+ development platforms, and more than 10+ frameworks
  • Rapid professional development with built-in C/C++ Intelligent Code Completion, Smart Code Linter, and advanced Serial Port monitor
  • PlatformIO can be integrated with the popular IDEs and continuous integration systems to speed up time to delivering IoT applications

Programming Environment/Tools: The IDE is built on top of GitHub’s Atom “hackable” text editor and Microsoft’s Visual Studio Code.

The debugging screen
Figure 1: The debugging screen

PIO Unified Debugger:

  • Support for 100+ embedded boards (see below)
  • Multiple architectures and development platforms
  • Windows, MacOS, Linux (+ARMv6-8)
  • Built-in into PlatformIO IDE for Atom and PlatformIO IDE for VSCode
  • Integration with Eclipse and Sublime Text

PlatformIO Core:

PlatformIO Core is a heart of whole PlatformIO ecosystem and consists of the following:

  • Multi-platform Build System
  • Development platform and package managers
  • Library Manager
  • Library Dependency Finder (LDF)
  • Serial Port Monitor
  • Integration components (Cloud and Standalone IDE and Continuous Integration)

PlatformIO Core is written in Python 2.7 and works on Windows, MacOS, Linux, FreeBSD, and ARM-based, credit-card sized computers (Raspberry Pi, BeagleBone, CubieBoard, Samsung ARTIK, and so on).

PlatformIO Core provides a rich and documented Command Line Interface (CLI). The other PlatformIO-based software and IDEs are based on PlatformIO Core CLI, such as PlatformIO IDE. In other words, they wrap PlatformIO Core with own GUI.

Note: You do not need to install PlatformIO Core because it is included with the IDE.

OS/Languages:

  • Windows, MacOS, and Linux
  • C/C++

Target audience: Intermediate to advanced developers

Most recent update/stable release:

  • PlatformIO IDE for VSCode: v0.7.3
  • PlatformIO IDE for Atom: v2.0.0-rc.3

License:

Free version is licensed under Apache License Version 2.0.

Other subscriptions are bound by the PlatformIO Plus License Agreement.

Conclusion

PlatformIO might just be the fastest IoT development platform, perhaps with the exception of Arduino. It allows developers to write their code and not care how the underlying libraries are written or how the IDE compiles the source code. Moreover, there is no need to set up a tool chain because PlatformIO downloads everything you need the first time you use it.

Another big plus is PlatformIO’s solid reference material; there is lots of good documentation throughout GitHub and the PlatformIO site.

When it works, it works really well. The problem is when it doesn’t. In those rare instances, you may have to do some digging to resolve the issue. Sometimes in building the toolchain, you have more control over the process, and know better where to look when troubleshooting.

PlatformIO is one of several IoT Platforms to make our list. You can find the others in the IoT area of Codeguru!

Robert Gravelle
Robert Gravelle
Rob Gravelle resides in Ottawa, Canada, and has been an IT guru for over 20 years. In that time, Rob has built systems for intelligence-related organizations such as Canada Border Services and various commercial businesses. In his spare time, Rob has become an accomplished music artist with several CDs and digital releases to his credit.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read