The Internet of Things nowadays features a lot of WiFI/Bluetooth powered applications and IoT cloud platforms, showcasing the endless possibilities IoT unlocks, for use cases and verticals like eHealth, Smart Cities, Home comfort, or heck! just having fun… but, the next IoT will be driven by actual requirements such as really ultra low-power operation down to micro-Amps, to actually enable everlasting applications that can run with few maintenance and unlock distributed applications to be deployed across a wide area, without having to deploy an extensive infrastructure to support it, for example in places which a large WiFI coverage area is not feasible.
Wireless Sensor Networks and M2M applications are long known: mesh networks with several hops between devices extends the coverage of applications, with few Internet-capable devices acting as Border Routers, to connect IEEE 802.15.4 wireless and low power networks to the Internet. Protocols like 6LoWPAN enables constrained devices to run IPv6 stacks, closing the gap between network domains, and actually making the deployment and maintenance of such networks an easy task, using common protocols on top as UDP, TCP, HTTP, MQTT, CoAP and others.
This project showcases a Zolertia Z1 mote sending HTTP POST to Ubidots, on 2.4GHz IEEE 802.15.4 wireless links on IPv6/6LoWPAN, to Ubidots IPv6 endpoint, creating an ultra low-power mesh network of embedded devices, capable of lasting up to 1-2 years on regular 2xAA batteries, with a wireless range of 100-200mts if using a cheap 5dBi external antenna.
Zolertia is widely supported in Contiki OS, an Open Source Operative System specifically designed for embedded devices, enabling to connect most objects and services to IPv4/IPv6. The source code used for this example can be found at my Contiki fork, under the branch ubidots-demo. The base example and Ubidots Contiki Library was created by George Oikonomou.
To create a local working copy open a terminal and:
git checkout -b ubidots-demo origin/ubidots-demo
To create the application (assuming you are using either Instant Contiki Virtual image with the toolchain already installed, or you have installed the toolchain), you will need to compile and flash 2 applications: the Border Router and the Ubidots client. Connect the Z1 motes to your host, and start programming.
To make sure the motes are connected, verify first using (on Linux)
dmesg | grep ttyUSB
Or using the built-in motelist script
It will show something like:
Reference Device Description
---------- ---------------- ----------------------------------------
Z1RC4841 /dev/ttyUSB0 Silicon Labs Zolertia Z1
The Border Router
make TARGET=z1 savetarget
make border-router.upload && make z1-reset && make connect-router
This will compile and flash the Border Router application to the connected Z1 mote (default at /dev/ttyUSB0 USB port). After being flashed, the command above will run the tunslip6 script, which will create a virtual interface such as your ethernet or WiFI, to connect your border router to your IP network. By default it uses a
aaaa::/64 prefix, but if your network is IPv6-ready, you can use any IPv6 prefix with /64 mask as follows:
For more detail: Zolertia IPv6/6LoWPAN Ubidots client