Twitter Button

From Null Space Labs

(Difference between revisions)
Jump to: navigation, search
(Status)
(Status)
 
Line 8: Line 8:
==Status==
==Status==
-
<b>BETA TESTING</b><br><br>
+
<b>Active Use!</b><br>
-
The button is up and running on the back-left table.<br>
+
The button is up and mounted next to the door!<br>
-
<b>Please test it</b> if you are the first or last person at [nsl].<br><br>
+
Current twitter button status can be viewed on the [[When Are You There?]] page :)
Current twitter button status can be viewed on the [[When Are You There?]] page :)

Latest revision as of 02:51, 5 February 2011

The Twitter Button is Back in Business!
(Expect updated code soon)
Note: Twitter changed its authentication system to reject basic http auth... This might does work: http://www.arduino.cc/playground/Code/TwitterLibrary

Contents

Summary

The "Twitter Button" project's goal is to use a big red HAL9000 button to indicate via twitter that a keyholder is present at [NSL]
The project has since been expanded to include an RFID reader to identify keyholders in addition to the button.

Status

Active Use!
The button is up and mounted next to the door!
Current twitter button status can be viewed on the When Are You There? page :)

Objectives

Completed:

  • Light up button while "NSL is open"
  • Tweet status
  • Status change by button-press
  • Read and Identify RFID card
  • Status change by RFID read
  • Specific status change based on RFID card used
  • Twitter session [no longer] expires after 10 min.
  • Twitter wont let you "retweet" past posts... (need to make each post [is now] unique)

In Progress:

  • Configure for keyholder RFID cards... So far I have a handful of cards set up, let me know if I've missed you...
  • Package into Box
  • Sleep

Current Issues:

  • Twitter has a limit on posts per hour... not nice for testing
  • Fit everything into the box, need to play more tetris. (I think that everything fits now)
  • Make holes in box for power/ethernet/usb/program mode button

Future Plans:

  • Authenticate RFID with a Python app on server.

Code - Basic Concept

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 5, 247 };			    // this is the ip within my lan
byte gateway[] = { 10, 0, 0, 1 };			// neccessary to get access to the internet via your router
byte subnet[] = { 255, 0, 0, 0 };
byte server[] = { 128, 121, 146, 100 };		   // Twitter's ip

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600);

  delay(1000);
  Serial.println(`connecting...`);

  if (client.connect()) {
    Serial.println(`connected`);
    client.println(`POST http://twitter.com/statuses/update.json HTTP/1.1`);
    client.println(`Host: twitter.com`);
    client.println(`Authorization: Basic XXXXXXXXXXXXX`);// the string of ###s after `Basic` is the base64_encoded Text of username:password of your twitter account
    
												// you can do the encoding at this site: http://www.functions-online.com/en/base64_encode.html
    client.println(`Content-type: application/x-www-form-urlencoded`);
    client.println(`Content-length: 28`);					 // this is the length of the text `Yahoo, im twittering!`
    client.println(`Connection: Close`);
    client.println();
    client.print(`status=Yahoo, im twittering!`);

  } else {
    Serial.println(`connection failed`);
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println(`disconnecting.`);
    client.stop();
    for(;;)
	;
  }
} 

Contact

Any inquiries/suggestions should be told/sent/given/yelled to Davo in person, via the nsl list, or via IRC... :)

Personal tools