Adding Serial to USB - iot-root/garden-of-eden GitHub Wiki
Here are step-by-step instructions for adding soldering wires and connecting them to a serial-to-USB adapter on a Raspberry Pi Zero, followed by enabling serial communication on the Pi.
Materials Needed:
- Raspberry Pi Zero / Pi Zero 2
- Soldering iron and solder
- 3x jumper wires (female-to-male)
- Serial-to-USB adapter (with TX, RX, and GND pins)
- Heat shrink or electrical tape (optional, for wire insulation)
- Terminal access to Raspberry Pi (either direct or via SSH)
Step 1: Solder Wires to the Raspberry Pi Zero 2
-
Prepare the GPIO Header:
- If your Raspberry Pi Zero 2 doesn't have headers pre-soldered, you'll need to solder the headers onto the GPIO pins. The pins you'll need for serial communication are:
- Pin 6 (GND): Ground
- Pin 8 (TXD): Transmit data
- Pin 10 (RXD): Receive data
- If your Raspberry Pi Zero 2 doesn't have headers pre-soldered, you'll need to solder the headers onto the GPIO pins. The pins you'll need for serial communication are:
-
Solder the Wires:
- Solder one end of a wire to Pin 6 (GND), another wire to Pin 8 (TXD), and the last wire to Pin 10 (RXD). These are part of the GPIO header on the Raspberry Pi.
- Ensure that the solder joints are solid and that no excess solder causes a short circuit between adjacent pins.
-
Insulate the Connections (optional):
- If you wish, you can cover the soldered joints with heat shrink tubing or electrical tape for better insulation and to avoid short circuits.
Step 2: Connect the Serial-to-USB Adapter
-
Match the Connections:
- On your serial-to-USB adapter, you should find pins marked GND, TX, and RX.
- Connect the wires as follows:
- GND (Pin 6 on Pi) to GND on the serial-to-USB adapter.
- TXD (Pin 8 on Pi) to RX on the serial-to-USB adapter.
- RXD (Pin 10 on Pi) to TX on the serial-to-USB adapter.
Important: The TX on the Pi connects to the RX on the adapter, and the RX on the Pi connects to the TX on the adapter, since data transmission and reception work in reverse.
-
Plug the Serial-to-USB Adapter into a computer. The serial adapter will act as a bridge between the Raspberry Pi and your computer for serial communication.
Step 3: Enable Serial on the Raspberry Pi Zero 2
-
Access the Raspberry Pi:
- Boot the Raspberry Pi either with a monitor and keyboard or SSH into it if you can access the Pi over the network.
-
Run the Configuration Tool:
- Run the following command to open the Raspberry Pi configuration tool:
sudo raspi-config - Navigate to Interfacing Options.
- Select Serial.
- It will ask two questions:
- Disable the shell over the serial port? No.
- Enable the serial hardware? Yes.
- Save and exit the configuration tool.
- Run the following command to open the Raspberry Pi configuration tool:
-
Edit the
/boot/config.txtFile (optional, if the configuration didn't apply):- Open the
/boot/config.txtfile:sudo nano /boot/config.txt - Ensure the following lines are present to enable UART (serial communication):
enable_uart=1 - Save the file and exit (
Ctrl + X, thenYto save).
- Open the
-
Disable Serial Console:
- In some cases, you may need to ensure that the serial console isn't using the serial pins. Edit the
/boot/cmdline.txtfile:sudo nano /boot/cmdline.txt - Remove any references to
console=serial0,115200orconsole=ttyAMA0,115200. - Save and exit.
- In some cases, you may need to ensure that the serial console isn't using the serial pins. Edit the
-
Reboot the Raspberry Pi:
- After making these changes, reboot the Raspberry Pi:
sudo reboot
- After making these changes, reboot the Raspberry Pi:
Step 4: Test the Serial Connection
-
Install Minicom (if necessary):
- If you're connecting to the Raspberry Pi via serial on a Linux/macOS system, you can use a terminal program like
minicomorscreen. Install Minicom using the following command:sudo apt install minicom
- If you're connecting to the Raspberry Pi via serial on a Linux/macOS system, you can use a terminal program like
-
Use a Serial Communication Program:
- On your host computer, use a terminal program (like
minicom,screen, orPutty) to connect to the Raspberry Pi over the serial interface. - Set the baud rate to
115200and use the correct serial port (on Linux, it could be something like/dev/ttyUSB0).
Example command to start
minicom:minicom -b 115200 -o -D /dev/ttyUSB0Replace
/dev/ttyUSB0with the correct serial device for your system. - On your host computer, use a terminal program (like
You should now have a working serial connection between your computer and the Raspberry Pi Zero 2.
USB Serial adaptor
Solder wires to Pi Serial Pins
Route Wires through wire channel
Route Wires out Humidity Sensor Channel