Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
I'm working on a project that needs multiple TX/RX pins, but the Raspberry Pi that I have only has 1 of these pins. Can I use the GPIO pins as TX/RX pins? Or is there an adapter available somewhere?
Specifically, I need the TX/RX pins for a SIM module and a GPS module. Perhaps there are SIM and GPS modules that uses GPIO directly instead? Any links would be helpful
asked Oct 7, 2019 at 16:35
3322 silver badges66 bronze badges
There is a way that is called "Software serial" or "Soft UART".
The project https://github.com/adrianomarto/soft_uart is doing precisely what you are looking for, you can install the
soft_uart and use any GPIO as Rx/Tx.
Software-based serial port module for Raspberry Pi.
This module creates a software-based serial port using a configurable
pair of GPIO pins. The serial port will appear as
- Works exactly as a hardware-based serial port.
- Works with any application, e.g. cat, echo, minicom.
- Configurable baud rate.
- TX buffer of 256 bytes.
- RX buffer managed by the kernel.
answered Oct 7, 2019 at 17:39
2,61533 gold badges1414 silver badges2020 bronze badges
You could a USB to serial converter. That would let you connect the USB end to the Pi and the serial TX/RX/Ground end to the serial device.
You can use (my) pigpio to bit bang a serial link on any spare GPIO.
As long as the baud rate is 19k2 or less it should be fine.
For Python the read is straightforward. Writing requires waves and needs more effort.
answered Oct 7, 2019 at 16:47
69.3k55 gold badges6969 silver badges104104 bronze badges