One of the biggest problems for the Internet of Things will be knowing what the estimated 50 billion devices connected to it actually are, and what they can do.
For example, is that thing over there (or on the other side of the planet, or even on the ISS) a temperature or air quality sensor, is it a street light, what about a gas pipeline valve actuator, or even a wind turbine how fast it's turning round and round measurer thingy!!!
For this project were going to be using the Arduino MKR1000.
(In a hurry? Skip to the bottom, watch the video, and come back here.)
There are some "standards" evolving to share IoT information, and that's good, but they tend to be convoluted to get started with, and often rigid in how data needs to be exchanged. This project makes it really flexible, simple, easy to understand, and quick to get going (and it fits onto a small footprint devices like Arduino :).
Now, if you're an IoT device, like a car, and you want to talk to other IoT devices, then you need to have some way to say "Hello".
We didn't want to reinvent the wheel, so where better to start than the stuff that powers the web, HTTP(S) and query strings, after all, everybody uses these every day, and most developers already know how to work with them.
Every device has a catalog (a database) that describes what it is and what it can do.
In this instance the data defines the MKR1000 as a parking meter, with a built in webserver, and the screen & LEDs the data can control.
So, the car could send out a simple query string, like this
asking what's in your catalog.
And the device replies
.cat=I'm an IoT parking space in central London
it will also send out stuff like it's coordinates, whether it's occupied, and how much it costs.
But first, the car needs to know all the IoT devices that are out there!
There are two options here, the car could scan the whole web asking every IP address "are you an IoT device", and this project allows for this, but whilst it's great to find out exactly what IoT devices are up to right now, it's also a tad inefficient.
So another way is to get a cloud .NET service to do the scanning for us. It sends out hundreds/thousands/millions/billions of pings to find IoT devices, we call this the Internet of Pings.
We've built this into the Yanza service for this project.
Hey, this is starting to look a bit like a social network for things!
Or, put another way, it's an IoT search engine!
Now, the car doesn't have to do all the heavy lifting, it just makes one call to Yanza (or another IoT broker) saying
"Hi, I'm a car, I'm in central London, near Piccadilly Circus, and I need to park, like in 5 minutes, as near to the theatre as possible, but not too expensive please."
OK, so it probably says something like
Now the IoT service has already scanned and found all the IoT devices that say they are parking spaces in central London, so it can reply really quickly
To cut a long storey short (probably a couple of milliseconds), the end result is the parking space gets reserved for the car.
The car could then negotiate a better price, ask if the theatre has any last minute tickets, perhaps there's a restaurant nearby... ...but that's another project.
You get the message, IoT devices are now talking to each other, and by the way, humans can join in too, this all works from a browser.
But wait how does the device know what it is in the first place?
This is where you can try it for yourself. :)
The MKR1000 starts off by knowing it's an IoT device, but not what kind of device, it could be anything.
It makes an HTTP call to base, in this case the Yanza IoT cloud service, and says "what am I".
The cloud service replies to tell it, (in this scenario) "You're an parking meter, and here's some other stuff you need to know".
The code to try this for yourself is on the Yanza website, you can run it on an Arduino MKR1000, or an Uno with ethernet shield, and turn it into an IoT device (connected to a virtual parking meter).
What does the Arduino MKR1000 code do?
- webserver with IoT device homepage
- scheduled web client to "call home" for updated IoT data
- query string database to define what type of IoT device this is
- database records can be queried using HTTP
- simple queries i.e. ?location
- query partial or entire database over HTTP
- HTML injection
- digital pin setting
- supports SSL (not in this demo code)
OK, to summarize, this is a way for IoT devices to be discovered and communicate their capabilities. It uses the Yanza IoT cloud service, which we think is the easiest to use, in fact we reckon you can get started reading and writing IoT data into the Yanza cloud in under a minute, and for someone who already used Arduino they could get an MKR1000 or Uno loaded with this project code in an hour.
IoT devices can say "Hi, I'm here and this is what I can do", they can talk directly to other real IoT things, or virtual things in the cloud, like Azure. All using really simple query strings.
Want to know more? Need the code? Got a question?
Any content believed to be for public reuse, please contact if not.