Go Down

Topic: RFID not reading? (Read 885 times) previous topic - next topic


RFID shield: https://www.sparkfun.com/products/10406
RFID tag (blank): https://www.sparkfun.com/products/10128?
Arduino Board: ATMega Lite/ATMega 328

I have all the ground pins wired the the Arduino ground pin and I have "5v" wired to pin 6 (named "D6") for turning on manually.  SoftwareSerial had a note about pins: "Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69"

I used pin 13 for TX (named "B5") and pin 12 for RX (named "B4").  Here is my code:


#include <Streaming.h>
#include <SoftwareSerial.h>

// Pin numbers.
const int RX = 12;
const int TX = 13;
const int LED_ORANGE = 7;
const int LED_BLUE = 6;
const int TAG_IN = 14;
const int SHIELD = 6;

// Timing
const int SECOND = 1000;
const int BAUD_RATE = 19200 ;

SoftwareSerial mySerial(RX, TX);

void setup(){
  pinMode(SHIELD, OUTPUT);
  Serial << "Powering RFID Reader..." << endl;
  digitalWrite(SHIELD, HIGH);
  Serial << "Initialized...";

void loop(){

void getRFIDInput(){
  int c = mySerial.read();
  if (c != -1){
    Serial << "Read character " << (char) c << endl;

 * write a message to an RFID tag.
 * @param message the message to write.
void writeToRFID(char message[]){

The problem is that the variable "c" (in method "getRFIDInput") is always -1 so I'm not reading a character.  Did I write to it correctly?  I've been following different tutorials online.  The only variations seem to be they're changing the format in which the data is; the basis, though seems to be SoftwareSerial.read() and SoftwareSerial.write().

So confuzzled.  :~


I have all the ground pins wired the the Arduino ground pin and I have "5v" wired to pin 6 (named "D6") for turning on manually.

This is a bad idea. According to the datasheet the SM130 draws a current of 180mA while reading. A GPIO pin of the ATmega is delivering 40mA at absolute maximum, so you probably damaged your D6 port.


Okay, then I assume I should wire it directly from the 5v pin on the Arduino board.  Thankfully, I didn't brick it because the red light on the RFID board still comes on when I do a digitalWrite.
In any case, the problem is still there.
I think I realized what I'm doing wrong, though.  http://forums.parallax.com/showthread.php?129430-Interface-Arduino-to-RFID-Read-Write.  On this forum I see that there are codes (e.g. 0x01) for reading and writing.  Duh.  :smiley-red:  I'll have to do more research.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131