Welcome to RPIO’s documentation!

RPIO is an advanced GPIO module for the Raspberry Pi.

  • PWM via DMA (up to 1µs resolution)
  • GPIO input and output (drop-in replacement for RPi.GPIO)
  • GPIO interrupts (callbacks when events occur on input gpios)
  • TCP socket interrupts (callbacks when tcp socket clients send data)
  • Command-line tools rpio and rpio-curses
  • Well documented, fast source code with minimal CPU usage
  • Open source (LGPLv3+)

RPIO consists of two main components:

  • RPIO – Python modules which you can import in Python 2 or 3 with import RPIO, import RPIO.PWM, etc.
  • rpio – command-line tools for inspecting and manipulating GPIOs system-wide.



The easiest way to install/update RPIO on a Raspberry Pi is with either easy_install or pip:

$ sudo apt-get install python-setuptools
$ sudo easy_install -U RPIO

You can also get RPIO from Github repository, which is usually a step ahead of pypi:

$ git clone https://github.com/metachris/RPIO.git
$ cd RPIO
$ sudo python setup.py install

Or from Github but without Git:

$ curl -L https://github.com/metachris/RPIO/archive/master.tar.gz | tar -xz
$ cd RPIO-master
$ sudo python setup.py install

Debian packages are available at metachris.github.com/rpio/download.

After the installation you can use import RPIO as well as the command-line tool rpio.


You can find lots of examples inside the documentation, as well as in the /examples/ source directory.


Please send feedback and ideas to chris@linuxuser.at, and open an issue at Github if you’ve encountered a bug.


  • v0.10.0
    • Auto-cleanup on exit (also shuts down wait_for_interrupts(threaded=True))
    • Bugfix in cpuinfo.c: correctly trim over-voltage header
    • rpio-curses: help shows raspberry sysinfo
    • switched argument ordering of wait_for_interrupts to (wait_for_interrupts(threaded=False, epoll_timeout=1))
    • Added RPIO.Exceptions (list of C GPIO exceptions)
  • v0.9.6
    • Added debounce_timeout_ms argument to RPIO.add_interrupt_callback(..)
    • Added threaded argument to RPIO.wait_for_interrupts(..)
    • Interrupt callbacks now receive integer values 0 or 1 instead of strings
    • Interrupt callbacks with edge=``rising`` or falling only receive the correct values
    • Added RPIO.close_tcp_client(fileno)
    • Debian .deb package builds
    • License changed to GNU Lesser General Public License v3 or later (LGPLv3+)
    • Improved detection in cpuinfo.c
  • v0.9.1
    • PWM
    • rpio-curses quits gracefully if terminal too small
  • v0.8.5
    • Debug-options for rpio-curses: You can now run it on any Linux/OSX machine with rpio-curses dev
  • v0.8.4
    • rpio-curses
    • Bugfix in RPIO: tcp callbacks (first parameter socket works now)
    • Renamed RPIO.rpi_sysinfo() to RPIO.sysinfo
  • v0.8.3: pypi release update with updated documentation and bits of refactoring
  • v0.8.2
    • Added TCP socket callbacks
    • RPIO does not auto-clean interfaces on exceptions anymore, but will auto-clean them as needed. This means you should now call RPIO.cleanup_interrupts() to properly close the sockets and unexport the interfaces.
    • Renamed RPIO.rpi_sysinfo() to RPIO.sysinfo()
  • v0.8.0
    • Improved auto-cleaning of interrupt interfaces
    • BOARD numbering scheme support for interrupts
    • Support for software pullup and -down resistor with interrupts
    • New method RPIO.set_pullupdn(..)
    • rpio now supports P5 header gpios (28, 29, 30, 31) (only in BCM mode)
    • Tests added in source/run_tests.py and fabfile.py
    • Major refactoring of C GPIO code
    • Various minor updates and fixes
  • v0.7.1
    • Refactoring and cleanup of c_gpio
    • Added new constants and methods (see documentation above)
    • Bugfixes
      • wait_for_interrupts() now auto-cleans interfaces when an exception occurs. Before you needed to call RPIO.cleanup() manually.
  • v0.6.4
    • Python 3 bugfix in rpio
    • Various minor updates

Table Of Contents

Next topic

rpio, the command line tools

This Page