Go Down

Topic: rfid problem (Read 448 times) previous topic - next topic

viperzzz

i just received  a rfid reader with some tags, but i have a communication problem with arduino.. i load the code below but in the serial monitor i can t see anything when i scan a tag.
rfid reader seems work correctly, when i scan a tag, the on the reader is on, but in serial monitor nothing appened

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //pin2 Rx, pin3 Tx
void setup(){
Serial.begin(9600);
Serial.println("Seriale:\n");
mySerial.begin(9600);
mySerial.write(0x02); 
}
void loop() // run over and over
{
if (mySerial.available())
Serial.println(mySerial.read(),HEX); 
if (Serial.available())
mySerial.write(Serial.read());
}

Grumpy_Mike

Quote
i just received  a rfid reader with some tags,

Link?
Without further information it is hard to say what is going wrong.

Has the RFID reader got an RS232 output? If so are you converting it to TTL voltages before sending it into the arduino.
Have you got the TX & RX the right way round, depending on how the reader is designated you could have to connect TX to TX or TX to RX.

The code is a bit wrong as it will print every character on a new line but you should see something.

viperzzz

This is the rfid reader

http://www.emartee.com/product/42125/13.56MHZ%20New%20RFID%20Reader/Writer%20Module


viperzzz

i just checked rx and tx with a multimeter, and they have both 4.8v

Grumpy_Mike

Code: [Select]
Serial.println(mySerial.read(),HEX); 
Should be
Code: [Select]
Serial.print(mySerial.read(),HEX); 
But as I said you should see something. You appere to be doing everything right, is the ground of the reader connected to the ground of the arduino?
Check that the wires are actually making contact.
If all theat files you need a scope to check the signals.

viperzzz

LATEST NEWS:

i tried with my arduino uno and all works perfectly

But if i try to connect it to my arduino mega, still no read the id
I tried to connect rx and tx in PWM, COMMUNICATION and DIGITAL, but nothing works  :smiley-eek:

dxw00d

Don't use SoftwareSerial with a Mega. Use one of the other hardware serial ports.

viperzzz

Mhh.. So i have to set e.g. pinMode(30,OUTPUT) and pinMode(31,INPUT)?

viperzzz

I'M STUPID

I forgot this:  :smiley-zipper:
Quote
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


Now all works fine, thread can be closed, sorry  XD

Go Up