Tuesday, 21 October 2014

IoT using Beaglebone Black

IoT or "Internet of Things" the next big thing in technology is going to change the existence of electronics. In this new world not only us but our homes our gadgets our cars and whatever tiny things we can't live without will be connected to the internet. So no matter where you are you can always feel at home. You can always control and monitor your device. So let's see how we can do that using our Beaglebone Black.

What you need

  1. Beaglebone Black (Debian version)
  2. USB cable
  3. PC with Putty installed in it (Yes its that simple! )
  4. Internet connection (To download the software and post) 
  5. Facebook account (Isn't  it getting interesting?)

Installing the softwares

  • You can find from my previous posts how to install Putty and log in to your BBB.
  • Download and install WinSCP client from here.

About Temboo

I don't know how to say it but Temboo is like a magic. It's a blessing to the IoT world. Ok lot's of chit-chat. Temboo or https://www.temboo.com/ is a virtual coding website. In easier tongue it is a website where you can get connected to over 100+ internet services without needing to code yourself. Yes it's that easy. And it supports a whole lot of programming languages like Python, Java, C#, PHP, Android, etc. Not only this Temboo even supports some of the Arduino boards like Arduino Yun and some TI boards like the CC3200 Launchpad for development of IoT projects.

Steps to follow

  • Go to Temboo website. Create a new account. It is free of charge.
  • Log In to your new account.
  • It will take you to the Library page.

  • Now from the left panel choose an Internet service of your choice.
  • In this example we are going to do a Facebook post from our Beaglebone Black. Isn't that cool?
  • So from the left pane we will go to Facebook=>Publishing=>Post.

  • You can see a page like this.

  • Click on Facebook Canvas.

  • You will get a page like this.

  • At the bottom of the page you will find a tab named "Secure Host URL". Inside the box fill "www.temboo.com/oauth_helpers/confirm_facebook/" click next.

  • Again go to Apps tab on top and select your newly created app.
  • You will get a window like this.

  • Now come back to the temboo page and click on GetOAuthToken in the Input section of the page. It will guide you through the steps mentioned above. Click on Next untill you come to 3rd step. Copy the "App ID" and the "App Secret" from the developers page to the boxes.

  • BINGO! your Facebook account is set up to get posts through TEMBOO.
  • Now fill in the Message and click on run. If you get a response then you are good to go.

  • Now let's transfer this code to our Beaglebone Black.
  • Click on the Language of your choice (my favourite is Python and BBB has a good support for Python) and download the SDK.

  • Extract the file into a folder of your choice. 
  • Now open the WinSCP Client that you installed and Log In to BBB just like your Putty. Click Continue for the next prompt and you will get a window like this.

  • On the left pane is your system and on the right pane is the BBB. You can easily transfer files or folders between the two systems by simple drag and drop.
  • Now using this copy the extracted folder to you BBB.
  • Now enter the extracted folder and create a python script (I have named my one "post.py"). Take care of the extension ".py". Note that this script should be just outside the temboo folder.
  • Now copy the generated python code from the TEMBOO website into your python script using any text editor like nano,vim etc in Putty. Take care of the indentations while copying because python is indentation sensitive.

  • Save and quit the editor and run the program using the command
python post.py
  • Make sure your BBB is connected to the internet. If not follow this post on how to connect your BBB to the Internet.
  • Now check your Facebook page to get your cool post from BBB.
BINGO! You have done your first Facebook post from your BBB.

What you can MAKE

You can use this tutorial to interface some sensors to your BBB and notify yourself via facebook post if any event occurs. For example burglar alarm, Room person counter, Room Electric appliance status and many more. You just need to know bit of coding in Python and Temboo will do the rest for you. So Happy IoTing with your BBB. And don't forget to +1 me and comment and share if you like my post.

No comments:

Post a Comment