How to know on what voltage is my UART ? 5.0V, 3.3V or anything else ?

Hi there.

I have an UPS I want to control through its DB9 RS232 port. (I know its pinout is pin 5 for GND, 2 for Tx and 3 for its Rx)

I already managed to communicate with the UPS from a PC running linux and screen:

screen /dev/sttyUSB0 2400
Q1

For instance !
Sending a "Q1" retrieves data from the UPS
Sending a "S1R000" will stop it in 1 minute.
Sending a "C" would resume to normal mode,(power ON again)

I've been doing so using a general purpose USB to RS232/RS485/TTL converter that works ok.

But I'm aware that normal RS232 can go from something like -12 to +12V, some UART are on 5.0V (UNOs) and some others on 3.3V (ESP8266).

I'd like to remove this converter and use directly the Arduino's or ESP8266's UART, so I need to know the voltage level of that UPS's RS232 port.

I've been checking with a voltmeter between pin 5 and 3 then between pin 5 and 2 of the UPS but can't find any voltage !

Would you have any advice to get that voltage ?

But which output do you use on that converter? It has RS232, RS485, 3V3 TTL and 5V TTL.

And is the device sending anything when in rest? Otherwise, you should be able to measure something between 3 and 5 (device Txo). +5V / +3V3 for TTL and -3V to -15V for RS232.

If the UPS uses RS232, it's not only levels that differ but the signals are also inverted.

The UPS uses DB9 RS232 port.

Is the question so hard ::slight_smile:

septillion:
But which output do you use on that converter? It has RS232, RS485, 3V3 TTL and 5V TTL.

sterretje:
If the UPS uses RS232, it's not only levels that differ but the signals are also inverted.

mmmh !
I've checked inside the converter and it has a SIPEX SP3232EE chip inside. Reading its datasheet, I understand what you mean.

septillion:
Is the question so hard ::slight_smile:

Sorry, I use RS232 on the converter ! So RS232 on both side, converter and UPS.

Then you can't use any TTL serial directly. Simply use a RS232 tot TTL chip like a MAX232 or MAX3232.

septillion:
Then you can't use any TTL serial directly. Simply use a RS232 tot TTL chip like a MAX232 or MAX3232.

But these kind of converter are confusing !

they're described to be
"USB To RS232 TTL UART"
But so they're only USB To TTL UART !

Or are these PL2304, CH340, FTDI and so ..., based chip able to emulate RS232 ?

I have to say the PL2303HX is confusing indeed. After a quick scan through the datasheet I'm not even sure what it outputs... But dongle you have now (with dedicated inputs for all different types of signal) seems to make it pretty clear :slight_smile:

Most other common serial-USB chips (like the CH340 or FT232R) output TTL serial (at switchable voltage levels).

hary:
Hi there.

I have an UPS I want to control through its DB9 RS232 port. (I know its pinout is pin 5 for GND, 2 for Tx and 3 for its Rx)

I already managed to communicate with the UPS from a PC running linux and screen:

screen /dev/sttyUSB0 2400

Q1




For instance !
Sending a "Q1" retrieves data from the UPS
Sending a "S1R000" will stop it in 1 minute.
Sending a "C" would resume to normal mode,(power ON again)

I've been doing so using a general purpose [USB to RS232/RS485/TTL](https://www.ebay.fr/itm/USB-to-RS232-RS485-TTL-Embedded-FT232RL-Industrial-Isolated-Interface-Converter/183739598879?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649) converter that works ok.

But I'm aware that normal RS232 can go from something like -12 to +12V, some UART are on 5.0V (UNOs) and some others on 3.3V (ESP8266).

I'd like to remove this converter and use directly the Arduino's or ESP8266's UART, so I need to know the voltage level of that UPS's RS232 port.

I've been checking with a voltmeter between pin 5 and 3 then between pin 5 and 2 of the UPS but can't find any voltage !

Would you have any advice to get that voltage ?

Legacy RS232 systems use DB9 connectors and the signals can be anything fron (-12V, +12V) to (-18V, +18V)
later RS232 devices such as PC's can use signal levels all the way down to -5V to +5V.

The rs232 line will idle (not transmitting anything) in negative voltage say -12V

Normally you should be able to read some negative voltage (-12V or -5V) between pins 5 and 2 on your UPS's DB9 port.

You can easily build a simple transistor circuit to convert the RS232 signals to TTL and vice versa.

Read this sparkfun page here for more details :
https://www.sparkfun.com/tutorials/215

I hope this helps.

They seem to be all described like so , and confusing !
Here, a CH340 chip based
VHere an FTDI chip based.
And here the PL2303 chip based !
All described as RS232 converter !

What would I need to communicate with my UPS (RS232 port) from a microcontroler, say arduino or ESP8266 ?

@HellasT
By the way, reading some stuff on RS232, it looks like even in standalone state I should get between -3 and -25V on Tx (Tx/GND) or Rx (Rx/GND). I can't see any on the UPS side.

On the converter side I can get -5.72V between GND and pin #3.

hary:
What would I need to communicate with my UPS (RS232 port) from a microcontroler, say arduino or ESP8266 ?

septillion:
Simply use a RS232 tot TTL chip like a MAX232 or MAX3232.

:wink:

hary:
By the way, reading some stuff on RS232, it looks like even in standalone state I should get between -3 and -25V on Tx (Tx/GND) or Rx (Rx/GND). I can't see any on the UPS side.

Does the UPS actually transmits back?

septillion:
:wink:
Does the UPS actually transmits back?

Yes the UPS respond absolutely correctly to the query I send. Of course I'm using that "expensive" USB to RS232/RS485/TTL converter.

I would like to find a way to directly communicate through Arduino's serial avoiding USB. (RS232 => serial instead of RS232/USB => USB/serial).

That might be the max232 you were thinking of

To communicate directly from a 3.3V or 5V logic level serial output with a true RS232 device (with +/- voltages and inverted logic), I recommend this converter from Pololu. There is a partial kit if you don't need the DB9 connector.

That's indeed an option. But the core of that board is once again a MAX chip, the MAX3238 :slight_smile:

septillion:
That’s indeed an option. But the core of that board is once again a MAX chip, the MAX3238 :slight_smile:

You’re absolutely right !
There are a bunch of RS232 transceiver chip.

The max232 is now well outdated and can be replaced with a lots of new core maw232 with nice added features (see link above) (lower power consumption, shutdown when not in use, better transfer quality, ESD protection, …etc…

In fact, coming back to one of my previous question why I couldn’t read any voltage on UPS side in standalone mode (when no RS232 cable connected), I now understand !
I re-checked it with the USB =>RS232 converter connected (and USB powered !) to the UPS and I now can read -4.5V !
So, I guess the UPS is equipped with an updated power saving MAX 232 chip like “Autoshutdown” or “Autoshutdown Plus” feature described in the link.

All this now make sense.

Thank you very much to you helping me to sort this out ! I got things much clearer now.

I'm glad I could help :slight_smile: