Introduction: RFID LED Strip.

I decided to approach a common problem of mine, that in some situations could be addressable by law; A bike light. I could simply go out and buy a simple led light for it, but whats the fun in that?

I am only really address a very bare bone build, avoiding any sort of feature creep. I do want to add features in the future, but whats the point of adding anything if the core piece doesn't work properly. Hopefully you'll be able to spin your own from the idea.

You could find some use in the idea, but it's also a more expensive path. Something that is a 10-20$ price tag easily racks up to being a 60-70$ then whatever other feature ontop of that. So be warned~!

partlist

RFID Reader ID-20LA (125 kHz) SEN-11828

LED RGB Strip - Addressable, Sealed (1m) COM-12027

RFID Button - 16mm (125kHz) SEN-09417

(ps. don't buy the wrong frequency if you want a different tag)

and also using for some coding assistance.

Fastled Library

Step 1: Initial Connections

I'm using the breadboard to bridge the ground and 5v connection. The two graphs is essentially the hook up that I am currently using.

Some referenced guides

Addressable LED's

RFID Arduino

Step 2: The Code

Modifying the codes that were presented to me, I find myself with this recipe that works in proximity of using the RFID as an on/off switch.

#include
#define LED_PIN 5 #define COLOR_ORDER GRB #define CHIPSET WS2811 #define NUM_LEDS 60 #define BRIGHTNESS 200 bool gReverseDirection = false; CRGB leds[NUM_LEDS]; int RFIDResetPin = 13; bool lightOn = false; //Register your RFID tag here char tag1[13] = "7F001B29A9E4"; void setup(){ delay(30); // sanity delay FastLED.addLeds(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); offLED(); Serial.begin(9600); pinMode(RFIDResetPin, OUTPUT); digitalWrite(RFIDResetPin, HIGH); //ONLY NEEDED IF CONTROLING THESE PINS - EG. LEDs pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); } void loop(){ char tagString[13]; int index = 0; boolean reading = false; while(Serial.available()){ int readByte = Serial.read(); //read next available byte if(readByte == 2) reading = true; //begining of tag if(readByte == 3) reading = false; //end of tag if(reading && readByte != 2 && readByte != 10 && readByte != 13){ //store the tag tagString[index] = readByte; index ++; } } checkTag(tagString); //Check if it is a match clearTag(tagString); //Clear the char of all value resetReader(); // reset the RFID reader delay(800); } void checkTag(char tag[]){ /////////////////////////////////// //Check the read tag against known tags /////////////////////////////////// if(strlen(tag) == 0) return; //empty, no need to contunue Serial.println(tag); //read out any tag if(compareTag(tag, tag1)){ toggleLED(); } } void toggleLED(){ if (lightOn) { offLED(); } else { onLED(); } delay(100); FastLED.show(); lightOn = !lightOn; } void onLED() { for ( int j = 0; j < NUM_LEDS; j++) { leds[j] = CRGB::Red; } } void offLED() { for ( int j = 0; j < NUM_LEDS; j++) { leds[j] = CRGB::Black; } } void resetReader(){ /////////////////////////////////// //Reset the RFID reader to read again. /////////////////////////////////// digitalWrite(RFIDResetPin, LOW); digitalWrite(RFIDResetPin, HIGH); delay(150); } void clearTag(char one[]){ /////////////////////////////////// //clear the char array by filling with null - ASCII 0 //Will think same tag has been read otherwise /////////////////////////////////// for(int i = 0; i < strlen(one); i++){ one[i] = 0; } } boolean compareTag(char one[], char two[]){ /////////////////////////////////// //compare two value to see if same, //strcmp not working 100% so we do this /////////////////////////////////// if(strlen(one) == 0) return false; //empty for(int i = 0; i < 12; i++){ if(one[i] != two[i]) return false; } return true; //no mismatches }

Step 3: My Own Final Prototype

It's definitely not the cream of the crop aesthetically, but the idea entertained. There are things that I do need to address before going further with the idea, like a better housing. Currently using an Altoids can, but only to find that the tin actually blocks the frequency of the RFID. Because of that, the RFID is poorly attached to the outside of the can. In it's current iteration, it withstand a 15 minute motorcycle ride attached to the backpack at around 35-45 mph. I would personally prefer a more sleek design.

Some issues within the code, once I get more free time to examine and/or a correction can be found. The RFID is a 9v killer as its always running, would be nice to find a way to prevent it from running when not needed. Other problem being something I want to resolve after I make a better housing unit is to figure if I need to change delays for inaccuracies.

Beyond that though, the options are endless. Orr, better options are available than an RFID.