Hi all, i have recently bougth SM130 module and RFID Evaluation Shield - 13.56MHz to use it with arduino UNO.
The problem is when I pass the MIFARE tag over the antenna nothing happens... the only thing that seem to work is the power led on spakfun board.
I have tested it with sparkfun sample code:
/*
RFID Eval 13.56MHz Shield example sketch v10
Aaron Weiss, aaron at sparkfun dot com
OSHW license: http://freedomdefined.org/OSHW
works with 13.56MHz MiFare 1k tags
Based on hardware v13:
D7 -> RFID RX
D8 -> RFID TX
D9 -> XBee TX
D10 -> XBee RX
Note: RFID Reset attached to D13 (aka status LED)
Note: be sure include the NewSoftSerial lib, http://arduiniana.org/libraries/newsoftserial/
Usage: Sketch prints 'Start' and waits for a tag. When a tag is in range, the shield reads the tag,
blinks the 'Found' LED and prints the serial number of the tag to the serial port
and the XBee port.
*/
#include <SoftwareSerial.h>
SoftwareSerial rfid(7, 8);
//Prototypes
void check_for_notag(void);
void halt(void);
void parse(void);
void print_serial(void);
void read_serial(void);
void seek(void);
void set_flag(void);
//Global var
int flag = 0;
int Str1[11];
//INIT
void setup()
{
Serial.begin(9600);
Serial.println("Start");
// set the data rate for the NewSoftSerial ports
rfid.begin(19200);
delay(10);
halt();
}
//MAIN
void loop()
{
read_serial();
}
void check_for_notag()
{
seek();
delay(10);
parse();
set_flag();
if(flag = 1){
seek();
delay(10);
parse();
}
}
void halt()
{
//Halt tag
rfid.print(255, BYTE);
rfid.print(0, BYTE);
rfid.print(1, BYTE);
rfid.print(147, BYTE);
rfid.print(148, BYTE);
}
void parse()
{
while(rfid.available()){
if(rfid.read() == 255){
for(int i=1;i<11;i++){
Str1[i]= rfid.read();
}
}
}
}
void print_serial()
{
if(flag == 1){
//print to serial port
Serial.print(Str1[8], HEX);
Serial.print(Str1[7], HEX);
Serial.print(Str1[6], HEX);
Serial.print(Str1[5], HEX);
Serial.println();
delay(100);
//check_for_notag();
}
}
void read_serial()
{
seek();
delay(10);
parse();
set_flag();
print_serial();
delay(100);
}
void seek()
{
//search for RFID tag
rfid.print(255, BYTE);
rfid.print(0, BYTE);
rfid.print(1, BYTE);
rfid.print(130, BYTE);
rfid.print(131, BYTE);
delay(10);
}
void set_flag()
{
if(Str1[2] == 6){
flag++;
}
if(Str1[2] == 2){
flag = 0;
}
}
And with this code take from http://www.electrojoystick.com/tutorial/?p=659, but program print always "Checksum is bad":
#include <SoftwareSerial.h>
//setup serial for RFID reader
#define rxPin 3
#define txPin 2
SoftwareSerial rfserial = SoftwareSerial(rxPin, txPin);
//firmware checksum reference
byte firm_chksum = 0x41;
void setup(){
//set the Serial monitor to preferred baud rate
Serial.begin(9600);
//RFID reader is defaulted to 19200 baud rate
rfserial.begin(19200);
}
void loop(){
//read the Firmware
ReadFirmware();
//delay(2000); //wait for 2 seconds
}
//function for reading the firmware
void ReadFirmware()
{
// checksum checker
byte chksum_math = 0;
//firmware command 0x81
byte ReadFirm[] = {0xFF,0x00,0x01,0x81,0x82};
//array to hold the incoming data
byte FirmResponse[12];
// start of request firmware version
Serial.println("Requesting Firmware...");
//Send the firmware command
for (int i =0; i< 5; i++){
rfserial.write(ReadFirm[i]);
}
//flushing of buffer is required
Serial.flush();
//receive data from SM130
if(rfserial.available() > 0)
{
for (int i =0; i< 12; i++){
//start taking data from rfserial buffer and put into the array
FirmResponse[i] = rfserial.read();
//write the response on screen as hex
Serial.print (FirmResponse[i], HEX);
//space between each byte
Serial.print(" ");
}
}
for (int i =1; i<11; i++)
{
//add the bytes from the response
chksum_math += FirmResponse[i];
}
//what is the checksum??
Serial.print("Checksum = ");
Serial.println(chksum_math,HEX);
//if checksum is good then say it is
if (firm_chksum == chksum_math){
Serial.println("Checksum is good");
//the ascii representation of the firmware
Serial.println("");
Serial.println("Ascii Representation");
//display ascii representation
for (int i =0; i< 12; i++){
//write the response on screen
Serial.write(FirmResponse[i]);
//space between each byte
Serial.print(" ");
}
}
else{
//else say it is not good
Serial.println("Checksum is bad");
}
Serial.println("n");
rfserial.flush();
delay(5000);
//end of function
}
How can i check if this is an hardware problem?
Solder SM130 over sparkfun eval board is very simple...so i don't think the problem is here.