It has been a while since I have worked on an electronics project. I thought now was better then ever, isn’t that always the case. To dive back into the mix I chose to do a project geared around RFID. This project offered a lot of learning opportunities and will form the foundation for any future project I might have that include an RFID reader. What I would like to present here is the current state of the project as for hardware and firmware.

The requirements for this project are pretty loose and as usual have been evolving over time. The short list is as followed:

  1. Be able to swipe an RFID card and have it compare the stored value on the card to stored values in device memory.
  2. Be able to store up to 10 users into device memory.
  3. Be able to provide a visual indication of whether or not a card matches a user stored in memory.
  4. Be stand alone, meaning does not require a computer to reprogram a user’s stored card/ID.
  5. Have some basic security measures to prevent just anyone from reprogramming the device.
  6. When a match is found, activate an output pin that will be connected to a relay in order to control stuff.

To meet these requirements the following hardware components were chosen:

  1. Arduino Uno
  2. Parallax RFID Reader #28140
  3. 16×2 Liquid Crystal Display
  4. Tactile Switches
  5. Assorted resistors
  6. Multi-turn Potentiometer
  7. Two LEDs (Green and Red)

I started off by putting together some basic hardware on a breadboard and focused on the major functional items. This was namely getting data from the reader to the Arduino Uno. Luckily Parallax provided a great code example that made this function pretty straight forward. At first I was connecting the reader to the Rx pin on the Arduino, but this would mean I had to unplug it every time I wanted to upload new code to the Uno. To overcome this issue and the limited serial interfaces of the Arduino Uno, I used the Software Serial library provided as part of the core Arduino libraries to set up a software Serial interface on two available digital pins.  It was very helpful having the reader on a different serial interface, as I could upload new code without modifying the connections and I could continue to use the normal serial interface of the Uno for trouble shooting/debugging.

With the RFID reader squared away, the next thing to tackle was reading existing users from EEPROM and comparing the resulting char array with the string provided by the RFID reader. This was pretty straight forward and did present much of a problem.

The final thing to tackle was the programming interface. To make this device stand alone, it needs to be able to be reprogrammed without uploading new firmware (so no hard coding users) or changed via say a serial interface. To accomplish this I chose to use a standard 16×2 LCD and a few buttons/switches. Effectively what I ended up with was a program button that connects to an interrupt pin (Digital Pin 3), and when pressed it will set a flag to put the device in programming mode. Once the programming mode button is pressed, the user is prompted for the master card. The master card is what ever user is programed in position one. It is possible to also to short another pin to use as a bypass in the event the master card is lost or stolen. Once a master card is read, the user is presented with a the option to scroll through (pressing the next button) until they reach the user they want to program. At that point, the enter button can be pressed to select the user being displayed. The final step in programming is to simply swipe a new card and it will be written to the memory location of the selected user. In the event a card is lost and the associated user position needs to be deleted, the idea is that the master card will be scanned into it’s place to over write the previous data. At any time during the programming event, if a user does not interact with the device it will timeout and go back to the ready to read state.

It didn’t take long to realize that the breadboard version of the project wasn’t robust enough. I decided to use a seedstudio protoshield (I had it lying around) to make a shield for the Arduino Uno. The forth button in this hardware version is to activate the bypass functionality. The final build will not include it. Another decision made at this stage of the build was to use hardware debouncing on the buttons. In the final build debouncing will be done in software.

20161103_182955

Overall all I feel pretty good about the current state of both the hardware and software, but of course there is already a list forming for improvements in the next hardware iteration. Some improve include:

  1. Add a real time clock, to allow for timestamped data logging
  2. Add an SD card for data logging
  3. Add a port expansion card to the LCD to free up some of the I/O pins
  4. Add a transistor to the LCD’s back light’s power to allow it to be turned off when not in use
  5. Consider implementing a sleep mode when the device is not in use for a while

The firmware for the current hardware version can be found on Github at the following link:

https://github.com/bradhenson/RFID_Henson