Awesome Open Source
Awesome Open Source

======== gpiozero

.. image:: :target: :alt: Source code on GitHub

.. image:: :target: :alt: Latest Version

.. image:: :target: :alt: Build Tests

.. image:: :target: :alt: Code Coverage

A simple interface to GPIO devices with Raspberry Pi.

Created by Ben Nuttall_ and Dave Jones_.

.. _Ben Nuttall: .. _Dave Jones:


Component interfaces are provided to allow a frictionless way to get started with physical computing:

.. code:: python

from gpiozero import LED
from time import sleep

led = LED(17)

while True:

With very little code, you can quickly get going connecting your components together:

.. code:: python

from gpiozero import LED, Button
from signal import pause

led = LED(17)
button = Button(3)

button.when_pressed = led.on
button.when_released =


You can advance to using the declarative paradigm along with provided to describe the behaviour of devices and their interactions:

.. code:: python

from gpiozero import LED, MotionSensor, LightSensor
from import booleanized, all_values
from signal import pause

garden = LED(17)
motion = MotionSensor(4)
light = LightSensor(5)

garden.source = all_values(booleanized(light, 0, 0.1), motion)


See the chapter on Source/Values_ for more information.

.. _Source/Values:

The library includes interfaces to many simple everyday components, as well as some more complex things like sensors, analogue-to-digital converters, full colour LEDs, robotics kits and more. See the Recipes_ chapter of the documentation for ideas on how to get started.

.. _Recipes:

Pin factories

GPIO Zero builds on a number of underlying pin libraries, including RPi.GPIO_ and pigpio, each with their own benefits. You can select a particular pin library to be used, either for the whole script or per-device, according to your needs. See the section on changing the pin factory.

.. _RPi.GPIO: .. _pigpio: .. _changing the pin factory:

A "mock pin" interface is also provided for testing purposes. Read more about this in the section on mock pins_.

.. _mock pins:


GPIO Zero is installed by default in the Raspbian desktop image, available from To install on Raspbian Lite or other operating systems, including for PCs using remote GPIO, see the Installing chapter.

.. .. _Installing:


Comprehensive documentation is available at Please refer to the Contributing_ and Development_ chapters in the documentation for information on contributing to the project.

.. _Contributing: .. _Development:


See the contributors page_ on GitHub for more info.

.. _contributors page:

Core developers:

  • Ben Nuttall_
  • Dave Jones_
  • Andrew Scheller_

Other contributors:

  • Alex Chan_
  • Alex Eames_
  • Barry Byford_
  • Carl Monk_
  • Claire Pollard_
  • Clare Macrae_
  • David Glaude_
  • Daniele Procida_
  • Delcio Torres_
  • Edward Betts_
  • Fatih Sarhan_
  • Ian Harcombe_
  • Jeevan M R_
  • Mahallon_
  • Maksim Levental_
  • Martchus_
  • Martin O'Hanlon_
  • Mike Kazantsev_
  • Phil Howard_
  • Philippe Muller_
  • Rick Ansell_
  • Russel Winder_
  • Ryan Walmsley_
  • Schelto van Doorn_
  • Sofiia Kosovan_
  • Steve Amor_
  • Stewart Adcock_
  • Thijs Triemstra_
  • Tim Golden_
  • Yisrael Dov Lebow_

.. _Alex Chan: .. _Alex Eames: .. _Andrew Scheller: .. _Barry Byford: .. _Carl Monk: .. _Claire Pollard: .. _Clare Macrae: .. _David Glaude: .. _Daniele Procida: .. _Delcio Torres: .. _Edward Betts: .. _Fatih Sarhan: .. _Ian Harcombe: .. _Jeevan M R: .. _Mahallon: .. _Maksim Levental: .. _Martchus: .. _Martin O'Hanlon: .. _Mike Kazantsev: .. _Phil Howard: .. _Philippe Muller: .. _Rick Ansell: .. _Russel Winder: .. _Ryan Walmsley: .. _Schelto van Doorn: .. _Sofiia Kosovan: .. _Steve Amor: .. _Stewart Adcock: .. _Thijs Triemstra: .. _Tim Golden: .. _Yisrael Dov Lebow:

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (49,827
raspberry-pi (587
education (267
raspberrypi (116
gpio (35

Find Open Source By Browsing 7,000 Topics Across 59 Categories