It’s possible to to add GPIOs to your computer, (openWRT) router, or Android tablet using some FTDI USB dongles that expose I/Os. On operating systems based on Linux, including Android, you can use the GPIO sysfs interface (/sys/class/gpio) to easily control GPIOs from the command line, and in some cases Rx, Tx, CTS, .. pins can also be used as GPIOs. Zoobab has tried it with various FTDI USB adapters, and Oneping OP-1010 breakout board based on PL2303 HDX chip, and the results are mixed, but it could worth a try.

There are currently patchsets ([1] and [2]) awaiting acceptance to mainline kernel that will enable GPIO support for these USB devices, but in the meantime you need to patch the kernel yourself, and then enable the relevant options in the kernel config for example “USB_SERIAL_PL2303_GPIO” or “USB_SERIAL_FTDI_SIO_GPIO”. The first patch is for PL2303 chips, and the second for FT2xxx/FT4xxx chips, so it should work on most USB to serial debug board out there.
Then you can export the GPIOs (done with OP1010 board) from your Linux PC / board:
1 2 3 4 |
root@sabayon /sys/class/gpio [22]# echo 252 > export root@sabayon /sys/class/gpio [23]# echo 253 > export root@sabayon /sys/class/gpio [24]# echo 254 > export root@sabayon /sys/class/gpio [25]# echo 255 > export |
and change the values as follows to confirm it’s working:
1 2 |
root@sabayon /sys/class/gpio [22]# echo 1 > gpio255/value root@sabayon /sys/class/gpio [22]# echo 0 > gpio255/value |
Even if it is working with OP1010, some other boards do not work, as despite the GPIOs being detected, the values can’t be changed. Other boards that are known to work, at least partially, include JTAGkey Tiny, Arduino Duemilanove, Moderndevice BUB1, and MicroFTX.
You can also control GPIOs for PL2303HXD / EA / RA, from an OTG capable Android device with Prolific PL2303 USB-GPIO app, but apparently not all tablets will work properly, and zoobab finally tested it with Android-x86-4.4-r1 image successfully.
Oneping also provides a Windows app for OP1010, which is demonstrated in the video below. They talk in Chinese, but it’s still easy to understand how it all work even if you can’t understand a word.
I’ve been unable to find Oneping OP-1010 board online, and I’ve been told you need to contact them by email, pay by Paypal (around $10) to receive a sample. Anyway this can also be tested with other low cost FTDI adapters. There are also some other USB modules exposing GPIOs such as Sparkfun’s FT232RL breakout board, or a Numato board with 8 GPIOs and up to 6 analog inputs (share with GPIOs), but I’m not sure the latter support GPIO sysfs interface.

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress