- Forum
- RIO I/O Expansion Card and Navigation Computer
- I/O Connection and Processing
- RS232 Connection between RIOX and Arduino
RS232 Connection between RIOX and Arduino
3 years 1 week ago #29535186
by Chris_ENG
RS232 Connection between RIOX and Arduino was created by Chris_ENG
I am trying to communicate between an Arduino Mega and the RIOX using TX RX communication.
I read that since Arduino uses TTL rather than true RS232, I needed a converter, so I purchased this one. www.amazon.com/gp/product/B07BJJ3TZR/ref...00_s00?ie=UTF8&psc=1
After checking that my code would send information via TX and RX with another Arduino, I tried to communicate with the RIOX.
The serial for both the Arduino and the RIOX were set to 115200. I tried wiring it with and without the converter. I also tested between two Arduinos again to make sure the pins weren't damaged from me trying to communicate without the converter. The Arduinos worked fine, but I still wasn't able to communicate anything to the RIOX.
The information being sent to the RIOX is in decimal format (so A=65, B=66, etc.).
For my test code, I tried setting Variable 10 to 20 by sending "!VAR 10 20" (sans quotes) at once and by sending each character of that individually in order. I tried to test it with the RIOX hooked up via USB, and then by a 24V power supply without the USB connection. Still, I wasn't able to get the RIOX and Arduino to communicate.
For testing purposes, I'd like to know if I can communicate with the RIOX over RS232 Serial while the RIOX is connected to a PC via USB, or can it not use TX RX and the USB connection at the same time (USB going to my PC to monitor/power the RIOX and the RS232 to the RIOX)?
Also, if anyone has gotten an Arduino and RIOX to communicate, I would very much appreciate some sample code/advice.
If any more information is needed, I'll happily provide it. Sorry if I miss something obvious, I am very new to communicating with RX and TX.
I read that since Arduino uses TTL rather than true RS232, I needed a converter, so I purchased this one. www.amazon.com/gp/product/B07BJJ3TZR/ref...00_s00?ie=UTF8&psc=1
After checking that my code would send information via TX and RX with another Arduino, I tried to communicate with the RIOX.
The serial for both the Arduino and the RIOX were set to 115200. I tried wiring it with and without the converter. I also tested between two Arduinos again to make sure the pins weren't damaged from me trying to communicate without the converter. The Arduinos worked fine, but I still wasn't able to communicate anything to the RIOX.
The information being sent to the RIOX is in decimal format (so A=65, B=66, etc.).
For my test code, I tried setting Variable 10 to 20 by sending "!VAR 10 20" (sans quotes) at once and by sending each character of that individually in order. I tried to test it with the RIOX hooked up via USB, and then by a 24V power supply without the USB connection. Still, I wasn't able to get the RIOX and Arduino to communicate.
For testing purposes, I'd like to know if I can communicate with the RIOX over RS232 Serial while the RIOX is connected to a PC via USB, or can it not use TX RX and the USB connection at the same time (USB going to my PC to monitor/power the RIOX and the RS232 to the RIOX)?
Also, if anyone has gotten an Arduino and RIOX to communicate, I would very much appreciate some sample code/advice.
If any more information is needed, I'll happily provide it. Sorry if I miss something obvious, I am very new to communicating with RX and TX.
Please Log in or Create an account to join the conversation.
3 years 1 week ago #29535190
by Chris_ENG
Replied by Chris_ENG on topic RS232 Connection between RIOX and Arduino
Okay, so I've done some work on this and now I just need to know two things:
1. Can the RIOX receive RS232 commands while it's connected to my laptop via USB (its also powered by the USB?
2. For anyone who knows about Arduino, I have tried the following two scripts in Arduino to set Variable 10 equal to 20 over serial. Is there a reason why the serial information I'm sending over might not be accepted? Both the Arduino and the RIOX serial are set to 115200
Code 1
void setup() {
Serial.begin(115200);
}
void loop() {
delay(1000);
Serial.print("!VAR"); // Motor GO command
Serial.print(" "); // Space
Serial.print("10"); // Channel Number
Serial.print(" "); // Space
Serial.println("20"); // Motor Power Value
delay(100);
}
Code 2
void setup() {
Serial.begin(115200);
}
void loop() {
delay(1000);
Serial.println("!VAR 10 20");
delay(100);
}
1. Can the RIOX receive RS232 commands while it's connected to my laptop via USB (its also powered by the USB?
2. For anyone who knows about Arduino, I have tried the following two scripts in Arduino to set Variable 10 equal to 20 over serial. Is there a reason why the serial information I'm sending over might not be accepted? Both the Arduino and the RIOX serial are set to 115200
Code 1
void setup() {
Serial.begin(115200);
}
void loop() {
delay(1000);
Serial.print("!VAR"); // Motor GO command
Serial.print(" "); // Space
Serial.print("10"); // Channel Number
Serial.print(" "); // Space
Serial.println("20"); // Motor Power Value
delay(100);
}
Code 2
void setup() {
Serial.begin(115200);
}
void loop() {
delay(1000);
Serial.println("!VAR 10 20");
delay(100);
}
Please Log in or Create an account to join the conversation.
- Forum
- RIO I/O Expansion Card and Navigation Computer
- I/O Connection and Processing
- RS232 Connection between RIOX and Arduino
Time to create page: 0.050 seconds