I have a serial to TTL adapter (MAX3232) but have some issue with it over longer distances. The following works:
Connect my Arduino with MAX3232 over a short 6' cable.
Send some letters/numbers over an approx. 25' cable with pin 2 & 3 connected to each other (letters/numbers come back. Without the jumper cable they don't come back.)
However, when I connect my Arduino with MAX3232 on the other side of the long 25' cable I don't get any response. Actually, sometimes I get some random letters/numbers back (the Arduino board is supposed to send commands back for confirmation).
Do you have any suggestion how to overcome this limitation.
RS-232 is designed to use up to +-25 volts to avoid the problem you see. The MAX323 with proper capacitors will produce about +- 8 volts. The capacitance of your cable is degrading the signal.
Use a much lower baud rate. Use a low capacity cable designed for data. Use an adapter that will provide a much greater voltage, possible +-12 volts.
I second Paul’s comment. I’ve used RS232 up to 75’ with +/- 12V levels. As Paul mentioned , tge Max232 doesn’t provide that level of noise immunity.
Robert
Send some letters/numbers over an approx. 25' cable with pin 2 & 3 connected to each other (letters/numbers come back. Without the jumper cable they don't come back.)
Not sure what you mean "without jumper cable".
What is on the other end receiving the data?
Does it work when connected with a shorter cable?
I assume you have DB9 connectors and mean:
the Max 232 Pin 2 is connected to pin 3 of the receiver
the Max 232 Pin 3 is connected to pin 2 of the receiver
the Max 232 Pin 7 is connected to pin 7 on the receiver.
Pins 2 & 3 “jumpered at receiving end is (and always has been) known as a ‘loop-back’ test since transmit and receive are tied together.
This is RS232-101.
Meh. If you jumpered 2&3 at the far end of the 25ft cable and got correct echoing, then an actual receiver at the far end of the cable should work fine as well. Something else is wrong... (rs232, even at +/-8V, is pretty robust.)
You do have a ground connection too, right? I've seen rs232 connections succeed in spite of bad cables and mis-connections due to common "earth" grounds, but then mysteriously fail when different equipment without the shared earth ground is used...
There IS still the possibility the the OP has commited tge cardinal sin of RS232 coonections:
Rx-> Rx
Tx-> Tx.
If so, he would not be the first to do so.
(it’s possible I did that once , but that was 40 years ago and I don’t remember.)
Robert
Indeed, however, you were the one asking the question, for what it’s worth.
The jury is still out on the Tx-> Tx question.
The other sin is the one already mentioned about the GND connection .
Thanks everybody for the response. For some reason I don't get notifications (it's not in the spam folder, either) although I have signed up to be notified immediately. In any case, here is some more info:
I have the following connections: pin 2 -> pin 3, pin 3 -> pin 2, pin 5 -> pin 5
The cable I have is a shielded cable. On the PC side I connected the bare cable (which is in contact with the shield) to the metal casing (the metal that goes outside around the 9 pins). On the Arduino side that same metal cable is not grounded.
I am running at 9600 baud so pretty low speed. As mentioned before, it works with a shorter 6' cable but not with the 25' cable so I assume I wired things correctly on the Arduino side as really only the cable changes.
A couple people mentioned that the Max232 only provides about 8V. What other solutions are you using to get 12V? Also based on the above information did I wire something incorrectly?
Ok, I lowered it to 300 but still no luck. It might be some noise issue because I get characters back before any should be sent back to the PC (the Arduino waits for several characters before sending a confirmation back). Any more suggestion? Also how can I boost the voltage to 12V?