Last active
November 16, 2017 14:14
-
-
Save salgua/844cd97a5c4dabc10758104e1a952eaa to your computer and use it in GitHub Desktop.
Use Raspberry as RS232 gateway (with USB adapter)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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