UART over USB for Raspberry Pi

Out of the box connecting the RVR to a Raspberry Pi requires connecting both the USB cable (for power) and the UART pins to the Pi’s GPIO for communication. Communication over USB is possible, however, since the RVR is able to communicate with Arduino Unos with just the USB cable.

What hardware would I need to power and communicate with a Raspberry Pi with just a USB cable?

AFAICT Arduino Unos use custom firmware on an ATmega8U2 for converting the usual 2 wire TXD, RXD <> USB’s D+, D- (No idea what protocol is used on the USB side. Is there some standard?). Is there a standalone board that provides this functionality? Or will any FTDI/CP210x/PL2303 board work? Maybe Adafruit’s PiUART ?

For context, I have a Picon Zero “HAT” ( that doesn’t expose the Pi’s UART pins so I’m looking for alternatives. Currently I’m stacking it on top of a Perma-proto HAT to get access to those pins, but it would be nice not to have to plug in two cables at all.

Super-long term it would be neat to create my own PCB based on the Picon Zero (without the motor driver stuff) that includes this ability (single USB for power & UART).


Hello @c13,

As far as I understand, it is not possible for any device to communicate with the Rapsberry Pi through the USB power port. The data pins on that port are disconnected.

RVR is capable of communicating with Arduino through the USB, but we have not tried it with the Raspberry Pi. There might be a way to design a cable that splits the USB pins to 2 USB ports, but we cannot recommend you do that as you risk damaging both the RVR and the Raspberry Pi.

I hope this helps,


1 Like

Correct, any solution would not be able to use the USB port on the Pi itself. My request was for recommendations for additional hardware (a HAT or something) with its own USB port that would provide power to the Pi via the 5v GPIO pins as well as provide UART to pins 14 and 15. I’ll probably give the mentioned Adafruit PiUART a try, especially since it’s open source and so could be integrated into a custom PCB.

1 Like

@c13 It looks like the PiUART uses a CP2104 for the USB interface. That is not tested with RVR, but may work if our USB stack happens to already support it. I’ve actually got a CP2102* breakout on order for internal testing, but if you beat me to it, please let us know your findings. Currently, we have only verified Arduino Uno and Micro:bit for USB to serial functionality.


*Edit: I originally stated I’ll be testing CP2104, it’s actually a CP2102, which is at least similar.

1 Like

Did your CP2102 arrive and were you able to check whether it works with RVR? I decided to hold off buying one myself to see if yours works first :slight_smile:

1 Like

Hi @c13, sorry for the delay in getting back to you, this task had gotten deprioritized in the backlog. I just tried the CP2102 and it did not work. It seems that the CP2102, like FTDI USB-serial converters, requires a custom driver. The ATMega16U2 USB-serial implementation found on some Arduino boards, by contrast, uses a standard USB CDC implementation and works by default with our USB stack.

Atmel has an app note with example code about using ATMega USB MCUs to implement USB-serial interfaces. A small native-USB Arduino or other breakout board could be a useful platform for trying this out. I’d personally like to find or develop a really tiny USB-serial board that is RVR-compatible, but won’t have the time in the foreseeable future.

A completely off-the-shelf solution would be something like this:, but unfortunately it’s retired.

If you’re just looking for something that’ll work in a pinch, you could take an Arduino Uno, run a jumper from GND to RESET to hold the ATMega328P in reset, and then connect the Pi UART to the Uno UART pins (TX to TX, RX to RX). You would also need to use level shifting, since the Pi UART operates at 3.3V and the Uno UART operates at 5V. I’ve used this approach to connect a Sparkfun Redboard to a RVR.


1 Like

Thanks for the great tips! I went partially down the road of making my own HAT with an ATMega16U4 on it that could provide power & UART to the Pi from a single USB plugged into it (would also be useful for adding analog inputs, etc. like the PiconZero), but then decided to instead give the Pi 4 a try since its USB-C port’s data lines are connected, like the Pi Zero, and can be access using the g_serial module.

Unfortunately, even though I was able to enable dwc2 & g_serial and even was able to send text back and forth from my PC through /dev/ttyGS0, I haven’t been able to get it to connect to the RVR. I tried setting the port_id to /dev/ttyGS0 in the python API (example) – no luck.

Then I sniffed while the API was executing, got a few command strings in hex, and tried echo-ing them directly to /dev/ttyGS0 (doing so worked fine via /dev/ttyS0 using regular wires) – still no luck.

I even tried setting my vendor ID, product ID, and bcdDevice (aka Revision) to impersonate an Arduino Uno just in case the RVR had a whitelist for those specific IDs – no luck. (I verified it worked by uninstalling Arduino’s custom driver on my PC and checking that both my Pi and Arduino now showed up identically to Windows as “USB Serial Device”, whereas previously the pi was identified as a Pi Serial Device or something like that).

Any ideas why this isn’t working? Does this require changes to the RVR’s USB stack? Surely there must be some way in software (hopefully not a new kernel module?) for the Pi to emulate the Uno’s CDC implementation exactly?

As far as I can tell, both the Pi’s g_serial module and the Arduino follow the USB CDC ACM standard, but I can’t pretend to understand it fully – is there wiggle room in the spec leading to differences in implementation? (Just in case I also tried g_serial with use_acm off, which uses a Linux-only implementation instead of the ACM standard, still no luck).

1 Like

Hmm…there’s definitely no white-list. How long is the cable you’re using? RVR has somewhat aggressive protection on the USB data lines, which seems to cause issues with certain longer cables. If you have a short (30 cm or less) cable you can try with the Pi 4, that would be worth a shot. I’m definitely not a USB expert, and haven’t spent any time with the CDC standard to know whether any parts of it are implementation-specific.

1 Like

Forgot to mention I found a blog post setting up the Pi as a compute device using g_serial where they set a lot more parameters (like bDeviceClass, subclass, and protocol, USB version, etc.) – do they all need to match the Uno?

1 Like

Sorry for the delay in responding! The cable I’m using is around 2 feet long, so I suppose that could be the problem. Just ordered a shorter one to give it a try.

1 Like

That was it! Got a shorter USB-A to USB-C cable in the mail and it works now! Thank you!

1 Like
SPHERO Email Marketing -