Add GPIOs to Windows, Linux, Android Computers and Devices with FTDI USB Adapters / Breakout Boards

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.

oneping_op1010
Oneping OP1010 Breakout Board

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:


and change the values as follows to confirm it’s working:


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.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
20 Comments
oldest
newest
Alan
Alan
9 years ago

You know what would be great? A cheap China phone that exposes extra IO pins.

zooba
9 years ago

This FTDI breakout board is way cheaper and Electrodragon ships from Antwerp:

http://www.electrodragon.com/product/ftdi-serial-adapter-for-arduino-avr-pic-etc/

I am waiting for my package, will update the page when I have it.

Johny007
Johny007
9 years ago

@zooba
Are you sure about Antwerps? I think they use the same model as eud.dx.com. Ship from china using Netherlands post. It still takes a lot of time to deliver.

iamfrankenstein[nl]
iamfrankenstein[nl]
9 years ago

@Alan, maybe the android FTDI kit is something for you. http://www.ftdichip.com/Android.htm

I have used a FTDI kit like the zooba linked to (bought from ebay shipped to the Netherlands) to build a Nixie clock on Openwrt with C. Works great, AFTER you replace the default time daemon selected for the wr703n by Openwrt.
For hardware I used simple 3 stage shift registers (74HC595) with K155NA1 (nixie drivers) and the wr703n.

https://www.dropbox.com/s/7ynhhap0f4qt8sq/2014-10-20%2018.35.32.jpg?dl=0

zoobab
9 years ago

@Johny007
See this comment: http://hackaday.com/2014/08/26/new-chip-alert-the-esp8266-wifi-module-its-5/#comment-1760842

I live in Belgium, received a parcel from electrodragon last week, but it looks like it was sent from HK. I will triple check back home.

Sander
Sander
9 years ago

FWIW: I’m now using the builtin GPIO’s of my Raspberry. Super easy. No kernel patching, just a few lines of Python … great.

zoobab
9 years ago

@zoobab
It looks like Electrodragon is doing the same as Eu-dx. The package was shipped via air priority to a postbox in BE, which is then reshipped via the belgian post.

anon
anon
9 years ago

Those pretty much standard FTDI FT2232H/FT4232H mini modules seem to be most trouble free, and there is native mainline support on Linux kernel since… Dunno, years.

And the libftdi is available for virtually all Linux distros, very easy, and simple, to integrate to any kind of app.

Bitbanging is hitting the wall around 600kbps though.

Alan
Alan
9 years ago

@iamfrankenstein[nl]
awesome! thank you for the link.

zooba
9 years ago

@anon
Sysfs is slow, yeah, but for some usage it is good enough (toggling some pins on the shell, or in a shell script). There are some applications which supports sysfs (avrdude, urjtag, openocd, etc…).

If there is a standard interface for fast bitbanging in kernel space and which does not require to integrate your own code with a libary, I am all for it, but at the moment, it is not there.

Openocd has for example some code for the PI to use memory-mapped gpios, but this is not what I would call a standard way to access GPIOs.

anon
anon
9 years ago

@zooba
Creating an kernelspace state machine for bitbanging could accelerate it quite a bit, but as is pretty ugly niche thing, I bet it would never be integrated into mainline Linux… Maybe some FreeRTOS/L4 kernel could handle that, but no idea is there any interest for such thing there either.

Al
Al
9 years ago

What ever you do don’t use the latest ftdi drivers either direct from them or windows update.

They’ll brick clone devices including arduino clones

http://hackaday.com/2014/10/22/watch-that-windows-update-ftdi-drivers-are-killing-fake-chips/
http://arstechnica.com/information-technology/2014/10/windows-update-drivers-bricking-usb-serial-chips-beloved-of-hardware-hackers/

That includes anything with a serial interface.

anon
anon
9 years ago

@Al
Bricking unauthorized/illegal chip clones is a bad thing?

zooba
9 years ago


Yet another reason not to use Windows and closed-source drivers. The sysfs patch was possible because the driver is open. And those kind of nasty hostile drivers are not possible (at least the community will have an opportunity to reject them) in the free software world.

zooba
9 years ago


Where is that patch?

Khadas VIM4 SBC