Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Connect To A Raspberry Pi Zero With A PiUART Module

TwitterFacebookRedditLinkedInHacker News

As you’re probably well aware from my previous Raspberry Pi articles, I’m a hoarder. I have several Raspberry Pi Zero as well as the wireless edition and various attachments that go with them.

When I was first getting started with the original Pi Zero, I had a tough time trying to figure out how to connect to it. I mean, how do you connect to something that doesn’t have some kind of internet connect?

I had written two articles previously for connecting to a Raspberry Pi Zero. The first titled, Connect to a Raspberry Pi Zero with a USB Cable and SSH, demonstrated how to connect with nothing more than a USB cable. The second titled, Connect to a Raspberry Pi and Pi Zero with a USB to TTL Serial Cable, demonstrated using GPIO pins and a serial cable to connect.

We’re going to simplify the connection process by using a nifty PiUART module and eliminate any complicated wiring or software configurations.

If you’re not familiar, the PiUART is a product sold by Adafruit for roughly $6.00. It connects to the standard Raspberry Pi and Raspberry Pi Zero through the GPIO header.

PiUART on Raspberry Pi Zero

Once attached, you can both power the Raspberry Pi and connect to it as if you were using a serial connection. The catch here is that you of course need to have the GPIO header already attached, or know how to attach a GPIO header. I have no prior soldering experience, but was able to solder a Raspberry Pi GPIO header without issues.

Installing the UART Drivers

In most scenarios, your operating system, whether that be Mac, Windows, or Linux, won’t come with the necessary drivers to detect serial devices like the PiUART.

If you’re using a Mac, you can download and install the following driver:

SiLabs CP210X Driver

If you’re using Linux or Windows, I don’t have all the answers for you when it comes to drivers, but you can check out the SiLabs website for an appropriate version of the CP210X.

With the driver installed, you’re ready to connect.

Connecting to the Raspberry Pi or Raspberry Pi Zero with the PiUART

If you remember my previous article, we had to configure the Raspberry Pi for UART. I found that I didn’t need to do this when using the PiUART, only the TTL serial cable.

Going forward, remember that I’m on a Mac and your steps might be slightly different if you’re on a Linux or Windows computer.

Connect to your Raspberry Pi via the PiUART and wait a moment for it to start booting. You can validate that it is ready for a connection by executing the following:

ls -la /dev/cu*

You should see results similar to the following after executing the above command.

Raspberry Pi with PiUART Devices

The device you’re looking for is the cu.SLAB_USBtoUART from the list. If you were using a TTL serial cable, the device would be named something different.

If for some reason cu.SLAB_USBtoUART is not in the list, use common sense when choosing a match.

To establish a connection, execute the following:

screen /dev/cu.SLAB_USBtoUART 115200

The above command should connect to the device and show you all the output as if you were connected to it with a monitor or television.

Raspberry Pi with PiUART Login

If this is your first time connecting to the Raspberry Pi and you’re using Raspbian Linux, the username will be pi and the password will be raspberry. Seek the documentation if you’re using a different flavor of Linux.

Raspbian Terminal

At this point you should be able to use your Raspberry Pi as if you were connected to it via SSH or through an old fashioned mouse and keyboard with a monitor or television. If you need to disconnect, you’ll need to detach and then disconnect from the session. This can be done by pressing ctrl-a followed by the d key on your keyboard. Just note that detaching does not shutdown or restart the Raspberry Pi.

Conclusion

You just saw how to make use of an Adafruit PiUART module to connect to the various Raspberry Pi using the GPIO pins and a standard USB cable. This is an alternative to using a TTL serial cable or trying to SSH over USB.

If you’re running into issues, make sure that you’re using a sync and charge USB cable, not just a charge cable. I’ve made this mistake numerous times. I personally use USB cables from Anker and haven’t had issues since.

Nic Raboy

Nic Raboy

Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in C#, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Unity. Nic writes about his development experiences related to making web and mobile development easier to understand.