Author Topic: Voltage level shift for a serial port, can i use MAX-RS232  (Read 697 times)

0 Members and 1 Guest are viewing this topic.

Offline sairfan1Topic starter

  • Frequent Contributor
  • **
  • Posts: 380
  • Country: ca
Voltage level shift for a serial port, can i use MAX-RS232
« on: February 26, 2025, 05:10:47 pm »
I'm using serial port on my PC this serial port is connected to a circuit that uses 5v but in worst case it can expose 24v to serial circuit
can i use MAX RS232 IC ? or is there any specific IC that can help to keep both voltage level separate?

I will be using baud rate 115200 (or max 2Mbps)
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1774
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #1 on: February 26, 2025, 11:27:07 pm »
I'm using serial port on my PC this serial port is connected to a circuit that uses 5v but in worst case it can expose 24v to serial circuit
can i use MAX RS232 IC ? or is there any specific IC that can help to keep both voltage level separate?

I will be using baud rate 115200 (or max 2Mbps)

You should just look up the specs of the chip you want to use.
I did want to comment on something related though, and that is that the 5v RS232 does not work on all ports.
I believe the min and max for RS232 is +3v to +15v and -15v to -3v, but some device ports do not respond to even +5v.  That may be because it's 'just' 5v, which might be similar to -2.5v to +2.5v, which would not be in the right range.
 

Offline SteveThackery

  • Super Contributor
  • ***
  • Posts: 1194
  • Country: gb
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #2 on: February 27, 2025, 02:09:50 pm »
I'm using serial port on my PC this serial port is connected to a circuit that uses 5v but in worst case it can expose 24v to serial circuit
can i use MAX RS232 IC ? or is there any specific IC that can help to keep both voltage level separate?

I don't think I really understand your requirements, but I just wanted to point out that the MAX RS232 doesn't just shift the voltage, it inverts it as well. That is because a logic 1 at TTL levels is +5V, whereas at RS232 line levels a logic 1 is -3V to -15V.

This might affect your approach.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7544
  • Country: fi
    • My home page and email address
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #3 on: February 27, 2025, 03:03:30 pm »
Which serial pins do you use?  Some use only RX+TX, some use RX+CTS+TX+RTS, some use all: RX+CTS+RI+DSR+DCD+TX+RTR+DTR.

I think the OP might be referring to TI MAX232DR, which works from a single 5V supply, uses four 1µF capacitors (I'd use 50V rated X7R because I'm a hobbyist and the datasheet says they're acceptable), can do 115200 baud, and supports two incoming and two outgoing signals, for example RX+CTS+TX+RTS or RX+DSR+TX+RTR, depending on how your 5V device does hardware flow control (if at all).  Mouser sells these for 0.62€ in singles, with for example MaxLinear SP232EEN a pin-compatible device.

These will work, as long as OP only needs at most two incoming and at most two outgoing serial signals on the 5V device.  The datasheet above shows how the chip is used, but you can find MAX232DR-based break-out boards with RS-232 connectors on them, too.  It is very common to only use RX+TX, but I personally find that hardware flow control makes life easier, so I do like to use that myself.

Just note that buying the MAX232DR chips or break-out boards from random sellers from eBay or Aliexpress can get you garbage.  Pick a seller who has sold lots.  These are not expensive at all, so no reason to pay more than about $2 each.

If you only need RX+TX, then TI MAX3232 is often considered superior, because it supports higher baud rates, and works from 3V to 5.5V.   The Seeed Studio RS-232 adapters are generally considered good, and you only need to connect four wires (your logic voltage between 3V and 5.5V, ground, RX, and TX), but again, there are all sorts of fakes around there.  Clones are usually okay –– you'll find the schematic is the same as in the TI datasheet ––, it's the fakes with fake ICs that you need to avoid.

Note that in any case, this assumes that your computer's RS-232 is referenced to the same ground as your 5V circuit.  Otherwise, you need isolation, not just voltage level translation.
 

Offline SteveThackery

  • Super Contributor
  • ***
  • Posts: 1194
  • Country: gb
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #4 on: February 27, 2025, 10:30:51 pm »
I will be using baud rate 115200 (or max 2Mbps)

Can you clarify?  In RS232, the baud rate is the same as the bit rate. So how does 115200 baud relate to 2Mbps?
 

Offline sairfan1Topic starter

  • Frequent Contributor
  • **
  • Posts: 380
  • Country: ca
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #5 on: February 28, 2025, 10:09:14 pm »
Can I use IR signal for this? or it will be not fast enough?
I saw some multimeters use it to transfer data.
« Last Edit: March 01, 2025, 12:00:19 am by sairfan1 »
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3504
  • Country: us
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #6 on: March 01, 2025, 04:30:59 am »
There are high-speed optocouplers which can reach megabaud speeds - easily found with a web search.

The IR interface used by multimeters is essentially an optocoupler but with the capability to separate the transmitter and receiver without exposing any electrical contacts.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7544
  • Country: fi
    • My home page and email address
Re: Voltage level shift for a serial port, can i use MAX-RS232
« Reply #7 on: March 01, 2025, 11:39:03 am »
I've used a pair of optical Toslink (plastic) cables with inverted UART signaling (idling OFF, because the transmitters don't really like being ON for more than 50% of the time) at about 2 Mbaud between identical MCUs with no problems.  Pity they're rare nowadays, and cost a lot for what they are.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf