Electronics > Electronics

RFID reader ID-20 and Axon II?

(1/2) > >>

Hello all,
Im working on a automatic door lock and need a RFID reader.  I've been looking at this one
and wondering how hard it would be to use it with the axon II?  It only needs to read a card and turn on a relay; any ideas or thoughts?


Assuming you know how to speak serial (UART / TTL) on the Axon II, it should be easy.
You'll definitely want the version with the breakout board, btw!

Connect power to power, ground to ground, and two data pins to Rx and Tx. Done.

To send commands to it, just use rprintf() at the proper baud rate to the desired UART. Done.

Reading back from it is a little harder. In a FOR loop, store the data into an array of char values:

char data[whatever];

for loop:

Okay sorry for the delay but Ive finally got all my problems down to just reading in the bytes.  So what I want it to do right now is store the tag number and then display it on my 20x4 lcd screen. Here is my code im using which just prints garbage to the screen.  I think that Im not reading in the bytes correctly so the garbage is the random data from the blank array.
Any ideas?
Thanks in advance

update: also, ive hooked up TX from the ID-20 to my oscilloscope and it is outputing serial data when a card is read

--- Code: ---#include "hardware.h"

// Initialise the hardware
void appInitHardware(void) {

// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
// -------- Start Sparkfun serLCD-------
//turn on LCD

rprintfInit( displayGetWriter(&LCD));
// -------- End   Sparkfun serLCD-------
return 0;
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {
//////////Main Loop/////////////////////////////////////////

char tagString[13];
int index=0;
boolean reading = false;

//read from rfid
while(uartGetByte(ID20)!=-1){//do while data recieved non -1 data
int readByte=uartGetByte(ID20);//Assign byte read to a temp int

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 ++;

//display data
for (int i=0;i<12;i++){//display data along collumns
displayGoto(&LCD,i,0);//display position

//clear screen
return 0;

--- End code ---

You are reading in the bytes as 'int' but storing/printing them out as 'char'.

int readByte

char readByte

and instead of:
(readByte == 2)

(readByte == '2')

etc. etc.

or . . . you can just do this casting and it might just work with no other changes:
tagString[index] = (char)readByte;


[0] Message Index

[#] Next page

Go to full version