This week has been all about RFID projects. Last week ended with an RFID implant in my left hand so it logically follows. Things got off to a slow start when I tried to integrate an RC522 board into a project but that failed spectacularly for a couple reasons. First, this reader is for a different frequency which actually turns out to be good news because my NFC tag uses that frequency so maybe I can read my NFC tag for some projects. Secondly I couldn't even talk to the darn thing. I've had miserable luck with communication in the past and this didn't really surprise me. Someday I will get it right.
After crashing and burning with the first reader I turned to something foolproof. Commercial RFID readers are commonplace and inexpensive so one for cars was easy to pick up for a few dollars. Less than $10USD actually. The basic premise of the system is that it comes preloaded with a master tag, which is held in a steel case to prevent accidental readings, which allows the user to train new tags. The system came with two tags, already taught, so I scanned the master and it learned my implant. That was that. An evening of tinkering and attaching 12 volts lead to a workable system which I could use to turn on a 12V light.
Making this system work in my car was not especially easy. Most cars allow the user to simply hook this device in parallel to the unlock switch. That would be too easy. My car, a '99 Toyota Avalon, has a security system which will honk the horn and flash the lights if someone hits the unlock button while the car is locked and the ignition key removed. Security prevents someone from reaching through the window and pressing the unlock button. My solution was to use the RFID reader to activate one of the remote key fobs which I took apart and attached wires to the correct button. Honestly, not my most elegant solution.
The resulting tangle of wires on my dash was a fully functional rat's nest of wires. An evening with a drill press at the local hack space and a plastic enclosure made short work of those wires. The resulting appearance is a lot tidier and doesn't slide all over when I turn the car. This project, a far cry from the RC522 debacle, completed successfully.
After being defeated by one communication problem I quickly jumped at the opportunity to try again. This time a module I had purchased years ago was on trial. Communication with this module was standard RS232 therefore less daunting. Communication through a TTL <-> USB module didn't take long but making it talk to and Arduino wasn't easy. In my research of Arduino communication I had seen a software library which could emulate serial communication on any Arduino pins which allowed the use of interrupts. After installing the library and hooking it up I was pleased to see that it worked well. This opened up possibilities for future projects if the same technique can be used on Arduinos which can emulate mice and keyboards.
The most practical, and easy to understand, project to attempt was to program the Arduino to act like the commercial unit which had just been installed in my car. Simply, to have a master tag which teaches the system how to recognize new acceptable tags. In addition I also wanted to have an output which went high if someone tried to scan an unauthorized tag. In other words if someone tried to hack my system I wanted to know. One difficulty was making the system remember a tag after power had been shut off. Arduinos contain some non-volatile memory, EEPROM in this case, which can be accessed. Learning to use the commands look a little time but it should be a great bit of knowledge in the future.
Since I wanted anyone to be able to download the code to their Arduino, without programming skill, and run this program it was important that there be a system for setting the Master tag. Currently this is done by starting with a blank slate, adding the program, scanning the Master tag then resetting the Arduino. From that point on that tag will be recognized as the Master and can be used to teach new tags. Up to 8 valid tags can be programmed. The last problem to overcome is getting the system to stop recording duplicate tags. Currently, when the Master tag is scanned the system goes into learning mode and will just keep memorizing anything which gets scanned until the system is reset. This is filling up the memory fast with lots of unnecessary data. Once this problem is fixed the project will be completed.
The rest of the weekly summaries have been arranged by date.
RC522 module on the left. FAILED
After crashing and burning with the first reader I turned to something foolproof. Commercial RFID readers are commonplace and inexpensive so one for cars was easy to pick up for a few dollars. Less than $10USD actually. The basic premise of the system is that it comes preloaded with a master tag, which is held in a steel case to prevent accidental readings, which allows the user to train new tags. The system came with two tags, already taught, so I scanned the master and it learned my implant. That was that. An evening of tinkering and attaching 12 volts lead to a workable system which I could use to turn on a 12V light.
Commercial RFID reader
Making this system work in my car was not especially easy. Most cars allow the user to simply hook this device in parallel to the unlock switch. That would be too easy. My car, a '99 Toyota Avalon, has a security system which will honk the horn and flash the lights if someone hits the unlock button while the car is locked and the ignition key removed. Security prevents someone from reaching through the window and pressing the unlock button. My solution was to use the RFID reader to activate one of the remote key fobs which I took apart and attached wires to the correct button. Honestly, not my most elegant solution.
Hacked key fob
The resulting tangle of wires on my dash was a fully functional rat's nest of wires. An evening with a drill press at the local hack space and a plastic enclosure made short work of those wires. The resulting appearance is a lot tidier and doesn't slide all over when I turn the car. This project, a far cry from the RC522 debacle, completed successfully.
Functional rat's nest
Tidy boxes on my dash
After being defeated by one communication problem I quickly jumped at the opportunity to try again. This time a module I had purchased years ago was on trial. Communication with this module was standard RS232 therefore less daunting. Communication through a TTL <-> USB module didn't take long but making it talk to and Arduino wasn't easy. In my research of Arduino communication I had seen a software library which could emulate serial communication on any Arduino pins which allowed the use of interrupts. After installing the library and hooking it up I was pleased to see that it worked well. This opened up possibilities for future projects if the same technique can be used on Arduinos which can emulate mice and keyboards.
RFID reader hooked to an emulated serial port on Arduino
The most practical, and easy to understand, project to attempt was to program the Arduino to act like the commercial unit which had just been installed in my car. Simply, to have a master tag which teaches the system how to recognize new acceptable tags. In addition I also wanted to have an output which went high if someone tried to scan an unauthorized tag. In other words if someone tried to hack my system I wanted to know. One difficulty was making the system remember a tag after power had been shut off. Arduinos contain some non-volatile memory, EEPROM in this case, which can be accessed. Learning to use the commands look a little time but it should be a great bit of knowledge in the future.
Three different tags to demonstrate. One master, one valid and one invalid tag
Since I wanted anyone to be able to download the code to their Arduino, without programming skill, and run this program it was important that there be a system for setting the Master tag. Currently this is done by starting with a blank slate, adding the program, scanning the Master tag then resetting the Arduino. From that point on that tag will be recognized as the Master and can be used to teach new tags. Up to 8 valid tags can be programmed. The last problem to overcome is getting the system to stop recording duplicate tags. Currently, when the Master tag is scanned the system goes into learning mode and will just keep memorizing anything which gets scanned until the system is reset. This is filling up the memory fast with lots of unnecessary data. Once this problem is fixed the project will be completed.
Serial data from the Arduino showing problematic duplicate tags
The rest of the weekly summaries have been arranged by date.
Disclaimer for http://24hourengineer.blogspot.com/
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All information in this blog, or linked by this blog, are not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property or similar, is the responsibility of those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.
Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
Comments
Post a Comment