Maker Pro
Maker Pro

Max232 to convert non-standard rs232 signal to TTL?

jeff77789

Feb 23, 2013
17
Joined
Feb 23, 2013
Messages
17
I actually have a MAX3232 that i bought from here:

https://www.sparkfun.com/products/589

now i am also using a maxbotix MB1020 sensor in which it gives out an RS232 serial signal from the tx pin:

When the *BW is open or held low, the TX output delivers
asynchronous serial with an RS232 format, except voltages are 0-Vcc.
The output is an ASCII capital “R”, followed by three ASCII character
digits representing the range in inches up to a maximum of 255,
followed by a carriage return (ASCII 13). The baud rate is 9600, 8
bits, no parity, with one stop bit. Although the voltage of 0-Vcc is
outside the RS232 standard, most RS232 devices have sufficient
margin to read 0-Vcc serial data. If standard voltage level RS232 is
desired, invert, and connect an RS232 converter such as a MAX232.
When BW pin is held high the TX output sends a single pulse, suitable
for low noise chaining. (no serial data).


http://www.maxbotix.com/documents/MB1020_Datasheet.pdf

my understanding is that the signal is exactly inverted or opposite of TTL with the exception of voltage levels. basically 0v - 5v RS232


so if i were to set up the MAX3232 to convert the RS232 to a TTL signal, what would i receive and would this be compatible with an arduino in the sense that it is still 0v - 5v?






side question: what is a good thing to solder the max3232 onto if i dont have a PCB ...?
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
The signal is inverted, right, meaning that the logic follows RS232 (high voltage=logic low).
The sensor's description says you can directly connect ths signal to an RS232 receiver's input and hope for correct TTL logic output (even though the RS232 signal is non-standard).
Or you can use a standard TTL (or CMOS) inverter to "receive" the RS232 signal.

From an electronic point of view you can connect the pseudo-RS232 signal directly to an arduino's TTL port without risking destruction, but due to the inverted logic level the UART on the µC will not be able to decipher the data.

If you don't want to add hardware to the arduino, you could also try:
- feed the pseudo RS232 signal to an input pin of the arduino that can issue an interrupt when the state changes.
- In the interrupt routine, read the logic level from the pin, invert it and send it as output to another pin of the arduino. Voilá, a software inverter is created..
- wire this output pin to the input of the UART.
This will work only for comparatively low baudrates due to the jitter introduced by the "software inverter". 9600 bd might be feasible.



Side answer: get a PCB (perfboard, protoboard...). Or just glue it upside down onto any available space (e.g. back of anther IC), Use magnet wire for the wiring and solder the wires and any components (e.g. capacitors) freely to the pins.
 
Top