Arduino Mega Serial RS232 Communication

Hi, the project I'm working on needs to use an Arduino Mega 2560 to display data from a hydrogen fuel cell on an LCD screen. The fuel cell controller uses RS232 serial communication to output data such as voltage and current produced, and I have found software which runs on a PC and can correctly communicate with the fuel cell controller over RS232 and display this information.

The problem I'm having is getting the Arduino to read the serial information it is receiving. Serial.begin(9600) has been included in the setup and I've tried using Serial.read, Serial.parseInt etc to see if anything provokes a response but nothing returns anything other than -1 or 0. I assume a more complex serial function is required.

I've also attached the relevant page from the fuel cell manual, which specifies baud rate, format etc.

Thanks :slight_smile:

Unfortunately I can't help you with the code but the people that can are going to ask for a terminal capture of the serial output using a program like REALTERM or EASYTERM or something with terminal capture function (since the IDE lacks that).
Capture the serial output and post the file and post a sample of it as a quote.

jackd1:
Hi, the project I'm working on needs to use an Arduino Mega 2560 to display data from a hydrogen fuel cell on an LCD screen. The fuel cell controller uses RS232 serial communication to output data such as voltage and current produced, and I have found software which runs on a PC and can correctly communicate with the fuel cell controller over RS232 and display this information.

The problem I'm having is getting the Arduino to read the serial information it is receiving. Serial.begin(9600) has been included in the setup and I've tried using Serial.read, Serial.parseInt etc to see if anything provokes a response but nothing returns anything other than -1 or 0. I assume a more complex serial function is required.

I've also attached the relevant page from the fuel cell manual, which specifies baud rate, format etc.

Thanks :slight_smile:

I think I have a clue about the problem. The cell outputs RS232 instead of TTL (Am i right?) Then you are going to need a transceptor to transform the +-12V RS232 level to the 0-5[V] TTL level of the Arduino (Mega has 5[V] logic right?). The most common transceptor for this purpouse is MAX232, a cheap and common one.

Other question, are you going to use software serial or the hardware pins?

Regards.

Yes , a MAX232 chip or breakout board will allow you to get the signal to the arduino.

PS- you still need to follow the instructions in my last post ...or you will get no help with software

Thanks for the suggestions, I'll post the output from realterm/easyterm as soon as I have access to the fuel cell again. Also I have been using a max232 board to convert the signal to TTL and I've made sure the connections are correct (RX to TX etc).