Twitter Mood Lamp with idiotware shield
In this project i am going to demonstrate you how you can build your iot enabled lamp that will response on the tweets.
Things used in this project
Hardware components
- Arduino UNO x 1
- Idiotware Shield x 1
- USB-A to B Cable x 1
- Generic Jumper (0.1″) x 2
- Espressif ESP8266 ESP-01 x 1
- 9V 1A Switching Wall Power Supply x 1
Software apps and online services
- Arduino IDE
- Blynk
- Heroku
Story
Working
In this example we are using ESP8266-01 WiFi Module and on board WS2812 multicoloured led.
In this example we are using Blynk HTTP RESTful API. Blynk HTTP RESTful API allows to easily read and write values to/from Pins in Blynk apps and Hardware (microcontrollers and microcomputers like Arduino, Raspberry Pi, ESP8266, Particle, etc.).
Every PUT request will update Pin’s state both in apps and on the hardware. Every GET request will return current state/value on the given Pin. We also provide simplified API so you can do updates via GET requests.
You can read on how to do it here http://docs.blynkapi.apiary.io/#reference/0/get-pin-value/write-pin-value-via-get?console=1
Please Note: Use your Auth Token number in url to get data from server.
In this example we have used ESP8266_Lib.h and BlynkSimpleShieldEsp8266.h library to make communication between arduino and Blynk HTTP RESTful API. We have used Heroku Deployment Application to receive tweet from our twitter handle and then this application sends get request to Blynk HTTP RESTful API.
Setup:
- Install all libraries from our Github Repository to enable this example to run.
- Create account on BLYNK and use your Auth Token number in code and url.
- You will need to modify the python code ,so that the tweet lamp works for you.
- You will need to paste the Blynk generated token key in the python code.Once that is done you need to commit the code to Heroku git hub account .
Please Refer the link for more information
https://devcenter.heroku.com/articles/getting-started-with-python#set-up
For more information on how to write heroku script and deploy it go to
https://github.com/tommeagher/heroku_ebooks
You will also need to copy the Twitter Key to the Python code
def connect():
api = twitter.Api(consumer_key=MY_CONSUMER_KEY,
consumer_secret=MY_CONSUMER_SECRET,
access_token_key=MY_ACCESS_TOKEN_KEY,
access_token_secret=MY_ACCESS_TOKEN_SECRET)
return api
Precautions:
- Enter correct Auth Token number.
- Virtual pin number in code and url must be same.
- Check jumper for WS2812b multicoloured led is connected properly.
Configuring idIoTware Shield
Once you upload the code.The Tweet lamp will keep searching for tweets with tag name and the color .
Now you will have your own RGB mood lamp that responds to the Tweets on the twitter.
Schematics
Code
TweetPythonScript
This you will need to deploy on heroku github account: https://devcenter.heroku.com/articles/git
TweetLampArduino
Upload this in arduino
https://github.com/CuriosityGym/Arduino-Sketches/tree/master/fianl_sketches/tweet_lamp