Building Call for Code Apps with IoT and Node-RED
Learn how to weave together IoT, Node-Red, and Watson IoT to create a Call for Code app that mitigates natural disasters.
Welcome to the Call for Code Technology Mini-Series where I’ll identify and talk about one of the six core technology focus areas within Call for Code. You’ll learn about that technology, how to best utilize it on IBM Cloud, and where to find the best resources to fuel your innovation. First things first: If you haven’t already, accept the Call for Code challenge and join our community.
In Part 1, I’m going to talk about IoT and Node-RED, and I’ll explain how those two technologies can be easily tied together on IBM Cloud using the Watson™ IoT Platform.
The Internet of Things (IoT), is about extending the power of the internet beyond computers and smartphones to a whole range of other things, processes, and environments. Those “connected” things are used to gather information, send information back, or both. IoT allows businesses and people to be more connected to the world around them and to do more meaningful, higher-level work. Simply put, it means taking all the things in the world and connecting them to the internet. If you are new to IoT, check out this article by Callum McClelland in IoT for All that explains the basics of IoT and why it’s important: “What is IoT? – A Simple Explanation of the Internet of Things.”
A key way that IoT can help mitigate natural disasters is through sensor data. Collecting and analyzing this data can allow communities to take corrective or preventative action automatically. One of my favorite examples from the Call for Code 2018 Global Competition was Project Lali, which used IoT to measure temperature data in areas vulnerable to wildfires, send that data to IBM Cloud, and run the sensor data through various Watson services, like Watson Machine Learning and Watson Studio to predict fire intensity and behavior.
IoT devices can come in many shapes and sizes, starting with smaller development boards like a Raspberry Pi, Particle Photon, or an Onion Omega. Lots of mainstream consumer electronic devices that provide daily utility to users are also IoT devices, such as Amazon Echo, Google Home, Nest thermostats, and Ring doorbells. Even the car you drive and your smart refrigerator at home that tracks food inventory and alerts you when you’re running low on milk are — you guessed it — IoT devices!
Get started with IoT
Whether you’re a professional software developer or a beginner just starting out, one of the easiest ways to work with IoT devices is with Node-RED. Node-RED is a flow-based visual programming editor that lets you wire together nodes. These flows give you all the power of traditional programming, but within a simple, easy-to-use interface. The best thing about Node-RED is that it runs perfectly on IBM Cloud and is included as one of our starter kits.
If you don’t already have an IBM Cloud account, the first step is signing up for an IBM Cloud account, which takes less than 2 minutes. Just ensure that you use a valid email address, as you will have to confirm your email address before you can create any services. Once you’re signed in, continue reading to see our featured example.
The tools you need
While many IoT devices can work with the Watson IoT Platform, I’m going to specifically focus on the Onion Omega series of devices in this blog post. If you’re not familiar with the Onion series of devices, definitely check them out. For less than $50, you can get an Omega2+, a dock, and an OLED screen, and have a ton of fun with that device. The best resource for getting started with the Omega device comes from none other than John Walicki, the CTO of IoT Developer Advocacy. He has written a complete guide on using Onion devices with Node-RED on the IBM Cloud. Follow this detailed guide for a great introduction into IoT device setup and usage, service creation in IBM Cloud, and a complete Node-RED solution.
Looking for more IoT ideas? Check out our Code and Response™ IoT code patterns. Code patterns are one-stop-shop open source solutions, written by IBMers, that include detailed information, architectural flow diagrams, complete instructions, and a GitHub link to the code used in the patterns. Want to build some more cool things on IBM Cloud not centered around IoT? Check out our huge section of other code patterns.
Using the Watson IoT Platform without a device
Don’t have access to the Onion device or other IoT devices? No worries! You can still use the Watson IoT Platform’s simulated devices that can generate data for use within the platform. Take a look at these resources:
- Simulating Device Data
- Simulating a Large Number of Devices
- Simulated Device with 3 Simulated Sensors
We’ve just learned what IoT and IoT devices are, the power and ease of use that Node-RED provides, how simple Watson IoT Platform is to work with, and how all of those things weave through a fantastic exercise.
I hope you’ve found this blog post useful. I’ll be back soon with Part 2, where we’ll talk about artificial intelligence and what Watson can do for you.
In the meantime, follow my work in GitHub.