3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Do not Enter(Twitter- updates) (Without Ethernet Sheild)

Do not Enter(Twitter- updates) (Without Ethernet Sheild)
In this instructable I will tell you how to connect to twitter from your arduino WITHOUT the Ethernet shield, I searched the internet a lot and couldn't find anyone who actually tells you how to connect to twitter without the Ethernet shield.

This program will send an update to twitter if someone comes too close to the arduino trying to take it or if you put it on the door, and if someone enters your room etc as the title says.

Please vote for this in the Adafruit-Make-It-Tweet contest--->>>
HERE


First of all here are the programs you need:

Arduino(http://arduino.cc/en/Main/Software)
Processing(http://processing.org/download/)

And the items needed are:

Arduino
A distance sensor
A buzzer
A serial cable
( or blue-tooth transceiver if you want the thing to be wireless)
(http://cgi.ebay.com/Serial-Bluetooth-RF-Transceiver-Module-rs232-backplane-/170628681891?pt=AU_B_I_Electrical_Test_Equipment&hash=item27ba4310a3)

Open your arduino and write a code for your program, what my program did was it kept recording distance sensor values and if the values were less than 15 then it posted a twitter update and activated the buzzer.(Make sure you say serial.println("Person too close")only when the values are less than 15 as whatever you print via serial will be posted on twitter).

Then open up your processing window and type this code in

/*************
* based on: http://processing.org/reference/libraries/serial/serialEvent_.html
*************/

import processing.serial.*;

Serial myPort; // The serial port
PFont myFont; // The display font
String inString; // Input string from serial port
int lf = 10; // ASCII linefeed

Twitter twitter; // Twitter

//Going to get oAuth working instead of this, but this will do for now
String username = "YOUR-TWITTER-USERNAME"; // you Twitter Username Here
String password = "YOUR-TWITTER-PASSWORD"; // your Twitter Password Here

void setup() {
size(400,200);
twitter = new Twitter(username,password);
myFont = loadFont("AppleGothic-48.vlw");
textFont(myFont, 18);
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil(lf); //wiat for line feed to specify end of serial buffer
}

void draw() {
background(100);
text("color selected: " + inString, 10,50);
}

void serialEvent(Serial p) {
inString = p.readString();//read serial string
//For some reason this only wanted to work in a try catch
try
{
Status status1 = twitter.updateStatus("Arduino's favorite color is "+inString);//update twitter status
}
catch( TwitterException e) {
println(e.getStatusCode());
}
}

Make sure you change USERNAME and PASSWORD with your twitter accounts username and password.
Make sure that you only use serial.println command on whatever you want to post on twitter.

OR USE THIS CODE IF YOU WANT TO POST TO AN APPLICATION ON TWITTER

// This is where you enter your Oauth info
static String OAuthConsumerKey = "";
static String OAuthConsumerSecret = "";

// This is where you enter your Access Token info
static String AccessToken = "";
static String AccessTokenSecret = "";

// Just some random variables kicking around
String myTimeline;
java.util.List statuses = null;
User[] friends;
Twitter twitter = new TwitterFactory().getInstance();
RequestToken requestToken;
String[] theSearchTweets = new String[11];


void setup() {

size(100,100);
background(0);

connectTwitter();
sendTweet("Hey from Simple Processing woop woop #RobotGrrl");

}


void draw() {

background(0);

}


// Initial connection
void connectTwitter() {

twitter.setOAuthConsumer(OAuthConsumerKey, OAuthConsumerSecret);
AccessToken accessToken = loadAccessToken();
twitter.setOAuthAccessToken(accessToken);

}

// Sending a tweet
void sendTweet(String t) {

try {
Status status = twitter.updateStatus(t);
println("Successfully updated the status to [" + status.getText() + "].");
} catch(TwitterException e) {
println("Send tweet: " + e + " Status code: " + e.getStatusCode());
}

}


// Loading up the access token
private static AccessToken loadAccessToken(){
return new AccessToken(AccessToken, AccessTokenSecret);
}


// Get your tweets
void getTimeline() {

try {
statuses = twitter.getUserTimeline();
} catch(TwitterException e) {
println("Get timeline: " + e + " Status code: " + e.getStatusCode());
}

for(int i=0; i Status status = (Status)statuses.get(i);
println(status.getUser().getName() + ": " + status.getText());
}

}


// Search for tweets
void getSearchTweets() {

String queryStr = "@RobotGrrl";

try {
Query query = new Query(queryStr);
query.setRpp(10); // Get 10 of the 100 search results
QueryResult result = twitter.search(query);
ArrayList tweets = (ArrayList) result.getTweets();

for (int i=0; i Tweet t = (Tweet)tweets.get(i);
String user = t.getFromUser();
String msg = t.getText();
Date d = t.getCreatedAt();
theSearchTweets[i] = msg.substring(queryStr.length()+1);

println(theSearchTweets[i]);
}

} catch (TwitterException e) {
println("Search tweets: " + e);
}

}

and change token and secret in the top with your applications secret and token...

Then download Twitter4j and drag all the files ending with .jar into the processing sketch that is opened.
As you add files the processing window will say 1 file added or 5 files added or 2 files added etc.

And then you are done just run the processing code and make sure the arduino is powered and your touch me not twitter updater is ready.If you want any details on any step please ask me for them and I will try my best to help.

The buzzer is a really small buzzer and might not be noticeable in any of the pictures.

Another alternative if you do not have a distance sensor is by using a laser pointer and a photo cell, all you need to do is hook up the photo cell to a PNP transistor, and make sure that the laser pointer is pointing at the photo cell, and as someone enters, then laser is cut and the buzzer goes on.
If you want to laser protect more doors, then just add mirrors so that the laser pointer goes all the way from one door to another until the photo cell, and if anyone enters any of the doors, your alarm system goes on.

I'm not really making a step by step instructable as this is just brief info about my Touch Me Not program and how to make your own.

Please comment, rate and subscribe

44 comments
1-40 of 44next »
Apr 6, 2012. 12:24 PMTobaTobias says:
Could I do this with a PIR infrared sensor?
Jun 23, 2011. 10:25 AMavraams says:
So, if I understand right, this is "Twitter- updates Without Ethernet Shield" but you need a computer to send the twits, right? Replacing the Ethernet Shield (which can be connected directly to the router) with a computer, it's not such a grand idea. Sorry to be critical, but all what this project does is to talk with the computer over serial connection and let the computer do the internet stuff.
Oct 31, 2011. 11:45 AMbullebak says:
When I try to Run or Export the Processing program it gives a fault. I add a pic with the problem. I already add all 18 .jar files from twitter4j version 2.2.5.
Nov 10, 2011. 7:33 PMbullebak says:
I tried to download an other version of twitter4j, but I could not find one. I still got the problem, I did change the twitter name and password, but it didn't work.
If you will look at it, thank you in advance :)
Nov 11, 2011. 9:28 PMbullebak says:
Thank You!

I found on this site:
http://forum.processing.org/topic/twitter4j-problem-cannot-instantiate-type-twitter an download link to twitter4j 2.5.0 I tried that and that works :D

means that twitter4j 2.5.5 don't work...

again thank you! ;)
Nov 11, 2011. 11:01 PMbullebak says:
But that was with the application code... now I tried the first one and that does not work.

But with the application code, I only can send the tweet: "Hey from Simple Processing woop woop #RobotGrrl"
and I can not find something in that code to read the serial.

Sorry, but I am really a noob with Processing ;)
Nov 12, 2011. 1:41 PMbullebak says:
Could it be a problem that I'm using a Mac?

I downloaded Processing 1.2.1 and twitter4j 2.2.0, on the first code I still get the error: "Cannot instantiate the type Twitter" even when I did all steps.

The second code works, but what I mean was: When I start the program, it only says the text: "Hey from Simple Processing woop woop #RobotGrrl" on twitter, but I could not find something in the code to read out the serial. Maybe I understand the use for that code completely wrong. ;)

What version of twitter4j and Processing did you use?

Nov 12, 2011. 9:29 AMbullebak says:
I will try that ;)

Thank you for your support :)

Jul 26, 2011. 8:14 AMNE patsrock says:
can u do facebook
Jun 23, 2011. 1:19 PMcris3D says:
"Then download Twitter4j and drag all the files ending with .jar into the processing sketch that is opened.
As you add files the processing window will say 1 file added or 5 files added or 2 files added etc."

I download the file twitter4j-2.2.3, but there are many files, could be more specific?
Jun 5, 2011. 8:28 AMbeehard44 says:
Finally! an 'ible showing how to connect to the net without an ethernet shield!
Jun 27, 2011. 3:37 AMand-reas says:
But you'll always need a host computer, sometimes that isn't possible or handy.
Jun 16, 2011. 10:17 PMDeadmatrixz says:
Oober cool!!
Jun 14, 2011. 9:41 AMnoob1414 says:
Brilliant, now I don't need to waste 30 dollars on an Ethernet shield, as I had to communicate with the internet and I was searching for ways on how to without the shield, hope you win the contest!!!
May 22, 2011. 8:28 PMpunx777 says:
An LCD screen would likely be an easy addition. :) Tell them not to touch it on the lcd.
Jun 10, 2011. 8:19 AMbeehard44 says:
what about a wave shield that plays "can't touch this"?
May 22, 2011. 10:45 PMpunx777 says:
Total win. is it cool to have that close to things the voltage might jump to? like your ardrino or something?
May 22, 2011. 4:54 AMComputothought says:
Do you still have to have a pc to send the tweets?
May 22, 2011. 10:53 PMComputothought says:
Thanx for answering my question. Answer: "Yes, you do need another device."
May 23, 2011. 5:13 AMComputothought says:
I have a spare legacy pc, that will just fine.
May 19, 2011. 9:38 AManoop vanguru says:
I like this ible well done vishalapar
I tried it and it worked perfectly
1-40 of 44next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
90
Followers
35
Author:vishalapr
Coolest site ever -I-N-S-T-R-U-C-T-A-B-L-E-S-.-C-O-M