Help with Arduino RS232 communication

336 views
Skip to first unread message

C Clark

unread,
May 4, 2015, 4:38:43 PM5/4/15
to notti...@googlegroups.com
Hi,

I'm after some help with an Arduino RS232 project. I'm trying to send commands to a piece of equipment using a TTL-RS232 converter and an uno. I've been working on it for a while to no avail and am quite stuck. If anyone would please be willing to offer some advice I would really appreciate it. Thanks.

Ian Dickinson

unread,
May 4, 2015, 6:02:35 PM5/4/15
to notti...@googlegroups.com
Would you be able to post a few more details about the project and the problems you are seeing:
- what's the equipment you are connecting to?  (any links, especially anything about the RS232 interface would be useful)
- do you have a schematic? If not, what pins on the Arduino Uno are using for the serial interface?
- is is possible to forward your source code?
- what problems are you seeing?  

C Clark

unread,
May 4, 2015, 7:27:34 PM5/4/15
to notti...@googlegroups.com
Hi Ian,
Thanks for your reply. The piece of equipment I'm trying to control via RS232 interfaced with Arduino is a mechanical stirrer (link to follow). I thought (perhaps naively) that I could send the required commands to change the rotation speed etc by printing to the serial port of an arduino. I researched online and purchased a TTL-RS232 board that can connect to the uno board. I connected this up to the uno (attached drawn schematic no. 1) and connected to the stirrer with a straight through serial cable. Tried to send the commands to the stirrer using the software serial example given in the arduino IDE (changing rx and to pins to 6 and 7).Nothing happens. Tried to alter the way the command is sent (with carriage returns etc) still nothing.

To rule out that maybe the commands given by the manufacturer aren't working I connected the stirrer directly to the Pc using a USB to serial cable. I can write the commands using either hyperterminal or a custom python script and it works fine. The equipment does what's it's told and serial communication is behaving...

To test the output of the TTL-RS232 board and arduino I have attempted to connect them to the Pc using the RS232-usb cable (attached photo no. 2)
Tried to print data from the arduino using same serialsoft code as before and trying to read what's is being sent on the Pc using either hyperterminal / python. It seems as though nothing is being sent. I have put a debugging Led on the tx pin of the TTL-RS232 board but although it flashes when data is sent, nothing appears at the Pc end. I have checked that everything (baud rate, stop bits, etc) matches at both ends.

As at this point I was becoming suspicious of the TTL-RS232 board, I've built another unit from scratch on a breadboard using MAX3232 but it is the same outcome for both scenarios described above. I guess that there must be an error in either my code or the way I'm trying to tackle the problem, but not really sure what else to try. I've searched a lot on the arduino forum and others but no one else seems to have the same problem. I'd really appreciate any advice that you may be able to offer. Thanks.
IMAG0285.jpg

C Clark

unread,
May 4, 2015, 7:32:36 PM5/4/15
to notti...@googlegroups.com

Tom Lynch

unread,
May 4, 2015, 8:26:04 PM5/4/15
to notti...@googlegroups.com
  • Presume you've checked the device is on the right baud rate?
  • Can you receive messages from the device?
  • Can you test the outputs with an oscilloscope to make sure they are correct?

Ian Dickinson

unread,
May 5, 2015, 2:37:09 AM5/5/15
to notti...@googlegroups.com
Given the LED flashes, it looks like the Aruino is sending. However, as nothing is received at the PC end it could be the wiring. Worth re-checking the TXD output from the MAX232 is connected to RXD input of the USB adaptor connected to the PC.

It could still be a baud rate or word format issue too, but even if these are wrong you often see some (incorrect) characters received.

As Tom has suggested, the next step is probably to start probing with an oscilloscope.


C Clark

unread,
May 5, 2015, 3:55:08 AM5/5/15
to notti...@googlegroups.com
Hi Tom, Thanks for your reply. The devices settings (given by the manufacturer) have been matched on the arduino. The equipment isn't able to send anything without receiving the command to do so first - I've tried this but still nothing. When I've connected the arduino rs232 looped back to the Pc using the USB to RS232 cable neither sending or receiving works. I will try to test the outputs with an oscilloscope. Thanks for your help.

Bill Bigge

unread,
May 5, 2015, 4:34:42 AM5/5/15
to notti...@googlegroups.com
Have you tried a loop back test? -- Connect the RS232 converter output
to the RS232 input so that any data you send comes straight back in, you
can then test to see if the electronic interface is functioning - If you
send data from software serial on the UNO and get it back then the RS232
translator is working.

You can also try the opposite by connecting the RS232 to the PC using
the Serial cable, and just wire the Tx and Rx pins on the logic side of
the MAX 232 together and try sending data from the PC to see if it comes
straight back to the terminal (don't forget to power the RS232 board
from 5V though;)

If the loop back tests work then proceed to check the cable polarity
with an LED or oscilloscope - i.e. make tripple sure that the Rx and Tx
wires on the cable are connected to the correct RS232 in and out pins on
the max232.

Bill

---------
Creative Robotics Ltd
www.creative-robotics.com
www.createbots.com
---------

russellh

unread,
May 5, 2015, 6:58:14 AM5/5/15
to Hackspace

Lots of good advice so far, lots of testing.

In your diagram, you have labeled the RS232 cable as "straight" what are you meaning by that?
In the mixer manual the required cable is a crossover cable (Tx -> Rx, Rx-> Tx, RTS -> CTS, CTS -> RTS)

It's sounding like it's a flow control problem to do with RTS (Request to send) and CTS (Clear to send)
Also when testing with the computer the RS232 needs flow control USB doesn't.
Try:
() indicates pins on DB9
Connect Tx (3)----------------------- Rx (2)
Connect Rx (2) ----------------------- Tx (3)
I expect the usb end doesn't understand or care about the RTS & CTS, So won't generate the correct signals.
Looping them back at both ends could be what you need. Effectively spoofing the required signals.
Connect RTS(7)--|                        |--RTS(8)
                 CTS(8)--|                        |--CTS(7)
(Looped back so removing flow control)

Cross connecting any pin to any pin will not break or fuse anything (you'll just have no communication happening)

This is where a breakout box and a light box(LED's connected to every pin) would be useful.

Good Luck

RussellH

Hi,

I'm after some help with an Arduino RS232 project. I'm trying to send commands to a piece of equipment using a TTL-RS232 converter and an uno. I've been working on it for a while to no avail and am quite stuck. If anyone would please be willing to offer some advice I would really appreciate it. Thanks.

--
You received this message because you are subscribed to the Google Groups "Nottingham Hackspace - Nottinghack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nottinghack...@googlegroups.com.
To post to this group, send email to notti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ian Davis

unread,
May 5, 2015, 9:53:35 AM5/5/15
to notti...@googlegroups.com
I also had a similar problem with the RS 232 converter I found I had to invert the UART from the Arduino before the RS232 converter to get it to work ... Just a thought

Tom Lynch

unread,
May 5, 2015, 10:10:27 AM5/5/15
to notti...@googlegroups.com
Yeah, Atmel chips have inverted UART.

Kind Regards


Tom Lynch

On 5 May 2015, at 14:53, Ian Davis <iancar...@gmail.com> wrote:

I also had a similar problem with the RS 232 converter I found I had to invert the UART from the Arduino before the RS232 converter to get it to work ... Just a thought

--
You received this message because you are subscribed to a topic in the Google Groups "Nottingham Hackspace - Nottinghack" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nottinghack/jrsu1zewnZE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nottinghack...@googlegroups.com.

C Clark

unread,
May 5, 2015, 1:43:40 PM5/5/15
to notti...@googlegroups.com
Thanks for all the helpful suggestions :) I shall try them and let you know how I get on. Thanks again. 

C Clark

unread,
May 5, 2015, 3:30:16 PM5/5/15
to notti...@googlegroups.com
Just to let you all know - it seems to be working! I tried the loopback tests on the Arduino Board serial (OK) RS232 to USB (OK). Tried printing from arduino using software serial and reading on RS232 to USB using hyperterminal, initially nothing but re-did all my wiring on my homemade MAX3232 converter on the breadboard and it works! Think I had the tx and rx pins on the "out" side of the chip the wrong way around and I think that the pre-made TTL-RS232 board that I have spent most of my time trying to get to work is dead. Thanks so much for all your helpful suggestions. I am so so so happy it works!!!   
Reply all
Reply to author
Forward
0 new messages