Hacker News new | past | comments | ask | show | jobs | submit login

Yesterday I was configuring a usb to serial converter to communicate with a CNC controller (over RS232). However I was unable to transmit any data and so I brought the oscilloscope to see what was happening. I disconnected my converter and connected the oscilloscope and all the data was there and my oscilloscope had no problems decoding it with the same parameters i had used with my usb converter. Confused, I disconnected my scope and connected my converter back up again, but sill nothing. After a few times back an fourth I ended up connecting my scope up while the converter was still connected and crucially I also had a cat /dev/ttyUSB0 running and as expected the data was right there at the scope, but to my big surprise it was also there in my terminal! I then tried to disconnect my scope resulting in no more data being sent to my laptop.

The only explanation I could think of was a faulty ground connection. The scope was grounded through the wall socket same as the CNC and thus had the same ground potential. My laptop on the other hand was running on battery and only shared ground with the CNC through RS232 pin 5 (signal ground). However it seems this pin was not correctly connected on the CNC side and thus I was unable to transmit any data. Experimenting a bit I tried to connect ground to the connector shield instead and everything worked perfectly.




Yep, referencing signals vs ground is the big flaw in RS-232. That's why a lot of industrial machinery uses RS-422/RS-485 which is sent as a differential pair. 422 gives you the same serial interface, the same signaling, but with a better physical layer that lets you send the signal on much longer runs.


I’ve had a similar experience with WS8211 (or whatever they’re called) LEDs not being properly grounded to my arduino. They don’t seem to work if they’re not on the same ground plane as the controller. So if I power the LEDs from a different power source (larger current than the arduino can handle) I have to make sure they’re grounded together.

Took me a long time to figure that one out haha


That sounds like the laptop USB ground was not connected to the battery reference (and logic) ground. That's probably intentional but seems like it might cause problems with other USB uses from that laptop as well. I am assuming when power is plugged in the power ground is connected to the USB output ground, but I could be wrong there.

I have used my laptop on battery, with a USB-to-RS232 adapter, to control a telescope remotely and it worked fine IIRC.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: