Internet of things is a buzzword nowadays and if you are one of those people who have been itching to get started with it but were unable to do so, this is an attempt to help you understand the different pieces involved in setting up an IoT system. I had an opportunity to work on an IoT based project at workplace and would like to share my learnings over here.
Resources used :
(I) In order to get started we booted our pi device with raspbian operating system which is a debian optimized for raspberry pi hardware(Installation).
Each pi device has a row of general purpose input output (GPIO) pins which acts as an interface between the pi and the outside world. We can connect sensors to these pins and program them according to our requirements. In model A and B of raspberry the gpio pins look like this :
You have two options to connect sensors to raspberry :
We went with the second option and used a device named grove pi (now upgraded to grovepi +) which is a modular board designed specifically for raspberry pi. With this you just need to plug the board on the pi and then connect the required sensors with the board. Installation steps of grove pi on raspberry device can be seen over here. Once this was done we were ready to start experimenting with the sensors.
(II) Use Case : Setting up a Security Monitor to detect burglary alarm and send notification to the user with the pictures of the event
Here is a breakdown of the tasks for our use case:
(i) Grove Pi has separate slots for connecting analog and digital sensors. The analog sensor ports are labelled as A1 — An and digital ports are labelled as D1-Dm. Since sound sensor is an analog sensor we connected it to one of the analog ports.
(ii) In order to code on the raspberry pi we connected keyboard, mouse to the USB ports available on it. Also HDMI port was connected to the LCD monitor and LAN cable was connected to the LAN port. Once this was done our setup looked like this :
We needed to setup following cloud services on azure:
3. Azure Mobile service (now mobile app service) : This is a mobile backend as a service which provides cloud storage, authentication and push notification services. It is based on RESTful programming interface to perform CRUD operations (using HTTP get/put/post/delete methods). We used mobile service for cloud storage and to provide push notification service in our mobile application.
This step is further divided into following sub-steps:
(i) Connect to the IP camera at our place and save the current frame image on raspberry.
(ii) Upload the saved image on azure blob storage.
(iii) Send a message on azure service bus queue with the image name and time-stamp.
We decided to use azure mobile service for this purpose as it provided us a feature of scheduler where we can schedule a task to be run continuously after some time interval. In our case we wanted our consumer to do 2 things:
We needed a mobile application to do following things:
Our mobile application was connected with the azure mobile service to use it’s push notification feature and in order to get the names of the theft pictures from the cloud storage. Corresponding to each theft pic name in the table storage there was a picture stored in blob storage on azure from where the application finally fetched the image to display it to the user.
Once this was done we were able to connect the different pieces required in setting up our security system with a raspberry pi and basic sensor kit.We did this work about an year ago, now most of the cloud services like azure and amazon provides IoT frameworks which internally has the above mentioned services packaged together.
Thanks for taking the time to view this post, I hope it helped you in understanding the different components involved in setting up an IoT system.