DNSed: A simple useable internet name for large scale IoT

Intent

When there is a city wide Wireless Sensor Network (WSN), this has to be resolved with anything meaningful, say name of where it is located. then this has to be the name that it should be resolved to.

to creat DNSed, as in past tense in English for DNS. To DNS the shit out of the IoT. To create an amazing network and to overload the DNS servers. To create everything out in the open, so everything in the Hollywood movies can come true.

Scenario

  • When a water tank level indicator at place called “Meereen”.
  • There is a number for the water tank which is 256.

then, this can be described in the internet nomenclature as

  • domain name: meereen.got
  • object: water tank
  • number: 256
  • sensor type: level indicator

this would translate to an internet name of “level.256.water.meereen.got”

usually, there is only a sensor in a an area and they are organised in cluster.

in that case, Meereen’s water tank is being referenced, and the sensor 256 is being addressed where the level is being asked for, https://256.water.meereen.got/level where level is a service provided by the sensor

 

Possibility:

It is possible to use BIND9 to build a DNS server, then create the zone records to point to the different sensors. the tutorial gives a good insight on deploying a BIND9 DNS server [3]. There are very good python libraries available in such an instance to build an DNS server and then work with their API. The following are some interesting DNS APIs for python to process DNS records on server.

[1] http://www.dnspython.org

[2] https://pypi.python.org/pypi/easyzone/1.2.1

Implementation:

In this effort, the implementation takes advantage of the REST API provided by DigitalOcean to make the DNS. as the idea is to create a very dynamic name resolution for IoT devices and this does not involve building a DNS server from scratch. The DNSed will be a library that will used in the IoT devices as well to communicate to the central server which will be further proxied to the DNS Server of DigitalOcean. This architecture would provide a method to have a better security by not distributing the API keys throughout the network on every device.

The functional block diagram below tries to describes this exact architecture

drawit-diagram-2

References:

[1] http://www.dnspython.org

[2] https://pypi.python.org/pypi/easyzone/1.2.1

[3] https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-14-04

[4] https://developers.digitalocean.com/documentation/v2/#domain-records

[5]
drawit-diagram-1

Raspberry Pi NFC reader driver installation ACR122u

First add the following dependencies for the NFC driver and other modules

sudo apt-get install pcscd libusb-dev libpcsclite1 libpcsclite-dev dh-autoreconf

I also installed the drivers from the official website for my device.

it can be found here (disclaimer: I do not still not know if this step is required)

then install the python package with pip

sudo pip install nfcpy

 

now use the documentation http://nfcpy.readthedocs.io for using the nfc card with python. The python interface doesn’t use the LED notifications on the device, I have to find out how it works with the lights!

I have an app idea, which cloud provider to choose?

There are millions of cloud providers out there, may be not, but there are enough to confuse you with their features and creative billing terms.

Ofcouse, its traditional VPS style and not using Docker to pack your app.

Now, the two cloud provider I choose to choose between are

Why this two?

I am not paid any one of those cloud providers, that further more vaguer for the reasoning. Being said that, to see from the perspective of highly scalable apps there are two philosophies.

  • I build my app using a framework from my cloud provider and my service provider will make it easier to deploy and scale up or down on demand
  • I setup everything and orchestrate the deployment process using chef, puppet or similar application and write my own logic for processing the on demand scaling

yes, ordered in the same order as the service provider. I will put my two cents of my philosophy in software development and this totally depends on the type of developer.

one follows the guidelines laid out by a framework to strictly develop using those or to use libraries to build ones own app philosophy which dictates its own framework as you build it up.

The fight is between libraries and frameworks, when you know what you are building and the final line is the light at the end of the tunnel, its probably much easier to find the suitable framework and nail it! important thing here would be that everything would have been already thought out for you by the developers. Whereas when you are building something that improvises over time, I prefer developing using libraries which gives a greater scope for solving problems.

Libraries are my way of doing. Choose generic libraries build out the app and improvise over time. frameworks might die out but standard libraries usually stay.

After those two cents, comes the drool factor, Does someone have a command line fetish in your team, stop reading here and starting using digitalocean.

So, whats the framework am I getting myself when i use AWS would be the next question! AWS has an amazing product line and most of them are amazing. I love how they built simple-storage-service s3, relational-database-service RDS or elasticache. But my fallout was using the elastic-bean-stalk EBS which is basically a framework that warps elastic-compute-cloud EC2, RDS and s3 and can be supplemented with all the other million products they offer.


comparing them for features of the two will be for another day

The advantages are

  • easily point-and-click and tell your app to scale up and down automatically
  • all services/servers are in one virtual-private-cloud
  • scalable online for block storage
  • create database, cache replications and clusters on the go
  • of course, elastic load balancer… its so elastic it scales up and forgoes provisions after the peak

all of it points towards high availability for delivering your app the two things I would point out and not be embarrassed about them are

  • the cost at which it comes, mostly any startup wants to be lean

thats a framework, its also well supported by packages for most of the app development frameworks and libraries that you can import and give the URI, username and password and good to go.

Now, looking at the digital ocean, there is no product offering except for selling a highly available, well distributed cloud. start a VPS, migrate to any location, make it available at any data centre at the same price. The whole look is amazing at digital ocean and I love them for being progressive as a company and to offer a service that is startup – developer friendly.

Here, you get mailed with a IP and root password to ssh into and the rest is history. Everything is open and its up to the developer to set the standards and formalise rules for the app. Choose the stack for development and create a deploy strategy.

i feel pretty flexible and always suggest it with a strong positive feeling that anything is possible / everything is possible if one can envision the requirement.

So, that app we developed, I started out without a clear vision on EBS but we wanted to do something with consuming web API from social media. It was first text, then came the images and now we are working with rendering videos. The first library we wanted in python required third party system packages and that wasn’t being installed due to repository problem. that was the first fall out from EBS to EC2. EC2 proved clearly the way to go. its open, its also a stackless framework-less VPS which only supports SSH with key based authentication. that ended up in messing up with deploying from different machines and losing access to the machine. Of course there is a guide to get your stuff back, but its just a pain during development. Then we switched to digital ocean, devOps took some time but three weeks later it was time to ship the first version!

Digital ocean wins on two grounds for me is framework-less development with developer friendly billing. Write me if you want know more about all the other issues because the deployment is 98% and I will continue to setup the system 🙂

Installing MEAN stack for Fullstack application development

The best one liner for what MEAN stack is given in the following picture.Screen Shot 2015-01-18 at 22.48.40

MEAN stack is more like LAMP.

M = MongoDB

E = ExpressJS

A = AngularJS

N = NodeJS

MEAN Stack Logo

There has been a lot of development from Google for the AngularJS and NodeJS. They are minimalistic and javascript based, for now cutting edge web development tools.

For installing MEAN stack in ubuntu, follow the commands to set up your MEAN Stack. I deployed my server in Digitalocean which is like my obsessed service for cloud deployment.

Install MongoDB
#~ sudo apt-get install mongodb
Install NodeJS and Npm
#~ sudo apt-get install nodejs npm
and create a symlink
#~ sudo ln -s /usr/bin/nodejs /usr/bin/node
Install Bower
#~ sudo npm install -g bower
Install Grunt
#~ sudo npm install -g grunt-cli
Install MEAN
sudo npm install -g mean-cli
Init your first App
$ mean init testApp
type in your IPaddress with port 3000
http://xxx.xxx.xxx.xxx:3000

Testing Contiki-os with the first program using CC2530 / CC2531

This is not going to take too long for you to test your first Contiki program which will enable you to test your environment setup and also to understand the procedure of development using Contiki-os for the target chips CC2530 and CC2531. Continue reading “Testing Contiki-os with the first program using CC2530 / CC2531”

TI CC2530DK – Contiki OS – Internet of Things

This blog post is an effort to create a one stop information for starting off your Contiki project with cc2530DK.

There is enough information already available on Github wiki. This post is more than an extension to have all information under one place and as usual my way of documenting my projects!

Continue reading “TI CC2530DK – Contiki OS – Internet of Things”