Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: rfid problem  (Read 437 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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());
}
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 35023
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the rfid reader

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

Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 35023
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Serial.println(mySerial.read(),HEX); 
Should be
Code:
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.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Jr. Member
**
Karma: 1
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-lol
Logged

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: