Skip to content

Instantly share code, notes, and snippets.

@salgua
Last active November 16, 2017 14:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salgua/844cd97a5c4dabc10758104e1a952eaa to your computer and use it in GitHub Desktop.
Save salgua/844cd97a5c4dabc10758104e1a952eaa to your computer and use it in GitHub Desktop.
Use Raspberry as RS232 gateway (with USB adapter)
# on Raspberry Pi
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ser2net
# check if /dev/ttyUSB0 exist
sudo echo "2000:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner" >> /etc/ser2net.conf
sudo service ser2net restart
# on remote machine (debian based)
# change ADDRESS_OF_RASPBERRY with the IP address
sudo apt-get install socat supervisor
cat >/etc/supervisor/conf.d/socat.conf <<EOL
command = /usr/bin/socat pty,link=/root/dev/ttyV0 tcp:ADDRESS_OF_RASPBERRY:2000
autorestart = true
user = root
EOL
sudo supervisorctl reload
sudo supervisorctl start socat
# now you can access to the remote serial port through /root/dev/ttyV0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment