RS232 to TTL communication

Hello friends
Would you please guide me?
I have a UPS device that feeds a port 232 is compliant with RS32 device connected to Arduino got it.
It is necessary to send a command to return putty information. This command is “Q1”.
i check this command in Doklight program send frome PC “Q1” by ASCII and return Voltage or any data in 1 line
for example communication :
[TX] - Q1

[RX] - (223.3 221.9 220.5 008 50.0 2.26 17.0 00000000

The program should help me what to write?
((Being sorry is not good tongue, English is not my native language))

Not sure what you’re asking. Do you have an arduino attached to the UPS using an RS232 adapter and you want to query the UPS using it?

What do you want the Arduino to do with that data?

Hi, my dear friend Thank you for your help I want to read UPS information with arduino uno. Moudel max32 connect with I-ups, but I do not know what code I use ...

Have a look at the SoftwareSerial library. Google it :wink:

Reference page: Arduino - SoftwareSerial

SoftwareSerial port to connect to UPS, normal HardwareSerial to connect to PC.

PS
If you’re using a Mega, Leonardo etc that have two or more hardware serial ports, you don’t have a need for SoftwareSerial and can use e.g. Serial1 instead of SoftwareSerial.

Tank you very much But I use this cod to arduino uno and connecting Rex/tx pin Max32 to pin 0-1 arduino . Not working Pleas help me

Avoid connecting to Arduino digital pins 0 and 1. They are already connected to the serial port that connects to the PC. Use software serial on some other pins.

Which board are you using (Uno, Mega, ...)?

Which code? Please post it using code tags (see the sticky 'how to use this forum' to see how it can be done).

After posting the code, please explain what you expect the code to do and what it actually does; "not working" means nothing.

I using arduino Uno by this code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(6, 7);
void setup() {
// put your setup code here, to run once:
Serial.begin(2400);
mySerial.begin(9600);

// delay(5000);
}

void loop() {
// put your main code here, to run repeatedly:

//mySerial.println(mySerial.read());

byte message[2]={0x51,0x31}; // for sendig Q1
Serial.write(message,sizeof(message));
delay(5000);
Serial.println(Serial.read()); // Recive data frome UPS

}

I trying any port or pin for send and receive data

  Serial.println(Serial.read()); // Recive data frome UPS

This will echo data sent from the PC back to the PC. I think you might have meant...

  if(mySerial.available()) Serial.write(mySerial.read());

See the difference?

Tank you MorganS

I trying this code and is not responding UPS,

I connecting pin Rx MAX3232 to TX (1) arduino and TX -> RX . and female DB9 UPS rx to rx and tx to tx MAX 32.

(( and try MAX32 to arduino rx->rx ,tx->tx, UPS rs232 to MAX32 rx -> rx , tx->tx))

load this code and open serial monitor arduino.you thinking this way is true?

You need to connect your level converter to the pins that are used by software serial (6 and 7 in your code).