Hello, i'm new in Arduino programming.
I want to ask about my project, so i have a long range RFID Reader (Long Range Integrated RFID Reader / Writer - CT-I802) that have 2 output a TCP/IP and a RS232. It works very fine on RS232 direct connect to a pc and a software that come with the product. So i can read the tag data on the software that the seller provided.
The problem is i can't recieve the tag data from the RFID Reader to my Genuino Mega 2560. I'm using a RS232 to TTL.
from TTL output i connect :
VCC to 5V Genuino
RXD to Pin 10
TXD to Pin 11
GND to Ground
The code is taken from example of the library.
After i uncommenting the Test on serial monitor still doesn't showing anything.
I'm using 9600 baud rate as the software from the manufacturer give using a 9600 baud rate.
The RFID reader is buzzing when a tag is present, but no data recieved on arduino.
It will (probably) not solve the problem, but why do you use software serial on a board that has additional hardware serial ports. Rather use Serial1 or so; usage the same as normal serial port.
If you have a serial port available on the PC (either physical or a USB-to-RS232), you can use that to test communications between the Arduino and the PC.
e.g. the below should echo what is received on Serial1 to Serial (the standard Arduino USB).
You need two terminal programs running. If you know how to do it you can use two instances of serial monitor; else you can use e.g. serial monitor for one and RealTerm / Putty / minicom / ... for the other one.
quivers:
Okay, so now i'm using TX1 and RX1 on Arduino Mega.
So now from the RS232 to TTL converter RX going to TX1 and the TX going to RX1 is it right?
...
...
I already put the tag on my reader and it buzz, but still nothing on the serial monitor from the arduino IDE.
Don't use the reader; connect both serial ports of the mega as I described. Get a simple echo from one port to another port working first.
Once that works, you can start using the reader. What do the specs say about baudrate, parity, databits and stop bits?
Robin2:
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.
If the basic communication is not working, it's not going to help (in my opinion).
sterretje:
Don't use the reader; connect both serial ports of the mega as I described. Get a simple echo from one port to another port working first.
Once that works, you can start using the reader. What do the specs say about baudrate, parity, databits and stop bits?
If the basic communication is not working, it's not going to help (in my opinion).
Okay so i tried this way
From my laptop to arduino using a usb port then from the arduino to my pc using tx1 and rx1 going through RS232 to TTL converter.
I'm opening from the HTerm on my PC but it receiving a gibberish word, all the same words.
Is it possible that my converter broken?
Or the cable on wrong position?
If I have a program that I know works reliably then I can concentrate on other issues.
...R
It seems the problem is on the wire , i change my wire so i can recieve from the Arduino IDE Serial Monitor to HTerm. but i can't receive from the HTerm to Serial monitor.
quivers:
<...>
From my laptop to arduino using a usb port then from the arduino to my pc using tx1 and rx1 going through RS232 to TTL converter.
I'm opening from the HTerm on my PC but it receiving a gibberish word, all the same words.
Is it possible that my converter broken?
Or the cable on wrong position?
I can't provide specific link to my reader because it's i only found it on my country, but here it is anyways. P.S. I can't find the datasheet and the seller only give me the demo software
And for update, already can send data from Arduino Serial Monitor to HTerm succesfully, but when i send from HTerm it become a gibberish word printing without ending.
quivers:
And for update, already can send data from Arduino Serial Monitor to HTerm succesfully, but when i send from HTerm it become a gibberish word printing without ending.
Please show the code that achieves the above.
Check and double check the wiring with the TTL-to-RS232 converter. Do you have a link for it?
sterretje:
Please show the code that achieves the above.
Check and double check the wiring with the TTL-to-RS232 converter. Do you have a link for it?
Update, already can do sending and receiving through any serial port.
But now i'm confused because i can read the RFID tag data using a USB to RS232 and connect it direct to PC and read it on HTerm but not on the Arduino.
Is there any syntax i should do before i can read the data from the RFID Reader?
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial2.begin(9600);
Serial.println("Arduino Ready");
}
void loop() {
// read from port 1, send to port 0:
if (Serial2.available()) {
int inByte = Serial2.read();
Serial.println();
Serial.print(Serial2.read());
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
Serial2.write(inByte);
}
}
sterretje:
Your comment states 'read from port 1' but your reading port 2. Incorrectly wired?
Ah i forgot to change the comment, It's work perfectly fine if i sending from the Serial to Serial2 and Serial2 to Serial. But when i plug the RS232 to TTL converter into the RFID Reader RS232 Output, the Serial Monitor did not receive anything.
The comment on the codes i forgot to change it because i was trying the other Serial port that arduino mega provided so here's the code i use ATM.
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial2.begin(9600);
Serial.println("Arduino Ready");
}
void loop() {
// read from port 2, send to port 0:
if (Serial2.available()) {
int inByte = Serial2.read();
Serial.println();
Serial.print(Serial2.read());
}
// read from port 0, send to port 2:
if (Serial.available()) {
int inByte = Serial.read();
Serial2.write(inByte);
}
}
An oscilloscope would be helpful to determine what's going on. Without that, it might be helpful to put an LED and 1k Ohm resistor between the TTL lines and ground so that you have a visual indication of line states during your testing.
MrMark:
An oscilloscope would be helpful to determine what's going on. Without that, it might be helpful to put an LED and 1k Ohm resistor between the TTL lines and ground so that you have a visual indication of line states during your testing.
Umm I don't know what you mean by put an LED and 1k Resistor between the TTL Lines, because it is a module and looks a lot like this one :
Another Update, i just recognize that from the RS232 to TTL Converter into the Arduino Mega wire seems funny
VCC > 5V
RXD > RX1
TXD > TX1
GND > GND
It won't work if i try :
VCC > 5V
RXD > TX1
TXD > RX1
GND > GND
on this code
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial2.begin(9600);
Serial.println("Arduino Ready");
}
void loop() {
// read from port 2, send to port 0:
if (Serial2.available()) {
int inByte = Serial2.read();
Serial.println();
Serial.print(Serial2.read());
}
// read from port 0, send to port 2:
if (Serial.available()) {
int inByte = Serial.read();
Serial2.write(inByte);
}
}
Not that i actually now can communicate with the RFID Reader, it just work for the Serial Monitor to HTerm on the PC