Shop OBEX P1 Docs P2 Docs Learn Events
RFID and Javelin Stamp — Parallax Forums

RFID and Javelin Stamp

Zachary LewisZachary Lewis Posts: 6
edited 2008-01-30 00:39 in General Discussion
I have the Parallax RFID reader and the Javelin Stamp board, and I was just looking for a simple tutorial or description of how to get the two communicating. I've not done any serial communication or anything like that, so I'm kinda' in the dark here. Any help would be fantastic. [noparse]:)[/noparse]

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-01-24 00:20
    According to the manual
    http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/RFID-Reader-v1.2.pdf

    communication is TTL level serial 2400baud non-inverted.
    So you need to connect the module's SOUT pin to a Javelin I/O pin
    and declare a receive Uart on that pin.

    import stamp.core.*;

    public class rfid_test {

    · static Uart rx = new Uart(Uart.dirReceive,CPU.pin0,Uart.dontInvert,Uart.speed2400,Uart.stop1);

    · static void main() {
    ··· int c = 0;
    ··· while (true) {
    ····· while (c != 0x0A) c = rx.receiveByte(); //wait for arrival of 0x0A (start byte)
    ······for (int i=0; i<10; i++) { //receive 10 digits
    ······· c = rx.receiveByte(); //receive a digit
    ······· //do something with the digit
    ····· }
    ····· c = rx.receiveByte(); //receive 0x0D (stop byte)
    ··· }
    · }

    }


    regards peter
  • Zachary LewisZachary Lewis Posts: 6
    edited 2008-01-24 17:01
    Simply stellar. I saw the BASIC Stamp code in there, but I had no idea how to transpose it to a Java equivalent.

    Okay, I've been working with this code, and it never started reading. So I got to tinkering.

    import stamp.core.*;
    
    public class rfid_test2 {
    
      static Uart rx = new Uart(Uart.dirReceive,CPU.pin13,Uart.dontInvert,Uart.speed2400,Uart.stop1);
      static int enable = CPU.pin15;
    
      static void main() {
        CPU.writePin(enable, false);
        int c = 0, id = 0;
    
        System.out.println("Clearing input buffer");
        while(rx.byteAvailable())
        {
          System.out.print("" + rx.receiveByte() + "\n");
        }
    
        while (true) {
          //System.out.print("Enabling RFID.");
          CPU.writePin(enable, false);
          while (!rx.byteAvailable()) {
            //c = rx.receiveByte(); //wait for arrival of 0x0A (start byte)
            System.out.print("No tag detected. Trying again in 3 seconds.\n");
            CPU.delay(30000);
          }
          while(rx.byteAvailable())
          {
            System.out.print("" + rx.receiveByte() + "\n");
          }
    
    
          //c = rx.receiveByte(); //receive 0x0D (stop byte)
          //System.out.print("Disabling RFID.");
          CPU.writePin(enable, true);
          CPU.delay(20000);
        }
      }
    
    }
    



    My output is not at all what I'm expecting. It will print about thirteen 0s, then a negative number (-1, -2 are most common, sometimes it prints -8 or -16). I've no clue what's going on inside that RFID tag. All the bits should be identical (for this tag). Any clue of what's going wrong?

    Many thanks.

    Post Edited (zachwlewis) : 1/24/2008 6:26:49 PM GMT
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-01-24 18:49
    You cannot use
    ········System.out.print(""·+·rx.receiveByte()·+·"\n");
    because javelin java cannot mix strings and integers as pc java can.
    Try attached program, it prints received bytes as hexadecimal strings.

    regards peter
  • Zachary LewisZachary Lewis Posts: 6
    edited 2008-01-25 21:28
    That seems to be giving me proper hex values returned, but I am still dubious of their validity.

    I have several programmed World TAG RFID tags, and I ran a few tests on this RFID reader. Here's the output for a few trials of the tags.

    Tag 1
    T1: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
    T2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FC
    T3: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
    T4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
    T5: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FC
    T6: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FE
    



    Tag 4
    T1: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FC
    T2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E0
    T3: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FD
    T4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E0
    T5: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
    T6: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 88
    



    Tag 7
    T1: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FE
    T2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FB
    T3: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FA
    T4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF
    T5: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F8
    T6: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FE
    



    The first thing I noticed was there were actually 15 output words instead of the 10 that were supposed to appear. Secondly, every one was 00, save the final word. Finally, the final word would vary when doing multiple trials of the same tag.

    The tags and tag reader have been tested on a different platform and have returned proper results, so I don't think there is a tag or hardware problem. Am I doing something wrong software side? I really appreciate your help so far.

    Post Edited (zachwlewis) : 1/25/2008 9:34:46 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-25 23:15
    Hello,

    When you say ‘programmed tags’, what do you mean? The tags we carry are not programmable. Each has a unique value assigned to it. Are these the tags you’re using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Zachary LewisZachary Lewis Posts: 6
    edited 2008-01-28 19:34
    The tags were given to us from a contest supervisor so we could test the tags with the system we are creating. The tags should all have the same number (one tag is 1111111111, one tag is 2222222222, et cetera). They are of a similar model to the ones you sell in your store (but weren't purchased from you). The Javelin Stamp and the RFID reader, however, are your hardware.

    As I've mentioned before, we've tested the reader and tags with a separate platform (some BASIC microcontroller), and they have worked properly.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-29 15:21
    In order to be read by our RFID Reader these tags would need to be EM410x compliant @ 125 KHz and contain a 64-bit tag ID. If not they most likely won’t work. You could confirm operation of the reader by getting a known working tag, such as the ones we carry. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Zachary LewisZachary Lewis Posts: 6
    edited 2008-01-29 16:57
    But that's the thing: I've used your Parallax RFID reader with these tags on another microcontroller platform, and it's read successfully. The problem occurs when trying to read using the Javelin Stamp platform, and I can't seem to figure out how my data is getting corrupted or mis-read. Does anyone have any ideas on what might be causing this?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-01-29 17:33
    Post the program used on the other platform. Then we can see
    how it did work and adjust·the javelin program accordingly.

    regards peter
  • barichards21barichards21 Posts: 7
    edited 2008-01-30 00:39
    Well the code it has worked on is for an ooPIC-R microcontroller. Our group didn't write this code, and asking the other group for the code might be frowned upon by our professor. I guess the key point is that there is no compatability issue between the reader and the tags.
Sign In or Register to comment.