Introduction: Do Not Enter(Twitter- Updates) (Without Ethernet Sheild)

Picture of 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--->>>

First of all here are the programs you need:


And the items needed are:

A distance sensor
A buzzer
A serial cable
( or blue-tooth transceiver if you want the thing to be wireless)

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:

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() {
twitter = new Twitter(username,password);
myFont = loadFont("AppleGothic-48.vlw");
textFont(myFont, 18);
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil(lf); //wiat for line feed to specify end of serial buffer

void draw() {
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
Status status1 = twitter.updateStatus("Arduino's favorite color is "+inString);//update twitter status
catch( TwitterException e) {

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.


// 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() {


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


void draw() {



// Initial connection
void connectTwitter() {

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


// 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 =;
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);


} 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


mmc1234 (author)2013-03-31

hi, when i try to run the sketch appears a problem:
for(int i=0; i Status status = (Status)statuses.get(i);
says: Syntax error, maybe missing a semicolon?
expecting SEMI, found "Status"

TobaTobias (author)2012-10-07

How do I make the processing sketch to read the arduino serial.println?
Because the processing works but what I need now it for it to read when the arduino prints.

francisroan (author)2012-10-02

i got this error on my processing sketch
Cannot instantiate the type twiiter
one of the guys in comments faced the sme prob do u know how to fx it?
im using twiiter4J V2.2.6
if i need to use an older version do u know where i can get it? could ya give me alink?

bullebak (author)2011-11-12

I will try that ;)

Thank you for your support :)

vishalapr (author)bullebak2011-11-12

Welcome ^_^

varuninnz (author)vishalapr2012-07-27

yea bro you have to download an older version the new version of does not work on processing.
I found it here on page

Download twitter4j2.1.3, I know it worked for the guy in the report.

I've battled everywhere on the net for this issue. I tried using twitter4j-2.2.0, twitter4j-3.0.0-SNAPSHOT, and also twitter4j-2.2.6

Does anyone have the download file

vishalapr can you please send me your Twitter4j file.

varuninnz (author)varuninnz2012-07-27

it still gives me an error, saying the gothic font could not be found. make sure that it is in the data folder of the sketch folder.

I dont know where to find the gothic font. So i loaded myFont = loadFont("LucidaTypewriterRegular.ttf"); and placed the LucidaTypewriterRegular.ttf file in my datafolder, but it still could not load anything.

If anyone knows anything about this, then please let me know...

varuninnz (author)varuninnz2012-07-29

okay i've done it. download the library i provided above and then go on processing, tools and create font and applegothic.

it works. thank you for the tutorial

TobaTobias (author)2012-04-06

Could I do this with a PIR infrared sensor?

vishalapr (author)TobaTobias2012-04-07

I have never tried it with a PIR infrared sensor before, but what my friend told me was he use this type of sensor and it worked fine but he had to tweak the code a little...

avraams (author)2011-06-23

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.

vishalapr (author)avraams2011-11-12

The standard project needs an arduino, a pc and an ethernet sheild, and with this ible I am removing one of the components...which is an awesome thing!

But the arduino is soooo popular that everone has one and most of the ppl these days have a pc, mac or linux .... so ....

And in the ethernet sheild version, you do not connect it directly to the router... :O
You cannect the sheild on the arduino, and then connect the arduino to the pc, not to the router :) !

vishalapr (author)avraams2011-07-02

Ya but U do not need the Ethernet shield so that's a +

bullebak (author)2011-10-31

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.

vishalapr (author)bullebak2011-10-31

When I tried it, it worked perfectly!

Maybe try downloading a different version of twitter4j (An earlier, stable version preferably) and then check if it works, if not then...reply to this comment and I will try and figure it out...

bullebak (author)vishalapr2011-11-10

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 :)

vishalapr (author)bullebak2011-11-10

Hmm...I have no clue why this is happening but maybe have a look at these forums :) They might help you out!

Check if these instructions might help you better out with the ible :)

...hope these help :)

bullebak (author)vishalapr2011-11-11

Thank You!

I found on this site: 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! ;)

bullebak (author)bullebak2011-11-11

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 ;)

vishalapr (author)bullebak2011-11-12

I don't really understand what you are saying....what do u mean by u can only tweet "Hey from Simple Processing woop woop #RobotGrrl"
Maybe a little more detail of the problem?

And why isn't the first one working... :(
How about you download and install both versions and open one version for the first code and the second version for the second code :)

bullebak (author)vishalapr2011-11-12

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?

vishalapr (author)bullebak2011-11-12

I used processing 1.2.0 and twitter4j 2.2.3 or 5 don't quite remember...

Probably the main reason is because you are using a mac because for the ible you are expected to be doing this on a pc...but now there are a lot more websites and ibles that have come up on this concept and maybe there are some mac ones that you can use :)

kylekosan23 (author)2011-07-26

can u do facebook

vishalapr (author)kylekosan232011-07-26

can try but not really needed for me!

cris3D (author)2011-06-23

"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?

vishalapr (author)cris3D2011-07-02

Drag any files (even in the subfolders) ending with .jar into the processing sketch, as U need different files in different versions.

beehard44 (author)2011-06-05

Finally! an 'ible showing how to connect to the net without an ethernet shield!

and-reas (author)beehard442011-06-27

But you'll always need a host computer, sometimes that isn't possible or handy.

vishalapr (author)beehard442011-06-10

Thanks and vote for this

Deadmatrixz (author)2011-06-16

Oober cool!!

noob1414 (author)2011-06-14

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!!!

punx777 (author)2011-05-22

An LCD screen would likely be an easy addition. :) Tell them not to touch it on the lcd.

vishalapr (author)punx7772011-06-10

I think that I will add an LCD screen

beehard44 (author)punx7772011-06-10

what about a wave shield that plays "can't touch this"?

vishalapr (author)beehard442011-06-10

I guess...

vishalapr (author)punx7772011-05-22

I was thinking about adding a cool device I got recently, it basically give a mild shock when give it voltage even when you do not touch it, so I was thinking that maybe I could add that so that ifhe comes too close then he will get a mild shock

punx777 (author)vishalapr2011-05-22

Total win. is it cool to have that close to things the voltage might jump to? like your ardrino or something?

vishalapr (author)punx7772011-05-23

I actually put the arduino about 5-10 meters away or else the arduino will go poof
But you need to give voice recognized command to the thing to turn it on!!
Its really cool, I found it in a toy I broke last week

Computothought (author)2011-05-22

Do you still have to have a pc to send the tweets?

vishalapr (author)Computothought2011-05-22

You can use a pocket pc(Phone sized pc) but if you look on the internet, I'm pretty sure that you can find out ways to do this with your iphone/ipad etc

Computothought (author)vishalapr2011-05-22

Thanx for answering my question. Answer: "Yes, you do need another device."

vishalapr (author)Computothought2011-05-23

Actually you could use this kit to control the device without any pc or anything

Its like a remote for a remote control car but way cheaper as it costs only 10 dollars for the item with shipping to where I live(Poland)

Computothought (author)vishalapr2011-05-23

I have a spare legacy pc, that will just fine.

vishalapr (author)Computothought2011-05-23

Ok Cool

anoop vanguru (author)2011-05-19

I like this ible well done vishalapar
I tried it and it worked perfectly

vishalapr (author)anoop vanguru2011-05-22

Thanks, then please vote

flyingpuppy (author)2011-05-21

Could this work as a house alarm? Let me know someone's at my door?

vishalapr (author)flyingpuppy2011-05-21

Ya yoiu could put it at the side of your door and then as someone comes in you can trigger your speakers or something because a buzzer isn't enough to do that

punx777 (author)vishalapr2011-05-22

Or it could turn a light on, I saw an instructable about controlling ac electronix with an ardrino or something.

vishalapr (author)punx7772011-05-22

Ya that would be a cool thing as well, and by the way do you like this ible, if you do then please vote when the voting period starts

About This Instructable




Bio: A programming enthusiast. I tinker around with everything I see and love to game.
More by vishalapr:Diffused Glue Stick LampATtiny85 POV DisplayArtoo [R2] (ATtiny2313 Wall Avoiding Robot)
Add instructable to: