Go Down

Topic: Arduino Mega Serial RS232 Communication (Read 1 time) previous topic - next topic

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 :)

raschemmel

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.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mart256

#2
Apr 17, 2014, 05:42 pm Last Edit: Apr 17, 2014, 05:44 pm by mart256 Reason: 1

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 :)


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.

raschemmel

Yes , a MAX232 chip or breakout board will allow you to get the signal to the arduino.
https://www.sparkfun.com/products/retired/316  
https://www.sparkfun.com/products/11189



PS- you still need to follow the instructions in my last post ...or you will get no help with software
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

jackd1

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).

Go Up