Problem with Processing and rs232

I am attempting to control an arduino mega over 50ft of rs232 cable. I am using Processing to send the data from the computer. I have tested the program using a USB B cable and it all seems to work fine. However, I am now attempting to use the rs232 cable and it isn't working.

The setup from the arduino to the computer is this:
The mega is connected to a tll-rs232 converter through pins 15 and 14 (rx3 and tx3) Converter
The tll-rs232 converter will connect to an rs232 cable, but for the moment I have it connected to the usb-serial converter that plugs into the computer. USB-Serial adapter

Through troubleshooting I have confirmed that the Arduino is sending signals and the Processing sketch recognizes the usb-serial converter. I can't figure out why the signal isn't reaching the computer.

I am at a loss and would welcome any help. Thanks!

Arduino Code

void setup(){
Serial3.begin(9600);
}
void loop(){
 Serial3.println("HI");
delay(1000); 
}

Processing Sketch

import processing.serial.*;

Serial myPort;

void setup() {
  frameRate(20);
  size(600, 400);
  println(Serial.list());
  String portName = Serial.list()[9];
   myPort = new Serial(this, portName, 9600);
}

void draw() {
  background(255); 
}

void serialEvent( Serial myPort) {
  String val = myPort.readStringUntil('\n');
  if (val != null) {
    val = trim(val);
    println(val);
  }
}

Two thoughts: First you may have not connected TX data on the Arduino to RX data on the computer port. second, you may not have connected ground on the Arduino to ground on the computer, using the data cable.

Paul

How would I make sure the connections are right? The usb cable is a usb so it only has one way to connect, and the tll converter can only connect one way to the serial cable. As for the circuit board holes on the tll converter, I have confirmed that vcc is connected to 5v, gnd is to ground, and the rx/tx pins are connected properly to the arduino. The converter does have a cts and rts circuit board holes, but I don't believe those are necessary.

Nickdur:
How would I make sure the connections are right? The usb cable is a usb so it only has one way to connect, and the tll converter can only connect one way to the serial cable. As for the circuit board holes on the tll converter, I have confirmed that vcc is connected to 5v, gnd is to ground, and the rx/tx pins are connected properly to the arduino. The converter does have a cts and rts circuit board holes, but I don't believe those are necessary.

Ok, next step. How did you determine the computer did not get the signal? Do you have a program running on the computer that will show you received data?

It's been many years since I worked with RS-232. Perhaps the computer port needs to be told there is something connected by connecting the DTR and MR pins together. Again, did you swap the wires so the Arduino TX data is going to the computer RX data pin?

Paul

Your links show both devices have a male DE-9 connector. (Also called a DB9.) The TX pin on both of those is pin 3. If your cable connects both pin 3 together, then both devices are trying to talk into the other one's mouth. It must talk into the ear (pin 2.)

A "null modem" cable swaps pin 2 and 3. It has female plugs on both ends. This is the kind of cable you need. You may have a "gender changer" which doesn't swap the pins.

Paul_KD7HB:
Ok, next step. How did you determine the computer did not get the signal? Do you have a program running on the computer that will show you received data?

It's been many years since I worked with RS-232. Perhaps the computer port needs to be told there is something connected by connecting the DTR and MR pins together. Again, did you swap the wires so the Arduino TX data is going to the computer RX data pin?

Paul

I'm not completely sure I have it properly set up, but the Processing sketch should be reading any data from the port. In the setup loop of the Processing sketch when I print the available serial ports it lists /dev/tty.usbserial as the 10th item, so it connects in the next line to the port with an index of 9. (This method worked fine with the usb b cable).

The reason I don't believe the computer is receiving data is because the Serial Event loop never prints anything. Is there another way to detect incoming information?

As for the rx/tx pins I have tried multiple times connecting both ways, and have received nothing.

MorganS:
Your links show both devices have a male DE-9 connector. (Also called a DB9.) The TX pin on both of those is pin 3. If your cable connects both pin 3 together, then both devices are trying to talk into the other one's mouth. It must talk into the ear (pin 2.)

A "null modem" cable swaps pin 2 and 3. It has female plugs on both ends. This is the kind of cable you need. You may have a "gender changer" which doesn't swap the pins.

The female connecter I am using is the Gigaware Female-to-Female DB9 Serial Coupler. I can't find any documentation on how the pins are connected, so that might be the issue. However, wouldn't this be solved by switching the connections to the arduino? I have tried multiple times to connect to different pins.

Nickdur:
The female connecter I am using is the Gigaware Female-to-Female DB9 Serial Coupler. I can't find any documentation on how the pins are connected, so that might be the issue. However, wouldn't this be solved by switching the connections to the arduino? I have tried multiple times to connect to different pins.

Well there's your problem. Switching the pins on the Arduino side means you're listening to an input and you have two outputs engaged in a tug-of-war. You may even have damaged something, although that is unlikely. The 2-3 "null modem" swap must take place between the two male DE9 connectors.

Nickdur:
The reason I don't believe the computer is receiving data is because the Serial Event loop never prints anything. Is there another way to detect incoming information?

As for the rx/tx pins I have tried multiple times connecting both ways, and have received nothing.

Your posts indicate you have no test equipment at all. You would have been so far ahead if you had even a digital VOM.

Do you have a breadboard so you can plug in wires and components? Do you have two good LEDs, any color will do. And finally, do you have a leaded resistor of 1000 to 1500 ohms? If so , we can mage a RS232 testor that will visually show what is happening on any of your RS232 pins. It will visually show if you are sending/receiving data by blinking the LEDs.

If you don't have the breadboard, but have the LEDs and a resistor, we can still work by twisting the leads together.

Paul

So problem was that I had a strait adapter and needed a null modem one. I purchased one and the communication now works perfectly. Thank you for the help.

Nickdur:
So problem was that I had a strait adapter and needed a null modem one. I purchased one and the communication now works perfectly. Thank you for the help.

Glad to see you have some success! RS-232 can be a real pain in the butt!

Paul