Pages: [1]   Go Down
Author Topic: Sunion RFID RFM-003 with Arduino  (Read 698 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All, I'm new to the Forum and also VERY new to Arduino.

I've been doing Software Programming for ages, and recently discovered Arduino.
I've worked through 90% of the examples and get most of them to work as expected.
I need some help Please on the following please
I have a bunch of these RFID Module lying around:
Sunion RFM-003 Modules/with Antennas and  with about thousand+ tags
So I need to get it going for some project I think of for the past year :-)
Here is the Datasheet for the RFID module.
http://www.futurel.bg/datasheets/3/RFM003.pdf
I have the Gnd, 5V Figures out (Pretty simple he)
But the SCLK and DATA I have no idea what to do or even where to start
I've tried some of the RFID examples found on the web, but no luck.

If anyone is willing to help, they can PM met at danieATleznadsoftwareDOTcoDOTza. I'm even willing to pay if I have to

Thanks a Mil
Danie
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not much future in a page that won't load. There is a user manual here:
http://www.mantech.co.za/datasheets/products/RFM-003-SUN.pdf
Look at the shiftOut function to send data to the reader, to turn it on or off.
Look at the shiftIn function to read data from the reader.

You can use any two digital pins for the clock and data pins.
Logged

Offline Offline
God Member
*****
Karma: 4
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Given that it has SCL and SDA signals, it looks as if it might be using I2C. If that's the case, you should connect SCL and SDA to analog pins 5 and 4, tie them to +5V through a pull-up resistor of about 2.2 kOhm each, and then use the Wire library to talk to the reader: http://www.arduino.cc/playground/Learning/I2C

... nevermind. I looked on page 7, and it may be that it doesn't actually do I2C but instead a custom protocol that doesn't use address codes. Thus, you'll have to write your own library that generates the output clock signal and generates/reads the data signal, probably on two digital pins, such as D2 and D3. Use pull-down resistors (10k?) to D2 and D3, and tie those to CLOCK and DATA respectively. The reset sequence (as shown on page smiley-cool would look like:

Code:
#define CLOCK D2
#define DATA D3

//setup
pinMode(CLOCK, OUTPUT);
pinMode(DATA, OUTPUT);
digitalWrite(CLOCK, 0);
digitalWrite(DATA, 0);
delayMicros(2);

// reset
digitalWrite(CLOCK, 1);
delayMicros(1);
digitalWrite(DATA, 1);
delayMicros(2);
digitalWrite(CLOCK, 0);
delayMicros(1);
digitalWrite(DATA, 0);

Note that the timing is specified in nanoseconds, so you'll be running the device slower than specified, because the Arduino really only makes sense at microsecond intervals. (There are 1000 nanoseconds in one microsecond).

You should be able to drive the output for sending the commands suggested in the data sheet, and turn around the pin mode for reading inputs (hopefully the timing will allow this!)
Logged

Offline Offline
God Member
*****
Karma: 4
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I read more in that data sheet, and you may be up against a bit more than you signed up for...
Specifically, the data code looks to be self-clocked, with a fixed pulse width. You need to detect the pulse width yourself, and then clock the input according to that pulse width. The range is 250-320 microseconds per pulse, using some form of phase shift keying for 0 vs 1 data.
Interestingly they call this "Manchester code data," but last I learned, "Manchester" data is 1-high, 0-low. Also, given that the pulse width is in microseconds, I wonder if the reset/clock timings they specify in nanoseconds really should be in microseconds.

You probably want a 100 MHz oscilloscope with at least two channels, and/or a logic analyzer with similar performance, to figure this guy out.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Have this so far, But NO Luck at all
Use "e" to send from Keyboard to actually start scanning
Use "r" to reset"

*************

int InoutPin=3;
int SclkPin=2;
int valreceive=0;
int incomingByte = 0;

void  setup(){

  Serial.begin(9600);
 
}

void loop(){
 
  if (Serial.available() > 0) {
      incomingByte = Serial.read();
      if (incomingByte == 114 || incomingByte == 82) {
          Serial.println(" >> Reset RFID");
          ResetRFID();
      }

      if (incomingByte == 101 || incomingByte == 69) {
          Serial.println(" >> EnteringRFIDdata");
          EnteringRFIDdata();
      }
 
      if (incomingByte == 115 || incomingByte == 83) {
          Serial.println(" >> Prepare Scanning");
          ResetRFID();
          ResetRFID();
          ResetRFID();
          //EnteringRFIDdata();
          delay50ns();
          Serial.println("Reading RFID");
          pinMode(InoutPin,INPUT);
          for (int x=1; x <= 3; x++){
          valreceive=digitalRead(InoutPin);
          Serial.print(valreceive);
          }
      }
        delay200ns();
          pinMode(InoutPin,OUTPUT);
        delay200ns();
          digitalWrite(InoutPin,'01001000');       
        Serial.println("Done Reading Header");
        delay200ns();
          pinMode(InoutPin,INPUT);

          for (int x=1; x <= 8; x++){
          valreceive=digitalRead(InoutPin);
          Serial.print(valreceive);
//        Serial.println(incomingByte);
          }
          delay(500);
        Serial.println("Done Reading RFID");

  }

 
 
}

void delay200ns(){
 delayMicroseconds(200);
 //delay(1000);
}

void delay50ns(){
 delayMicroseconds(50);
 //delay(500);
}

void ResetRFID(){
 
  pinMode(SclkPin,OUTPUT);
  pinMode(InoutPin,OUTPUT);
  digitalWrite(SclkPin,HIGH);
   delay50ns();
  digitalWrite(InoutPin,HIGH);
   delay200ns();
  digitalWrite(SclkPin,LOW);
   delay50ns();
  digitalWrite(InoutPin,LOW);
   delay200ns();
}

void EnteringRFIDdata(){
  pinMode(SclkPin,OUTPUT);
  pinMode(InoutPin,OUTPUT);
  digitalWrite(InoutPin,HIGH);
   delay50ns();
  digitalWrite(SclkPin,HIGH);
   delay200ns();
  digitalWrite(SclkPin,LOW);
   delay50ns();
  digitalWrite(InoutPin,LOW);
   delay200ns();
 
}
************
Thanks for the help so-far!
Cheers
Danie
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
if (incomingByte == 114 || incomingByte == 82) {
What is sending serial data to the Arduino? Wouldn't
Code:
if (incomingByte == 'r' || incomingByte == 'R') {
make more sense?

Code:
        delay200ns();
          pinMode(InoutPin,OUTPUT);
        delay200ns();
          digitalWrite(InoutPin,'01001000');       
You can write HIGH or LOW to a digital pin. Writing '01001000' makes no sense whatsoever.

Go back and read reply #1 to figure out how to send the device data.

Quote
          for (int x=1; x <= 8; x++){
          valreceive=digitalRead(InoutPin);
          Serial.print(valreceive);
//        Serial.println(incomingByte);
          }
This is NOT how to read from the device. Go back and read reply #1 to figure out how to read the device data.
Logged

Offline Offline
God Member
*****
Karma: 4
Posts: 813
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Have this so far, But NO Luck at all

Code:
          Serial.println(" >> Prepare Scanning");
          ResetRFID();
          ResetRFID();
          ResetRFID();
          //EnteringRFIDdata();
          delay50ns();

A few things.

1) Serial.println() is very slow -- it will significantly impact your timing. I highly recommend toggling a digital out pin with a LED or something if you want to know that the code gets to a particular point. Or use an oscilloscope or logic analyzer.

2) If ResetRFID() works, it should work the first time. Trying it three times is voodoo programming, and is actually hurtful, not helpful.

3) There is no such thing as a "delay50ns()" function call on the Ardiuno. At 16 MHz, there are 62.5 nanoseconds per clock, so a simple NOP instruction delays more than 50 nanoseconds (and this doesn't take the call and return instructions into account).

Logged

Pages: [1]   Go Up
Jump to: