Pi Zero as a universal USB stick
Connected
The default settings in /etc/raspi2go.conf
let the Pi Zero assume three roles: It advertises itself as a USB drive, USB Ethernet adapter, and serial USB adapter. Depending on the host settings, a Windows or Linux system then mounts the drive automatically.
It wouldn't make much sense to go through all this trouble for a normal USB stick, but functioning as a USB drive is ideal for installing drivers and application software. For example, Windows needs a suitable program to access the serial port, and it would be possible to provide Putty on the emulated drive of the Pi Zero. This procedure is familiar from commercial UMTS/LTE sticks: When first plugged in, they register as a CD drive with the driver software. After installing the driver, Windows then identifies the stick as a WiFi dongle.
Physically, the mass storage emulated by the Pi Zero is an image file. Do not access it simultaneously on the host and Raspberry Pi – it is not a network drive. However, the Pi Zero can also serve up this kind of drive by NFS or Samba, because it plays the role of an Ethernet adapter with two ends.
Mini-Network
A normal USB Ethernet adapter has a USB plug on one side and a socket for a network cable on the other. The wire usually leads to a router or switch but could also be plugged directly into another computer. The Pi Zero as a network gadget does exactly that – the only difference being that the cable only exists virtually and the computer on the other side is the Zero itself.
Windows and Linux detect the adapter as a network interface. For communication with the Pi Zero to work, both computers need to have addresses on the same subnet. The easiest way to do this is to use Zeroconf/Avahi. If the service is running on both sides, the participating computers negotiate the technical parameters independently; otherwise, manual configuration will do the trick. Simply assign both computers a fixed IP address in your address range.
Once configured, both devices form a mini-network, and you can launch servers (e.g., a storage or web server) on the Pi Zero and make them available to the host. The transfer rates are in the Fast Ethernet range; depending on the direction, iperf
indicates 80-120Mbps as throughput.
Consoles and More
In the third emulation, the Pi Zero pretends to be a serial interface. If the Raspberry Pi starts a virtual console on the port (the raspi2go.sh
script does this automatically), you can access the Raspberry Pi on the host with a terminal emulator (Putty on Windows; Screen or Tio on Linux), which is especially useful if the network configuration is not working correctly.
Another possible application is the simulation of sensor data (for sensors with a UART interface). In this case, a program on the Pi Zero simulates the data and sends it to the host over the serial interface. This scenario is ideal for software development because it not only makes it very easy to process data, but also avoid errors.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.