Yesterday was a special day. It would be a nightmare day for most tech executive. I was a keynote speaker for OpenIoT Europe / Embedded Linux Conference from The Linux Foundation and was asked to demo IoT in front of more than a thousand [potentially multiple thousands] experts. If there is one thing software companies don’t do enough, it is sending their executives to demo their new products. I survived and it went quite well. This blog post will run through my demos but also explain how each is just a building block towards a software defined future in which home, business and industrial IoT will redefine our future. My code is on Github and where possible I will give instructions to do the demo yourself.
The first thing to understand is that we are living in a world where yesteryear’s supercomputers are available today for $10 and lower. The first Raspberry Pi was $25. The Raspberry Pi Zero is now $5. But the NanoPi Neo is $10 and includes Ethernet unlike the Zero. The Chip includes WiFi and Bluetooth for $9. They also just launched a Chip Pro for $16 for production usage.
Clearly this trend is just starting. The Chip Pro is a good example of how the maker community is just a jumping board towards the professionals market. Likely two or three boards will emerge that will cost over time below $5, even $1, and can be put on top of breakout boards for anybody looking to integrate everything from Ethernet, sensors, Modbus, 4G, and many more. So in a world where a supercomputer costs mere dollars, any type of device will have one, e.g. hairdryers, toothbrushes, alarm clocks, and everything else that is relatively dumb around us today.
How will we manage hundreds of smart devices around us?
We can go two ways: the Apple way or the open way. The Apple way will be closed ecosystems that only work with devices from the same manufacturer. Although this might work in a world with Apple TV, iPhone, iPod, iPad, and so on. Realistically even in the home you have a Google Nest, a Sonos, an Amazon Echo, a Philips Hue that aren’t from the same supplier. So for IoT to be successful we need an open way in which competing products can communicate together. How is this done today? Most suppliers have some proprietary cloud service that allows other devices to talk to yours. So we are still in a world of isolated and walled garden connected things.
Our proposal is different. What if you can put apps on devices and allow software to define and redefine the purpose of a device? How does this work? Let’s focus on the first demo. Connecting a temperature sensor to the cloud. For my demos I used an excellent open source product made originally by IBM called NodeRed.org. Thanks to our open source apps on device concept, called Snap, you can now easily install NodeRed on any Snappy device via: sudo snap install nodered. If you want to create an alternative list of modules, go to Github, clone the project, and call snapcraft to get an alternative snap you can either upload again to the store [snapcraft push], or deploy directly [sudo snap install nodered_….snap –force-dangerous].
Here you can see how an Arduino node gets temperature data from the Arduino and puts it into a statistics node. Every 3 seconds the mean temperature is calculated based on information that is no older than 30 seconds. The switch function allows you to put a minimum temperature before you share the data. By connecting the switch function to the IBM IoT Device node and clicking Deploy, you are able to send the data from the Arduino to the IBM Cloud. It is really easy to get a real time graph. Try it yourself, you just need to copy one quickstart ID from the IBM IoT Device node to the quickstart page in the cloud. However, how do you get the information from the Arduino or any other micro-controller or sensor in the first place? Here is the code to read data from an Arduino connected via USB [clone, run snapcraft, sudo snap install …]. On the Arduino you need to run some code to push the data to the serial interface. Any Arduino starter kit will explain you how to do this. My Snap reads the data and puts it into a local MQTT topic. MQTT is a standard which is often used for IoT when you have lots of sensors communicating small quantities of data. To get a local MQTT server running just do sudo snap install mosquitto. By following a simple topic naming schema: sensor/arduino/in, you can now connect from NodeRed to the Arduino temperature data feed.
One thing you might have noticed is that the data was not send directly from the sensor to the cloud. Why? The data was read every 0.5 seconds. By just accidentally touching the sensor you would get a spike. Via aggregation and taking a mean you can avoid this. This is one of the reasons why you want to have a smart edge device that does local analytics. Another reason is that lots of sensors are quite chatty. You can easily have 10-100 sensors in even the most simple industrial equipment. Sensors can read data every second but often every tenth or hundreds of a second. Start multiplying this data feed by 100s of sensors on millions of devices and you can easily see why we are creating a data tsunami of almost useless data. Edge analytics allows you to only share data with the cloud when it is relevant.
This article originally appeared on LinkedIn.