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





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



    • Science of Cooking

      Science of Cooking
    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest

    We have a be nice policy.
    Please be positive and constructive.




    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"

    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.

    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?

    I will try that ;)

    Thank you for your support :)

    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.
    PLEASE I REALLY NEED. my email is

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

    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

    Could I do this with a PIR infrared sensor?

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