Thursday, March 3, 2011

We own your Waste - Physical Rights Management Recycle bin



This prototype uses an blue LED light, a servo, and an RFID reader with 4 RFID cards on the Arduino platform. The bin closes when the Reader detects the unique identifier of the RFID card attached to an object that is valuable to the city of Toronto. It can only open when it detects the ID card of a City of Toronto worker. The project comments on how ubiquitous computing could be used by the city (or private company) as a way to enforce its legal ownership of our waste. We looked at watermarking as a technique for discretely attaching information to a physical object by embedding an 'invisible' RFID tag within it. The City of Toronto legally takes ownership of our waste the moment we take it to the curb or put it in a city bin. This critical technology project makes that ownership relationship explicit.


Arduino Code:

// RFID reader ID-12 for Arduino
// Based on code by BARRAGAN
// and code from HC Gilje - http://hcgilje.wordpress.com/resources/rfid_id12_tagreader/
// Modified for Arudino by djmatic
// Modified for ID-12 and checksum by Martijn The - http://www.martijnthe.nl/
//
// Use the drawings from HC Gilje to wire up the ID-12.
// Remark: disconnect the rx serial wire to the ID-12 when uploading the sketch

//Modified by Alejandro Lopez http://www.archinteractive.net/ with Servo Sweep and Blink light codes

#include

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position


void setup() {
Serial.begin(9600); // connect to the serial port
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(13, OUTPUT);
}

void loop () {
byte i = 0;
byte val = 0;
byte code[6];
byte checksum = 0;
byte bytesread = 0;
byte tempbyte = 0;
myservo.write(180);

if(Serial.available() > 0) {
Serial.println("ok");
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off

if((val = Serial.read()) == 2) { // check for header
bytesread = 0;
while (bytesread < 12) { // read 10 digit code + 2 digit checksum if( Serial.available() > 0) {
val = Serial.read();
if((val == 0x0D)||(val == 0x0A)||(val == 0x03)||(val == 0x02)) { // if header or stop bytes before the 10 digit reading
break; // stop reading
}

// Do Ascii/Hex conversion:
if ((val >= '0') && (val <= '9')) { val = val - '0'; } else if ((val >= 'A') && (val <= 'F')) { val = 10 + val - 'A'; } // Every two hex-digits, add byte to code: if (bytesread & 1 == 1) { // make some space for this hex-digit by // shifting the previous hex-digit with 4 bits to the left: code[bytesread >> 1] = (val | (tempbyte << 4)); if (bytesread >> 1 != 5) { // If we're at the checksum byte,
checksum ^= code[bytesread >> 1]; // Calculate the checksum... (XOR)
};
} else {
tempbyte = val; // Store the first hex digit first...
};

bytesread++; // ready to read next digit
}
}

// Output to Serial:

if (bytesread == 12) { // if 12 digit read is complete
//Serial.print("5-byte code: ");
for (i=0; i<5; i++) { if (code[i] < 16) Serial.print("0"); Serial.print(code[i], HEX); // Serial.print(" "); } Serial.println(); //Serial.print("Checksum: "); Serial.print(code[5], DEC); int val = code[5]; Serial.println(code[5] == checksum ? " -- passed." : " -- error."); Serial.println(); if (val == 2){ Serial.println("yes bitches"); for(pos = 100; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees

{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(150); // waits 15ms for the servo to reach the position
}
}


if (val == 19){
Serial.println("yes bitches");
for(pos = 0; pos < 100; pos += 1) // goes from 0 degrees to 180 degrees

{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(150); // waits 15ms for the servo to reach the position
}
}
}

bytesread = 0;
}
}
}

No comments:

Post a Comment