news raspberry pi foundation builds a bridge between pcs and gpio pins
News

Raspberry Pi Foundation builds a bridge between PCs and GPIO pins

The Raspberry Pi and its ilk generally lack the computing horsepower of a modern desktop or laptop computer, but one area where they excel is in physical computing, or interacting with a wide range of devices that control things in the real world. Typical PCs lack general-purpose input-output (GPIO) interfaces, and when they exist, the documentation is typically very poor.

To make the best of both worlds, the Raspberry Pi Foundation has now come up with a tool called the GPIO expander to shuttle data from a powerful computer into and out of the real world using a Raspberry Pi Zero's GPIO pins. This tool lets the Pi serve as a sort of bridge between its GPIO pins and potentially much more powerful and complex software running on an x86 PC. Applications for computers using GPIO pins include toggling relays, checking the status of external circuits, and interfacing with sensors of multiple types like temperature, humidity, motion, and distance.

At the end of last year, the Pi Foundation ported its Raspbian Pixel development OS over to x86 PCs. Pixel got ease-of-use improvements in the intervening months, and the GPIO expander software is only its latest trick. The expander will allow developers to use a PC to access the GPIO pins of an attached Pi Zero using the visual programming language Scratch or a Python library.


The Pi Zero can behave in multiple ways when attached to a host PC

The GPIO expander works by booting an attached Pi Zero from software stored on the host PC. In this configuration, the Pi Zero runs a minimal version of Raspbian and presents a USB Ethernet interface that the host PC can use to reach the GPIO pins. A Raspberry Pi running Raspbian can also serve as the USB host. The Pi Foundation says that when using multiple Pi Zero servants, a single Pi could possibly control up to 140 GPIO pins, a big increase from the usual 40. This developers haven't actually tried this multi-Pi approach, though, so tread carefully.

[email protected]:~ $ export GPIOZERO_PIN_FACTORY=pigpio
[email protected]:~ $ export PIGPIO_ADDR=fe80::1%usb0
[email protected]:~ $ python3
>>> from gpiozero import LED
>>> led = LED(17)
>>> led.blink()

Example code to blink an LED attached to a USB-attached Raspberry Pi Zero

The GPIO expander software only works in the Pi Foundation's Debian-based releases of Pixel so far. Hopefully developers will port the capability to Ubuntu-based distributions in the near future, including Windows 10's Linux subsystem. For now, physical computing users will still need to resort to devices like the Bus Pirate in order to use GPIO pins on more common PC operating systems. For those interested in more information, the Pi Foundation's blog post has some interesting information about the new tool and its development.

0 responses to “Raspberry Pi Foundation builds a bridge between PCs and GPIO pins

  1. You can also buy the Pi Zero in stores. I buy them at Micro Center. They do limit you to one per type per day (or paying very, very bloated prices that start at double and continue to multiply with higher quantities), but that just means I take friends and we each buy one of each type to amass a small army in one trip. But it’s certainly not a convenient option for everyone, I realize.

  2. The point was, you don’t need to spend $35 to use it.

    Does the Arduino you were comparing it against come with free shipping? If not, then bitching about the shipping cost is silly.

    I agree limit 1 could be annoying if you have a project where you need multiple of them.

    Not sure why you seem so determined to hate the RPi.

  3. Oh, where can I order some? I’d like several.

    What? I can only order one and shipping is $10? Hmm $15 doesn’t sound that appealing.

    Also, the article doen’t just apply to the Zero, it also applies to the first generation A and B models.

  4. The reason you don’ t see an Rpi version of the Firmata target firmware is because it’s silly to use a $35 board when you can use a $4 one.

    Also, the Rpi boards are 3.3V I/O while the cheaper Arduinos are a more useful 5V.

  5. Well, for starters that does not let you boot the embedded device from the PC; it looks like this RPi thing requires no software installation on the RPi itself (it boots from the host over USB).

    Secondly, I don’t see a RPi version of Firmata, it appears to be Arduino-only. I did find a page that shows how to control an Arduino [i<]from[/i<] a RPi, using Firmata.

  6. Why reinvent something? There’s been [url<]http://www.firmata.org/wiki/Main_Page[/url<] for a long time.