Bering-uClibc 6.x - User Guide - Advanced Topics - Setting Up a Raspberry PI as a net to serial gateway
This is a work in progress
This setup describes how to make any device serial communication port accessible through an SSH network session. The motivation was to make the serial port of a distant APU2c2 accessible over distances longer than 200 feets. Knowing that RS-232C communication distances are short, why not use a wired network instead that can reach a lot farther.
This setup shows how to adapt the LEAF tarball distribution for the raspberry PI and make it act as an interface between your network and any device serial communication port. The Raspberry PI will run an ssh server and will accept an ssh session where one can access the serial port using minicom or picocom communication programs. There is a USB to RS-232C cable, that connects the raspberry PI to the serial port.
Using the Raspberry PI with the LEAF distribution transforms it into a very stable and dependable platform, since everything runs in rams. It is a well known fact that, it is only a matter of time for the Raspberry PI to corrupt it's SD card and make it fail to boot or run. This is mainly caused by random power fails occuring when the PI is writing to the SD card (further readings: https://hackaday.com/2016/08/03/single-board-revolution-preventing-flash-memory-corruption/).
You will need
- - one raspberry pi 1 and power supply, (or PI2 or PI3 but it will be overkill...)
- - rs232c to USB cable
- - LEAF tarball distribution for PI1, at https://sourceforge.net/projects/leaf/files/Bering-uClibc/6.1.4/Bering-uClibc_6.1.4_raspberry-rpi.tar.gz/download
- - One SD card, 4 gig. is plenty
- - a pc running a modern Linux distribution
- - an SD card programmer
Setting up the SD
- - Download the tarball and unpack it in a suitably named directory
- - Put the SD card in the programmer, and make a single Fat32 partition, format it to Fat32
- - Copy all the files from the tarball to the SD
- - Looking at the SD contain:
1- find the package dropbear.lrp 2- rename it to dropbear.tgz 3- doubleclick it 4- add -B in /etc/network/interfaces 5- save files and update archive dropbear.tgz 6- rename dropbear.tgz back to dropbear.lrp
Starting the Raspberry PI
- - Put the SD card in the Raspberry PI, and power it up
- - After ~ 30 seconds, find out the PI's Ip address, and ssh in it
- - Set the new passwords for the OS and webmin
- - Open webmin from a browser http://raspberry_pi_IP_address
- - Edit LEAF.CFG to your liking: ....
Using the gateway
- - Open an ssh session to the PI
- - start picocom: picocom -b115200 /dev/ttyUSB0
- - hit return:... you should have the prompt to login in your router !
- - exit picocom with Cntl-a Cntl-x