Electronic – Cannot establish communication through RS232 to a digital scale

groundnoiseputtyrs232

I am an electrical engineering senior student and I think I tried everything. Here is the case: (no i am not using the USB to RS232 convertors)

I bought a digital scale that can send the weight serially to a machine. When you request the data by sending W (57 in hex) the scale sends back the weight. As I always do, I try to narrow down the culprits so I tried the following:

1) I created an RS232 connector using MAX232 and a raspberry pi and was able to send through Minicom (like putty) a W and receive a weight value.

2) I used the same circuit to connect the Raspberry Pi to my Windows machine and successfully communicated back and forth with Putty.

Simple right? I mean UART, it should be.

So the cable is fine, the scale works as advertised, putty on windows works, the the ports on the windows machine work; however, the Windows machine and the scale refuse to communicate. Which means that the W is not reaching the scale because I am not getting back anything, not even junk.

3) I also tried steps 1 and 2 with a virtual machine running win 7 instead of Win 10, and even tried a usb to rs232 cable that I know is functional…works with rpi but not with the scale.

I have only one last explanation. In my building we do not have Grounding in the plugs. All appliances work fine, but they will give you a neat zap if you touch them bare foot. What this has to do with the problem is that I think the (rpi+max232+DC power supply) system is well grounded while the PC (not grounded) to scale (not grounded) system is suffering from a noise issue. Can this be the case? Do you have any other suggestions that I could try? (I called my grandma asking for some holy water) Thank you in advance.

Best Answer

The reason the connection worked from Rpi --> Scale and not PC --> Scale is because of luck ( or lack of it) : The scale expects a crossed TX and RX and since the RPi connection was of my making, I had accidentally crossed the RX and TX at the MAX232 level. So using a non-crossed cable with the Rpi worked (since the signal entering it was already crossed at MAX232) while using a crossed cable did not work. On the PC side, the opposite was happening and that is where the confusion started. In a conclusion and lesson to benefit readers, the RS232 standard was originally intended for DTE/DCE communication (T for terminal and C for communication, aka computer to modem). Later, the standard was more widely used as DTE/DTE or "Serial null modem" where the Rx and the Tx are cross-connected as such. enter image description here

More configurations (with handshaking etc) can be found at the source https://www.lammertbies.nl/comm/info/RS-232_null_modem.html

So as @Tut and @Rioraxe quickly noted, the problem was with the cable, so make sure to know the type of cable you are using by testing it with an ohm meter or any other method.

Related Topic