I would like to sample 24V one wire serial with a voltage divider, wouldn't grounding the resistors in series potentially affect the data being transmitted?
I was considering using an optocoupler but I am uncertain about how to select the correct type for a 115200 baud, half-duplex, 8-N-1, UART signal that is responsive enough.
According to documented reverse engineering efforts, I was able to find Inactive level is 24V, Active level is 0V.
"Mark" would correlate with the active level, which is 0V. "Space" would correlate with the inactive level, which is 24V
If an active state is being represented by a lower voltage level (0V in this case) and an inactive state by a higher voltage level (24V), it represents inverted logic.
With "eight data bits, no parity, one stop bit", a "BREAK" condition would involve the transmission line remaining in the "Space" state (24V) for longer than the period required to transmit a single byte plus the stop bit.
Given a baud rate of 115200, line can change state 115200 times a second, that is 115.2 kilohertz.
T = 1 / f gives us about 8.7 ms per state (high or low). If I recall correctly we have 1 start bit, 8 data bits, no parity bit and a stop bit so thats 10 bits.
So, that's a total of 10 bits, and 87 ms of time to transmit them.
I see modules online with this circuit design that seem like a solution to interface with controller at 24V but I am not certain about it being the correct solution. It appears on the out side you would set Vcc at 3.3V/5V depending on your MCU Rx voltage and IN+ to 24V. C1 provides noise filtering and/or decoupling functions.
115200 baud = 115200 cycles per second is a frequency and it is equivalent to 115200 Hz, and 6N137, is a 10MBit/s rated Optocoupler in theory.
In my opinion, this is the correct solution, but there might be better lower cost solutions that I'm not aware of.