IoT
Implementing End-To-End IoT Value Chain
Focus Areas
- IOT
Background
Having Bachelor’s degree in Electronics and Master’s in Computers, I wanted to leverage my exposure to both hardware and software, which inspired me to take up this project.
My expeirence working with Hitachi America in Suhanshu’s team especially my association with Brian helped me a lot without which I wouldn’t have created this.
At the time when I had this project completely working, people barely knew about Amazon Echo and Google Home was not even available in the market, today when I look back I feel really proud about this project.
When started the project I was trying to explore full product ecosystem (Embedded Devices, Device Firmware, Wireless Protocols, Applications, Cloud Servers and Infrastructure). My intention was to learn, implement and experiment things rather than working on fixed requirement.
At high level
I have sensors interfaced to node (typically a Micro-controller), nodes will talk to gateway (a Linux box), which will send data to cloud (raghavendramanjegowda.com). This is delivered to audience through this website! Sounds simple isn’t it?
Lets get started!!
Stage 1:
First I started by renting 20 GB memory in cloud so that I get universal public facing IP (this website which you are viewing now is rendered by Apache sitting here). I have deployed Debian OS on my VM, reason why I went with Debian is to maintain uniformity across project (I have used RaspberryPi which uses Raspbian - a Debian version of Linux!), Ubuntu isn’t available for Embedded devices.
Stage 2:
After getting Apache2 up and running, started my work with RaspberryPi and Building Website in parallel so that I can switch from one to another whenever I get bored. Debian wiki has nice tutorial on how to install WordPress, then followed Thesseract’s tutorial to get draft of the website working. Then I referred couple of my favorite websites to make it more professional for example adding fav icon, adding splash screen, customizing posts, adding responsive background etc..,
Stage 3:
While working on website, I also spent some time getting bits and pieces working on RaspberryPi. Got CoAP server working on RaspberryPi which I need in future for my sensors to talk with Pi. Also got Mosquito server (MQTT) working which I need to communicate between RapberryPi and Droplet (VM in cloud).
After doing some research for the popular light weight protocols to use between IOT device and gateway and cloud, I ended up selecting CoAP between IOT Device and Gateway, and MQTT between Gateway and Cloud.
Stage 4:
Now I wanted to concentrate on implementing security for whatever is done so far. So got SSL certificate for my website (Can you see HTTPS in URL?), everything that is delivered to you is RSA 2048 encrypted! Then I wanted to stop someone who tries to brute force by Cloud server, so got Fail2ban (intrution prevention tool) working, where it bans IPs which tries SSH to my machine with wrong credentials.
At this point I wanted to secure communication between RaspberryPi at home and Cloud server too, also I wanted to have full access to RaspberryPi from wherever I am! One common solution for both the problems is to establish a secure private network between the two, by doing this I can send data over SSL and also I can define my own static IPs through which I can SSH to RaspberryPi anywhere from the world! Interesting isn’t it?
You can actually check this here, where the graph you see are brought to you from RapsberryPi, request sent from here is forwarded to RaspberryPi, network monitoring tool I have installed here will sends data it collected to Cloud through secured channel to via local IP they both agreed to establish private network.
Stage 5:
IOT Devices inside home (to which sensors connected are) should not be seen by router. So I want my gateway to act as both access point to home network and network client to external world.
So I configured on board WiFi transceiver of RapberryPi 3 as Access Point, and plugged in USB WiFi dongle which connects to network provider (home router) so that I can send to cloud. For this I used HOSTAPD as user space daemon for access point and authentication server, and DNSMASQ as DHCP server.
Then all data packets received at ON BOARD WiFi transceiver (wlan0) is be forwarded to USB WiFi dongle (wlan1). By doing this, the IP address of the IOT devices inside home are hidden behind the Gateway.
Another problem could be channel selection for Access Point! Since all the access points in the neighborhood will be contending to get access on their bandwidth, we don’t want the connection to be sluggish. By analyzing the utilization of WiFi spectrum I configured my RaspberryPi Access Point to the channel having less contention at center frequency (In my case I found channel 3 is the best available). I used WiFi Analyzer Android application for this. I have shown some details in following pictures. You might notice channel 14 is free, channel 12, 13 and 14 of 802.11 are restricted in North America (Frequency band of channel 11 overlap with those of channel 12 and 13 though!).