Ok, a bit of a progress report.
I have managed to get the RFID reader part working, like I said in the previous post. Almost working. There are still some kinks which I need to iron out, more about them at the end of the post. For now, here’s what my setup looks like:
The image is cool right? I made it in Fritzing – a really nifty utility for drawing your prototype circuits and much more. Get it here : Fritzing.org
And the code’s here: rfidcode.
I will explain the above image a bit first.
I am sure you recognize the cool-blue Arduino Uno on the right. The little black rectangle marked ‘RFID’ on the left is the RFID reader. It actually has many more pins, but I couldn’t find the equivalent part in Fritzing. The one I have looks like this:
- All the black wires go to ground.
- The orange wire sends data from the RFID reader to the Arduino.
- The red lines are the power lines.
There are a couple of LEDs and resistors in there too.
The way the sketch works is:
- When I wave a card over the antenna, the RFID reader sends the data through the TX line to the Arduino’s RX pin.
- The Arduino stores the data in an array, compares it with the stored card values and lights up the relevant LED. Its pretty simple actually.
The part that needed work was the comparison with the stored cards. You can see it in the compare_card and give_output functions.
But fun 🙂
The issues I am having is of multiple reads. If I wave a card across the antenna, Arduino stores the incoming data in the serial buffer. In the code, if data is available at the serial buffer, Arduino processes it. This is good. But then it does the same thing more than once. So if wave a card once, the LED lights up three times, with three “Hi Harshad!”s printed on the serial port. That’s not what we want. It also messes up the stored card values in the array. Still haven’t figured out why its doing that, really.