Voltage level shift for a serial port, can i use MAX-RS232 - Page 1
Forum section: electronics / beginners

author: sairfan1
author_rank: Frequent Contributor
timestamp: February 26, 2025, 05:10:47 pm
content: 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 circuitcan 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)

author: MrAl
author_rank: Super Contributor
timestamp: February 26, 2025, 11:27:07 pm
content: Quote from: sairfan1 on February 26, 2025, 05:10:47 pmYou 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.

author: SteveThackery
author_rank: Super Contributor
timestamp: February 27, 2025, 02:09:50 pm
content: Quote from: sairfan1 on February 26, 2025, 05:10:47 pmI 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.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 27, 2025, 03:03:30 pm
content: 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 toTI 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 for0.62€ in singles, with for example MaxLinearSP232EENa 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 fromrandomsellers 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, thenTI MAX3232is often considered superior, because it supports higher baud rates, and works from 3V to 5.5V. TheSeeed Studio RS-232 adaptersare 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 needisolation, not just voltage level translation.

author: SteveThackery
author_rank: Super Contributor
timestamp: February 27, 2025, 10:30:51 pm
content: Quote from: sairfan1 on February 26, 2025, 05:10:47 pmCan you clarify? In RS232, the baud rate is the same as the bit rate. So how does 115200 baud relate to 2Mbps?

author: sairfan1
author_rank: Frequent Contributor
timestamp: February 28, 2025, 10:09:14 pm
content: Can I use IR signal for this? or it will be not fast enough?I saw some multimeters use it to transfer data.

author: ledtester
author_rank: Super Contributor
timestamp: March 01, 2025, 04:30:59 am
content: 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.

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 01, 2025, 11:39:03 am
content: 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.