Hello IoT...

So what should our first post of the year which also happens to be the first Hardware Friday post of the year, be?

2014 seemed to be the start of the IoT wave, so to help those of you might be thinking of catching that wave in 2015, let's start with a device and code heavy walk through by Naren Neelamegam.

Internet of Things: Programming IoT Devices, Web Services and IoT Clients

A complete walk through on IoT Device programming, Web Service programming and IoT Client programming.

  • Raspberry PI Python with Google Appscript Authorization - Source - 1.8 KB
  • Google App Script for PI Authorization - Source - 681 B
  • Raspberry PI Python - Source - 1.3 KB
  • C Sharp IoT Device Client - Source - 39.2 KB
  • Android IoT Device Client - Source - 3.3 MB
  • Google App Script for Arduino - Source - 402 B
  • Arduino Door Security Sketch - Source - 1.6 KB

Introduction

Internet of Things – There are many articles to explain about “IoT” out there on the internet, so we are not going deeper into what it is. In a simple term “Internet of Things – Making devices work based on connected data through internet”. The data source can be from a sensor, a web server, another device, a mobile phone or any form of an electronic device which can receive/send data through internet. So “Internet of Devices” + “Internet of Data” = “Internet of Things”. Is it that simple? Yes, it is, as long as you are thinking of clicking a button from your office to switch off your TV at home. But, if you want to build a bunch of devices to act and react to each other based on data it receives from each other like robots moving around without hitting each other, automatic cars moving on roads without any accidents, it is not that simple, isn’t it? Rome was not built in a day. This article is to give you some bricks to start building now.

Internet of Things

IoT is all around data. Talking about IoT, there could be series of questions to ask like Who collects the data? Who process the data? What to do with the data? Where to store the data? Where to share the data? How to share the data? The answers will vary depending on the purpose of your goal to achieve with your IoT project. But, basically you need few of the following Things to achieve some answer to the above questions,

  • An IoT device – which can connect to internet
  • Internet connection (Ethernet or Wifi depends on the mode your device can connect)
  • A webserver to store/process/share data

We can purchase an affordable basic IoT device in the market today for few bucks. Internet connection is almost everywhere. A webserver will be the difficult part for learners/beginners or hobbyist who tries to do some level of home automation or a basic IoT project. So, this article will also explain how to use Google Drive for your IoT device as a data backend and also, will cover how to write a .NET webservice if you can afford a web server. Note that, you can configure and program your IoT device as your web server as well, but, that is not covered in this article.

Background

We will try to make a couple of simple circuits for Arduino, one using Thermistor temperature sensor and another using Ultrasonic distance sensor. Arduino program will write the temperature data and safe locker door open/close data to Google Spreadsheet or a MySQL database on a webserver. A Raspberry PI module to capture a picture if a door movement detected by Arduino module and an another PI module to switch off/on an electric device based on Webservice feed.

What we are going to do with this data?

An Android application on a mobile displays the current temperature and raises a notification alarm message if the temperature goes beyond threshold. The same Android application will also have a switch on the UI to write a command data to Google Spreadsheet or MySQL database on a webserver which in-turn will be read by Raspberry PI Python module to switch on/off an electric circuit (a fan, heater or whatever). The Android app will also allow you to enable/disable safety locker door Alarm notification. If it is enabled, your phone will raise an alarm instantly if there is any door movement detected.

Note that, you can make your own changes to this simple design to make it more efficient. But, I keep it as is for this article purpose so that I can explain bits here and there. For example, connect the distance sensor to Raspberry PI module so that you can take some pictures as soon as you detect a movement.

image

Sample Project: Through this article and sample, you can make your own simple Safety Locker Security Module to get alarm notification on your mobile during a security breach of your Locker. Also, you can control your home electronic equipments remotely through your mobile.

Topics Covered

This article will aim to guide you through the following topics

  • Arduino Device with ThinkSpeak
  • Arduino Device with Google Drive back-end support for collecting temperature data and door movement data.
  • Raspberry PI Device with Google Drive back-end support to turn on/off Electric device based on Arduino’s temperature data
  • Google AppScript programming for processing IoT data from Arduino
  • Android program to read Google drive and direct Raspberry PI device to control Electric device
  • .NET application to read Google drive and direct Raspberry PI device to control Electric device
  • A .NET based Webservice with MySQL database.

At end of this article, you will be able to,

  • Setup and write a program for Arduino device
  • Setup and write a Python module for Raspberry PI device
  • Setup and use ThinkSpeak services.
  • Write a simple Google Appscript to read and write to a Google Spreadsheet
  • Write a simple Android program to read and write to a Google Spreadsheet
  • Write a simple C# program to read and write to a Google Spreadsheet
  • Write a simple C# Web Service to serve device requests with MySQL database

...

Conclusion

Number of devices collecting data and variety of devices collecting data are increasing rapidly day to day. When you plan to put your device on internet, security to your data and device takes more priority. For example, on this article Arduino is passing data to Google Spreadsheet on a publicly shared URL without any security whereas RaspberryPI is using OAuth2 authentication for communication.

Raspberry PI or Arduino device can act as Web Servers themself. So, you don't need a separate Web server running for your devices as they can do it by their own. Raspberry PI can be programmed to stream video to your mobile device when there was a security breach detected, so that you can see what is going on right away from your mobile. Sky is the limit for your imagination in IoT world. Keep exploring and do innovations. Hope this article helped you understand IoT space to some level.

[Click through to read the entire post, get the source and see the videos]



Tags:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.