RS232 shifter SMD between Raspberry Pi & 5V serial device

Hello,

Im trying to get serial communication between a Raspberry Pi 4 and a serial sensor using the UART pins. Right now, I have the serial sensor just spitting data continuously (confirmed on another computer) linked (Rx Tx, Ground) into the RS232 side (DB9) of a SparkFun RS232 shifter https://www.sparkfun.com/products/8780. On the other side of the shifter, I’m linked up to my pi pins. I’m aiming to hook up the VCC of the shifter to my pi’s 3.3V pin (to shift it into something the pi can understand), but I get no signs of life from the shifter. --Pinning VCC to 5V, everything seems to work, but the pi can’t interpret the information.

The splitter is supposed to function as low as 2.1V, so with 3.3V I should be good. Any thoughts on why I’m running into this trouble?

Are you sure you don’t have RX and TX crossed on the RS-232 side?

Try a null modem between your serial device and the shifter and see if that fixes things for you.

Also, how is the serial device powered? If it’s via the serial connector, you might have issues since not all the usual RS-232 signals are present on the shifter and those might be what the device is using for power.

I’m confident Tx and Rx are properly pinned, because when I give the shifter 5V I see an output on the pi (just not an output it can interpret). I’ve also switched the wires on the serial side a few times back and forth to validate.

The serial device is self battery powered.

Is the sensor providing an RS-232 signal level ( between +13 and -13V) or a 5V level? (https://www.sparkfun.com/tutorials/215).

The title seems to indicate it is a 5V device and in that case this shifter will not work. you will need somthing like https://www.sparkfun.com/products/14765 or https://www.sparkfun.com/products/12009

Also, make sure your serial device is outputting RS-232 serial and not TTL serial. RS-232 is inverted from TTL so that logic 1’s become 0’s and 0’s become 1’s. The board corrects for this but if the data isn’t inverted in the first place, the board will invert it and when your Pi goes to decode that date, you get nonsense.

Hi All,

Thanks for the advice paulvha & TS-Chris! I’ve checked my signal on the oscilloscope, and it’s outputting +/- ~5.6V. Which according to your comments means I should look at these level converter options. Will do! Out of curiosity, would you be able to explain why this RS232 Shifter is the wrong part? Isn’t my +/- 5.6V still an RS232 signal that needs to be shifted to 0-3.3V TTL on the pi side?

Much Appreciated!

Johann

As Chris pointed out a 1 and 0 are the opposite. Take some time to study https://www.sparkfun.com/tutorials/215.

A logical ‘0’ is defined as a positive 5 to 15V in RS-232, while in TTL a logical ‘0’ is zero volts. Why then 5 to 15 V is logical ‘0’ in RS-232? There are many articles around it and some state it is because of the logic on the old telegram lines. Where a way to determine that the line was broken/cut was that the positive voltage was not available on the other end in rest. (But they used 100V - 160V to cover the distance)

A next point is that the RS232-SMD shifter is designed to be able to generate a negative voltage for a “1”. For that, a capacitor is used, but it will never get a negative charge in a TTL circuit.

Hi paulvha

Thank you for the advice, I’ve actually read that article and a few others in my attempts at solving my problem. Sorry if I was not clear with my previous question, here’s what I’m trying to ask:

  • From my understanding, the two level converters you recommended are used between a 5V system, and a 3.3 V system, (or any other relevant voltage, etc). For example, I would use these between an Arduino and a pi, where the Arduino is sending serial 1 as 5V and 0 as 0V and the pi wants to talk serial at 1 as 3.3V and 0 as 0V.

  • I believe my situation is different: I have a sensor that is sending serial signals as 5.6V and -5.6V. I’m not sure how to tell which is logic 0 or logic 1 but from my understanding the fact that its broadcasting +/- signals means it is RS232, and that logic 1 would be -5.6V and logic 0 would be 5.6V. I want this to communicate with a pi that can only interpret TTL serial on it’s UART pins with logic 0 and 1 as 0V and 3.3V respectfully. This is why I originally purchased the RS232 SMD Shifter, so, as you say, it can invert the signal and adapt the voltage levels as needed.

After looking at how the level converters you recommended are generally implemented, they seem to fit the scenario of the first bullet, and not my situation. So I believe I am using the correct tool (please, correct me if I’m wrong), I believe my problem is more with implementing it correctly/the nuances of my sensor and the pi.

Please let me know if that’s a wrong interpretation of the information!

Best Regards,

Johann

thanks for the clarification. If it can output +5V and -5V the RS-232 looks the right shifter. Which sensor do you have ? Is there a reference manual/datasheet where I can look at? Maybe we can start there and see what can be done.