How to access a ublox GNSS-receivier with U-center when the receiver is connected to a Raspberry Pi and is only accessible through SSH
- Ensure that the computer is accessible with SSH and that
socat
is installed. - For a one time test, it is only necessary to run
stty
once like this:stty -F /dev/ttyACM0 38400 raw
This is to ensure that baudrate is fixed, and that raw data traffic is used. Else it will probably fail in strange ways. - For a more permanent setup, it is probably smart to run this command whenever the device is connected. To do this, we use
udev
by adding a rule file namedublox.rules
to/etc/udev/rules.d/
with the following content:SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a9", MODE="0666", RUN+="/bin/stty -F /dev/%k 230400 raw"
To find out what theidVendor
andidProduct
is, runlsusb -v
and find the correct device in the output. TheMODE="0666"
isn't strictly necessary, but if accessing the serial device from a docker container, it will need elevated permissions on the device. Theudev
rule will run whenever the device is reconnected or on reboot.
Sources:
How to set baud rate automatically when device connects?
Pass ATTR{idVendor} as argument in udev script
- Ensure that it has
socat
installed. - Run:
socat tcp-l:6000,fork,nodelay,keepalive,reuseaddr EXEC:"ssh user@raspberrypi socat - /dev/ttyACM0"
This line will connect to the Raspberry Pi over SSH, startsocat
and clone port/dev/ttyACM0
. It will then clone it onto TCP port 6000 for the WSL/Linux PC making it possible to use network connection in U-center by connecting totcp://localhost:6000
ortcp://[IP-address]:6000
Sources:
How can I create a virtual serial port that relays data over ssh?
ACCESSING A USB IO MODULE IN A NETWORK BY USING LINUX AND SOCAT