Qt and the Internet of Things - Part 2
By Jeff Tranter | Wednesday, March 30, 2016
This is the second and final installment of my blog series on Qt and the Internet of Things, based on a presentation (1) I gave at the Qt World Summit 2015 entitled The Internet of Things: What Is It and Why Should I Care?
In the first blog post I discussed what IoT was, covered some terminology and sample products, projected growth and market opportunities and what it means to software developers.
In this post, I will look at some of the popular hardware platforms for IoT, mention a few of the key protocols, hardware technologies and software frameworks and discuss some of the areas where IoT is relevant to Qt. We'll finish up with a discussion of some of the risks, challenges and criticisms and I'll list some references to more information.
Popular Hardware Platforms
There are many popular hardware platforms for IoT. Commercial products designed for high production volumes generally use custom designed hardware, but for hobbyists, prototyping and low volume applications there are some standard off-the-shelf platforms that can be used.
Arduino (2) is an open source hardware and software platform based on Atmel AVR microcontrollers and ARM processors. It is a family of products with different price points and features. These are low cost devices and much of the attraction comes from the Arduino integrated development environment (IDE) which uses the C++ programming language and presents a very short learning curve to programming. The applications run on the bare hardware without an operating system.
Raspberry Pi (3) is a family of low-cost (as little as $5) credit card-sized single-board computers that use a Broadcom system on a chip (SOC). It can run various operating systems ranging from Linux to Windows 10 IoT. The high-end Raspberry Pi 3 has a quad-core 64-bit ARM Cortex-A53 CPU, a VideoCore IV dual-core GPU and 1 GB of RAM and retails for US$35.
BeagleBoard and BeagleBone (4) are low-power open-source hardware single-board computers produced by Texas Instruments. They use an ARM Cortex-A8 CPU and can Linux or Android.
Intel Galileo (5) is an Arduino-certified development board based on the Intel x86 architecture. It uses an Intel Quark X1000 400 MHz CPU and runs a Yocto-based embedded Linux. The similar Intel Edison model is aimed at wearable computing.
Raspberry Pi 2 (image credit: Jeff Tranter)
Key Protocols, Hardware Technologies, Software Frameworks
Let's look at a few key protocols, hardware technologies and software frameworks that are relevant to IoT, starting with CoAP.
CoAP (6), or Constrained Application Protocol, is a software protocol for simple devices to communicate over the Internet. Standardized as RFC 7252, it is targeted at small low-power sensors, switches and valves etc. that need to be controlled or supervised remotely, through standard Internet networks. It features multicast, low overhead, a REST model, and runs over UDP packets optionally with DTLS encryption. Currently there are more than 25 implementations for various platforms, one example being cantcoap (7) which offers C and C++ APIs.
BTLE is Bluetooth Low Energy (sometimes referred to as Bluetooth LE, BLE or Bluetooth Smart). It is a wireless personal area network technology that support peripherals (called servers) that are designed to operate for months or years on battery power. Aimed at applications in healthcare, fitness, beacons, security and entertainment, it features reduced power consumption and cost and enhanced range as compared to Classic Bluetooth (with which it is not backwards-compatible). It is supported by most mobile platforms, and since Qt 5.5 is supported on Android, iOS, Linux and OS X.
OMA LWM2M (9) is the Open Mobile Alliance Lightweight Machine to Machine protocol for IoT device management. It defines the application layer communication protocol between an LWM2M Server and LWM2M Client, which is located in a LWM2M Device. It includes device management and service enabling for LWM2M Devices and is frequently used with CoAP. LWM2M provides device management functionality over sensor or cellular networks, can transfer service data from the network to devices, and can be extended to meet the requirements of applications.
Windows 10 IoT Core (10) is a version of Windows 10 that is available free for "makers" for use in small footprint, low-cost devices and IoT. It supports a number of platforms including the Raspberry Pi 2, MinnowBoard Max and Intel Galileo. It has support for Arduino with Windows Remote Arduino and Windows Virtual Shields. It is one of a family of products that will include Windows 10 IoT For Mobile Devices and Windows 10 IoT For Industry Devices. While it has some GUI support, it is generally intended to be run headless and programmed using remote PowerShell access. The first public release came out in August of 2015.
Linux is also a popular embedded operating system for IoT, although it may not be suitable for real-time and deterministic applications or code than run on small microcontrollers. There are Linux distributions designed specifically for IoT, such as Snappy Ubuntu Core, and frameworks to help configure and build embedded Linux (e.g. Yocto). It is also suited to cloud and data aggregation servers that might be used with IoT applications.
A new platform for IoT is Zephyr (11), an open source real-time OS for IoT devices that was announced in February 2016 by The Linux Foundation in partnership with Intel and Wind River and is based on Wind River's Rocket RTOS. Zephyr should be suitable for memory constrained microcontroller platforms that don't have the resources to run a full operating system like Linux.
Relevance to Qt
In general, Qt is too heavyweight to run on low-end embedded hardware like PICs and microcontrollers as it requires a full operating system like embedded Linux. It can run on more powerful but low-cost platforms such as the Raspberry Pi.
Qt is obviously also useful for applications like servers, cloud computing, and data aggregation as well as anything with a user interface.
The advantages of Qt include high performance (being based on compiled C++), cross-platform support, and APIs for networking, serial communication, and BTLE that are relevant to IoT.
Starting with Qt 5.6.0, there is a new QtSerialBus (12) module that adds support for embedded serial buses, initially CAN bus and Modbus. Support for more serial protocols is expected to be added in the future.
Challenges and Criticisms
IoT presents a number of technical and non-technical challenges and risks.
Privacy is already an important issue on the Internet, and IoT will greatly increase the amount of user-related information that could be used in undesired ways.
In an ideal world, users need to be able to give informed consent to collection of data and the ability to revoke or revise their privacy choices. Ideally IoT platforms will also support anonymizing of data to avoid identifying individual users.
Security, including encryption and access controls, is important to minimize exposure of data and consequences such as identity theft. Security flaws have been demonstrated in connected devices, such as taking over unauthorized control of an in-vehicle system.
The explosive growth of the Internet was not foreseen by the original designers of the network protocols, with the result that we are running out of address space. IPv4 supports about 4.3 billion addresses. This will be addressed by IPv6, and IoT will likely mean that the migration to IPv6 will need to be increased (currently the transition from IPv4 to IPv6 has been occurring at a rate of about four percent of systems per year).
IoT means that tremendous amounts of data will be generated, both for the so-called big data and for personal data. The storage industry needs to learn how to manage all this data in a cost-effective manner. More investment in servers will be necessary. Data center network WAN links are optimized for human interface applications and IoT is expected to dramatically change usage patterns.
Finally, there is an environmental impact due to the large number of devices that have shorter life cycles than in the past and are discarded sooner. For example, North Americans now replace their cell phones, on average, every two years.
In summary, indications are that most of the estimates of the projected growth of IoT are on track. It is no longer a question of if IoT will be big, but only one of the scale and time frames. IoT will offer both opportunities and challenges for those of us in the computer industry.
- The Internet of Things: What Is It and Why Should I Care?, Qt World Summit 2015 presentation, last accessed 1 Mar 2016, https://youtu.be/9mXlmgWCgcA
- Arduino Project, website, last accessed 1 Mar 2016, http://www.arduino.cc/
- Raspberry Pi Project, website, last accessed 1 Mar 2016, http://www.raspberrypi.org
- BeagleBoard and BeagleBone, website, last accessed 1 Mar 2016, http://beagleboard.org/
- Intel Galileo, Product Overview, last accessed 1 Mar 2016, http://www.arduino.cc/en/ArduinoCertified/IntelGalileo
- Constrained Application Protocol, website, last accessed 1 Mar 2016, http://coap.technology/
- Cantcoap CoAP Implementation, project github repository, last accessed 1 Mar 2016, https://github.com/staropram/cantcoap
- MRAA Low Level Skeleton Library for Communication on GNU/Linux platforms, documentation website, last accessed 1 Mar 2016, http://iotdk.intel.com/docs/master/mraa/
- OMA Lightweight M2M Device Management Specification, website, last accessed 1 Mar 2016, http://openmobilealliance.hs-sites.com/lightweight-m2m-specification-from-oma
- Windows 10 IoT Core, product website, last accessed 1 Mar 2016, http://dev.windows.com/en-us/iot
- Zephyr Project, website, last accessed 1 Mar 2016, http://www.zephyrproject.org/
- QtSerialBus, git repository, last accessed 1 Mar 2016, http://code.qt.io/cgit/qt/qtserialbus.git/