Close

First Steps

A project log for IoTNode

Building an OpenSource IoT Platform for the Average Maker. Using Open Connectivity Foudnation's OIC Spec and example Apps

roman-vRoman V 04/14/2017 at 08:320 Comments

This project has been started already and well, haven't documented anything about it except for what's been posted here.

My first steps involved having a look at what's already available for IoT from a low level embedded developer point of view. Since I have no commercial background in IoT and wanted to build something for my home.

First round of researching found an already popular MQTT protocol which is primarily used over TCP. This protocol is a simple Subscribe/Publish messaging protocol with a few added features like passwords and (I think) forwarding messages onto nodes not directly accessible by the subscriber. It's clean, though, not feature rich.

For some reason I was interested in UDP IoT protocols (possibly for ease of jumping into Low Power mode and not worrying about TCP states). I Quickly found CoAP which was designed to follow in the footsteps of HTTP; As it's designed for low resource environments, includes URI schemes: `coap://` and `coaps://` (using DTLS), oobserve (subscribe) model and a pile of other features.

Okay Cool. Decided on CoAP, Now What?

I read through CoAP's RFC (yeah, all of it... Several times...) and learnt a few extra things:

The ESP32 has a nice framework for quickly getting started with it, called ESP-IDF. This framework includes a scrap bin full of useful components already configured to go. there is libCoAP included in there too. but when poking around with it. it's got a built in transport layer that's not easy to override. and ESP32's IP stack Light Weight IP (LWIP) doesn't support multicast properly (Will go into detail on request).

I found a neat little library called Lobaro-CoAP, no way near polished at libCoAP but it exposed the transport mechanism allowing me the choice of how and when I send the data from the device. So went with that!

Hello World~!

I set out to create a basic Hello World project. The requirements were:

Right. A phone app...

This is the part where I learn Xamarin.Forms and figure out how to build an app that works on both my phone and my computer. This took some time. but the results can be found at https://github.com/NZSmartie/CoapTest

The second challenge was getting the ESP32 to work as intended. I implemented lobaro-coap on my IoTNode project, hitting some limitations pretty quickly but after a few pull requests later. my ESP32 was responding to multicast messages and my app was finding the device with no problem!

Discussions