Arduino Tweet Switch
This project uses the Arduino Uno and Wi-Fi Shield to send a Tweet to Twitter upon activation of a switch. Yes I know this is not a new idea but I have designed this so that it can be easily adapted for other applications.
This also works with the NEW Twitter 1.1 API
New API
All of the existing examples of applications where Arduino connects to Twitter that I could find use the Arduino Twitter Library, but since Twitter updated their API it no longer functions.
Custom Data
Another reason for not wanting to use any existing library’s is that I can customise my data exactly to my needs, rather than design my project around someone else’s data.
This ensures I do not waste precious memory on the Arduino with functions that I will never use and give me greater flexibility to do exactly what I want.
Versatile Functions
My code interface has been designed to be a universal solution for a range of products and thus able to connect to other social networks such as Facebook, it can also act as an SMS gateway.
How to build the Arduino Tweeter
What you need-:
Hardware-:
Arduino
I used the UNO but I guess you can use any version or even a clone as long as it is compatible with a Wi-Fi add-on.
Wi-Fi Shield
I used the official shield but again I guess you can use any Wi-Fi add-on again as long as it is compatible with your choice of main board.
Components
The only components you need is a SPST NO switch, a 10K Resistor and LED
Software -:
The software requirements are a little more demanding.
Host PHP script
You will need a server or web space that can run PHP script e.g. Linux Server
It might even be possible to run the code on your own network by installing a personal server on your windows computer such as XAMPP but I haven’t tried that yet.
If there is demand I may allow third party access to my script. Please ask me for details if you are interested in a script hosting option for your internet enabled devices.
Twitter
It is essential you have a twitter account to tweet to and a registered application for the use of your device.
Again if demand exists I may allow you to use my registered application for testing purposes. Ask for more details.
Instructions
Build the circuit
Very simple mount your Arduino and Wi-Fi shield together as per manufactures instructions.
Wire an LED between PIN 8 and GND
Wire a 10K Resistor between PIN 2 and GND
Wire the switch between PIN and +5V
Write Arduino Code
Download, open, copy and paste code to your Arduino programmer and install it on your Arduino. It is not important what you call this file.
TweetSwitch1_02.ino.txt
Write PHP script
Download and save the PHP code to your server. You must rename it as twitterapi.php
twitterapi.php.txt
Twitter Account
Get your Twitter application keys and twitter account access tokens and copy them into the PHP code above.
I will not explain how to do this as there are already plenty of tutorials available online.
Test
Power-up and press your tweet button and you should see your tweet appear on your Twitter feed.
Modify with your imagination
Finally how you tweet and what you tweet is only limited to your imagination and 160 characters of course.
If you are holding an event you can automatically tweet when a new person enters by using a PIR, pressure pad or even an IR beam to detect when people enter a door.
You could count views to an exhibit, tweet when someone views it and even display the viewer a message.
I am considering making a Tweet Robot that travels around a room automatically taking photos and sending them as tweets.
That will obviously require quite some hardware and software modifications but I would assume be perfectly possible.
If you’re still stuck for ideas then you can search the internet and find ideas to connect your home appliances to Twitter such as washing machines, toasters, coffee makers and even your fridge.
|