Go Down

Topic: Serial communication: serial read from gas analyzer (Read 619 times) previous topic - next topic


Dear all,
I'm trying to read data from a gas analyzer with arduino by serial communication.
This instrument has a RS232 port, so I have bought a RS232 to TTL converter (MAX3232).
First of all I monitored all communication between PC (with RS232 port) and the serial port of the instrument. I used a program called "advanced serial port monitor". It returned me the following information:

COM is open
Baud rate 9600
RTS on
DTR off
bit packages=8, Bit Stop =1, parity=None
Character setting: Eof=0x1A, Error=0x00, Break=0x00, Event=0x1A, Xon=0x11, Xoff=0x13
Flow Control Manual: ControlHandShake=(), FlowReplace=(TRANSMIT_TOGGLE, RTS_CONTROL), XonLimit=1024, XoffLimit=1024

I tryed to connect this instrument to arduino with MAX3232 using the following code:

Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1);//rx/tx

void setup()  {



void loop() {

  char data = mySerial.read();

I was not successful. There isn't communication trace on the serial monitor.
Please, could I have some advice?

Thank you so much!


Hi Stefano

Code: [Select]
SoftwareSerial mySerial(0, 1);//rx/tx

The serial monitor uses pins 0 and 1.  So try moving your sensor to different pins.  Then change the pin numbers in the above statement.


Hackscribble.  Writing about making things



Mar 29, 2019, 04:44 pm Last Edit: Mar 29, 2019, 04:46 pm by GolamMostafa

1.  Connect RXTTL-pin of MAX232 with DPin-2 of UNO. (RXTTL = Receive Pin at TTL side of MA232)

2.  Connect TXTTL-pin of MAX232 with Dpin-3 of UNO.

3.  Upload the following sketch and report results.
Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);//srx/stx

void setup()  

void loop()
    byte n = mySerial.available();
    if(n !=0)
         char x = mySerial.read();

BTW:  DPin-0 and DPin-1 of UNO are permanently engaged with Serial Monitor/IDE for debugging and uploading. Many users prefer not to disturb those two pins.

Go Up