Chameleon Bag

The Chameleon Bag by Products of Design student Kathryn McElroy combines RFID tag technology and RGB LEDs to create “a fun and delightful experience. When I decided on creating a messenger bag with a reactive front panel, I knew that it would have a very functional aspect too,” says Kathryn. The project was executed in the first-semester Making Studio course.

“I further designed the bag to have three main functions,” says Kathryn. The bag changes its color to match clothing previously embedded with an RFID tag.

“The bag also allows for delightful interaction by the user placing a favorite totem, marked with an RFID tag, into the bag to display a cheery animation. Finally, the bag keeps track of what is placed inside and warns the user if they are missing an important item, such as keys or cell phone.”

For more on Kathryn’s process, check out her blog. The Arduino source code is as follows:

 

<pre class="brush: cpp; gutter: true">#include "SPI.h" 
#include "Adafruit_WS2801.h" 
#include "Adafruit_PN532.h" 

#define SCK (2) 
#define MOSI (3) 
#define SS (4) 
#define MISO (5) 
int led = 13; 
int dataPin = 11; // Yellow wire on Adafruit Pixels 
int clockPin = 12; // Green Wire 

Adafruit_PN532 nfc(SCK, MISO, MOSI, SS); 

// Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row 
Adafruit_WS2801 strip = Adafruit_WS2801(50, dataPin, clockPin); 

//////////////////////////////////// SETUP 

void setup(void) { 
Serial.begin(115200); 
Serial.println("Hello!"); 

nfc.begin(); 

uint32_t versiondata = nfc.getFirmwareVersion(); 
if (! versiondata) { 
Serial.print("Didn't find PN53x board"); 
while (1); // halt 
} 

// Got ok data, print it out! 
Serial.print("Found chip PN5"); Serial.println((versiondata&gt;&gt;24) &amp; 0xFF, HEX); 
Serial.print("Firmware ver. "); Serial.print((versiondata&gt;&gt;16) &amp; 0xFF, DEC); 
Serial.print('.'); Serial.println((versiondata&gt;&gt;8) &amp; 0xFF, DEC); 

// configure board to read RFID tags 
nfc.SAMConfig(); 

Serial.println("Waiting for an ISO14443A card"); 

//turn on LED strip 
strip.begin(); 

// Update LED contents, to start they are all 'off' 
strip.show(); 
} 

/////////////////////////////////// LOOP 

unsigned digit = 0; 

void loop() { 
boolean success; 
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID 
uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type) 

// wait for RFID card to show up! 
//Serial.println("Waiting for an ISO14443A Card ..."); 

// Wait for an ISO14443A type cards (Mifare, etc.). When one is found 
// 'uid' will be populated with the UID, and uidLength will indicate 
// if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight) 
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &amp;uidLength); 

uint32_t cardidentifier = 0; 

if (success) { 
// Found a card! 

Serial.print("Card detected #"); 
// turn the four byte UID of a mifare classic into a single variable # 
cardidentifier = uid[3]; 
cardidentifier &lt;&lt;= 8; cardidentifier |= uid[2]; 
cardidentifier &lt;&lt;= 8; cardidentifier |= uid[1]; 
cardidentifier &lt;&lt;= 8; cardidentifier |= uid[0]; 
Serial.println(cardidentifier); 

// repeat this for loop as many times as you have RFID cards 
if (cardidentifier == 3574307259) { // tardis 
gradient(50); //rainbow blue 
} 

if (cardidentifier == 3574370011) { //circle token (gloves) 
colorWipes(Color(0, 224, 112), 50); //green 

} 

if (cardidentifier == 4271042990) { // sticker 1 (scarf) 
colorSolid(Color(0, 224, 224), 50); //turquoise 

} 

if (cardidentifier == 2980480123) { // sticker 2 
colorAnimation(Color(255, 0, 0), Color(0, 255, 0), 500, 10); //christmas animation 
} 

if (cardidentifier == 2774304574) { // key fob 
rainbow(20); 
//colorWipes(Color(224, 0, 0), 50); 
} 

if (cardidentifier == 2761822987) { // card 
colorSolid(Color(0, 0, 0), 50); // turn off LEDs 
} 

} 
} 

/////////////////////////////////// HELPERS 

void colorSolid(uint32_t c, uint8_t wait) { 
int i; 

for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, c); 
} 
strip.show(); 
} 

void colorAnimation(uint32_t c, uint32_t d, uint8_t wait, uint8_t r) { 
int i; 
int j; 

for (j=0; j &lt; r; j ++) { 
for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, c); 
} 
strip.show(); 
delay(wait); 

for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, d); 
} 
strip.show(); 
delay(wait); 
} 
} 

void colorWipes(uint32_t c, uint8_t wait) { 
int i; 

for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, c); 
delay(wait); 
strip.show(); 
} 

} 

//Rainbow LED Function 
void gradient(uint8_t wait) { 
int i, j; 

for (j=150; j &lt; 151; j++) { 
for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, Wheel( (i + j) % 255)); 

} 
strip.show(); // write all the pixels out 
delay(wait); 
} 
} 

void rainbow(uint8_t wait) { 
int i, j; 

for (j=0; j &lt; 256; j++) { // 3 cycles of all 256 colors in the wheel 
for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, Wheel( (i + j) % 255)); 
} 
strip.show(); // write all the pixels out 
delay(wait); 
} 
} 

void rainbows(uint8_t wait) { 
int i, j; 

for (j=70; j &lt; 71; j++) { // 3 cycles of all 256 colors in the wheel 
for (i=0; i &lt; strip.numPixels(); i++) { 
strip.setPixelColor(i, Wheel( (i + j) % 255)); 
} 
strip.show(); // write all the pixels out 
delay(wait); 
} 
} 

// Create a 24 bit color value from R,G,B 
uint32_t Color(byte r, byte g, byte b) 
{ 
uint32_t c; 
c = r; 
c &lt;&lt;= 8; 
c |= g; 
c &lt;&lt;= 8; 
c |= b; 
return c; 
} 

//Input a value 0 to 255 to get a color value. 
//The colours are a transition r - g -b - back to r 
uint32_t Wheel(byte WheelPos) 
{ 
if (WheelPos &lt; 85) { 
return Color(WheelPos * 3, 255 - WheelPos * 3, 0); 
} else if (WheelPos &lt; 170) { 
WheelPos -= 85; 
return Color(255 - WheelPos * 3, 0, WheelPos * 3); 
} else { 
WheelPos -= 170; 
return Color(0, WheelPos * 3, 255 - WheelPos * 3); 
} 
}

 

FacebookTwitterGoogle+Email