What’s the temperature?

This project started in a hackathon. It will listen to “#HowHot” and “#HowCold” hashtags on Twitter. When such hashtag is published, IOT device will measure the temperature and tweet it. If you follow @sameerIOTApps , tweet will be posted as reply to you. Else it will be a notification. The temperature that is published is measured inside my house. So it will not vary much over time. It is also not calibrated for accuracy. If you do not get a response for your tweet there can be one or more reasons:

  1. Your tweets are protected
  2. My twitter account ran out of quota. (Wait for 15 min and try)

How is it done? It has been built using ElectricImp dev kit. ElectricImp provides IOT development platform including hardware for the device + server to communicate with it. This platform has two parts, Device (i.e. the Physical device) and Agent (part that resides on the server) that communicates with the device. The agent sends message to the device using device.send method. It listens to the events from the device using device.on method. The agent communicates with external world through REST APIs using httpRequest and httpResponse objects. It also provides libraries to communicate with the commonly used web services such as Twitter, Twillio etc. It can be extended to connect to your services by creating libraries using REST API. This project uses Twitter library. The device provides access to physical hardware platform. Various sensor and displays (aka as Tails) can be plugged in the device. The software part of the device provides layer to communicate with the hardware and with the corresponding agent. It sends message to the agent through agent.send method and listens to message from server using agent.on method. Parts Needed:

  • Electricmp Dev Kit
  • Imp
  • Weather Tail for ElectricImp

Check their dev center – https://electricimp.com/docs/ Other Requirements:

  • ElectricImp developer account.
  • Twitter developer account
  • Wi-Fi connection

Steps: Setup your ElectricImp as per the setup procedure given here https://www.electricimp.com/docs/gettingstarted/ . If you have windows machine, use the software attached in the discussion https://forums.electricimp.com/discussion/126/blink-up-app-for-windows/p2 . (Tip: Make sure that your screen brightness is at max during the BlinkUp™) Open IDE from https://ide.electricimp.com/ide . Copy paste the agent code from the agent.nut and device code from device.nut from the GitHub https://github.com/sameerkapps/WhatsTheTemp . When the agent runs, it will listen to the Tweets for the #HowCold and #HowHot hashtags. When such hashtag is detected, it send the username to the device. The device will measure the temperature and send the username and temperature back to the agent. When agent receives the temperature and username, it will compose a tweet and post it on twitter. The code has detail documentation about how it works. The project can have unfavorable situations such as wi-fi or device is down. To account for such situations, when server receives a tweet, it checks if the device is connected. If not, it tweets that information. This project can be enhanced for practical applications such as monitoring potential fire dangers, turning certain equipment(s) on/off based on the temperature.

Advertisements

Published by: Sameer Khandekar

This blog is about my hobby projects. The hobby projects include Arduino, IOT, ElectricImp, Mobile Apps and anything that catches interest. The intention of the blog is to share the knowledge. To know more about me: https://sameerkapps.wordpress.com/about/

Categories Uncategorized1 Comment

One thought on “What’s the temperature?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s