Serial Bridge over WLAN with an ESP-01
Jump to navigation
Jump to search
Serial Bridge over WLAN
Sometimes you have a device that communicates over a serial port, but it is not in range of a server or notebook to connect it to. Then you can use an ESP8266 with the [ESP-Link] firmware.
- Dl the firmware as described [here]
- Connect to the new ESP* AP with the usual IP 192.168.4.1 and configure your wlan, hostname (e.g. esp-link1) and pin assignments
- Configure optional services (syslog, ntp, mDNS) as needed
- Connect Rx/Tx of the ESP8266 to the Tx/Rx of the device and optionally its reset line to the configured pin
- Check the µC Console for expected serial output
On the receiving side, run socat like this (maybe use -t or -T for longer inactivity timeouts and make sure socat is restarted in a loop (systemd service?)
$ sudo socat pty,link=/dev/ttyTCP0,ignoreeof,user=joachim,group=dialout,mode=777,raw,echo=0 tcp:esp-link1:23 &
This creates a virtual serial port that can be used like normal, e.g.
$ pio device monitor -p /dev/ttyTCP0 -b 115200
all done, enjoy the new networking device :)