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

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 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.

  1. Alan
    October 20th, 2014 at 18:10 | #1

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

  2. October 20th, 2014 at 19:09 | #2

    Maybe this $4 board based on FT232RL would also do: http://www.aliexpress.com/item/Free-shipping-1pcs-FT232RL-FTDI-USB-3-3V-5-5V-to-TTL-Serial-Adapter-Module-for/1902980198.html

    There’s also another PL2303-HDX board with explicit GPIO support, sold on a Vietnamese website for about $5: http://www.tme.vn/Product.aspx?id=1734#page=pro_info

  3. October 20th, 2014 at 19:18 | #3

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


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

  4. Johny007
    October 20th, 2014 at 23:18 | #4

    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.

  5. iamfrankenstein[nl]
    October 20th, 2014 at 23:47 | #5

    @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.


  6. October 20th, 2014 at 23:58 | #6

    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.

  7. Sander
    October 21st, 2014 at 00:58 | #7

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

  8. October 21st, 2014 at 03:02 | #8

    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.

  9. anon
    October 21st, 2014 at 04:05 | #9

    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.

  10. Alan
    October 21st, 2014 at 14:37 | #10

    awesome! thank you for the link.

  11. October 21st, 2014 at 15:53 | #11

    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.

  12. anon
    October 21st, 2014 at 17:09 | #12

    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.

  13. Al
    October 23rd, 2014 at 12:16 | #13

    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


    That includes anything with a serial interface.

  14. Al
  15. anon
    October 23rd, 2014 at 12:50 | #15

    Bricking unauthorized/illegal chip clones is a bad thing?

  16. October 23rd, 2014 at 14:08 | #16

    Just as a note, there’s a new patch to keep these bricked devices working in Linux.

  17. October 23rd, 2014 at 15:10 | #17

    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.

  18. October 24th, 2014 at 16:49 | #18

    Where is that patch?

  19. October 24th, 2014 at 16:56 | #19

    Oops sorry, I forgot to include the link….

  1. October 21st, 2014 at 15:50 | #1