2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ What cable did you use? Was it the same cable from RPi to scale, Rpi to PC, and PC to scale? (you may need a NULL-Modem adapter or just cross-over the TxD/RxD lines if there is no handshaking lines connected) \$\endgroup\$ – Tut Jan 30 '17 at 20:24
  • \$\begingroup\$ Check control line connections and status for what is eneded, RTS/CTS DSR/DTR, check Tx Voltage on AC and DC for data & line noise. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 30 '17 at 21:41
  • \$\begingroup\$ A block diagram of how you have things wired up when it's working vs. when it's not working would be helpful. Not sure where you are putting your MAX232 chip. \$\endgroup\$ – mjh2007 Jan 30 '17 at 22:10
  • \$\begingroup\$ RPi <- cable-a -> Scale works. RPi <- cable-b -> PC works. PC <- cable-? -> Scale does not work. Either cable-a or cable-b or both would not work in the last case because how the txd and rxd needs to be crossed or not. \$\endgroup\$ – rioraxe Jan 30 '17 at 22:43
  • 1
    \$\begingroup\$ @nawf you can self answer. In this case, seems like you figured out yourself. \$\endgroup\$ – Passerby Jan 30 '17 at 23:25
2
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

The very best solution here is to dig out the oscilloscope so you can:

  1. Measure and verify baud rate.
  2. Check voltage levels or the serial interface. Some devices will use standard bipolar signalling voltages like RS232 is supposed to use while some these days may just be using unipolar TTL logic levels.
  3. Check which pins are the input and output data pins on each end so you can properly hook Rx and Tx together in each direction.
|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

Make sure you have all three UART wires connected properly RX/TX/GND between the PC and the scale. Also you may want to verify the voltage level of the signal.

Is the scale RS-232 (-3 thru -12 or +3 thru +12V) or is it UART (+3.3V, +5V, others)?

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.