Skip to content

Software

Adafruit Blinka

By Adafruit Industries, United States (checked on github.com/adafruit (opens in a new tab)), from github.com/adafruit/Adafruit_Blinka (opens in a new tab)

  • Microcontrollers and firmware tools
  • Library
  • MIT

A library that emulates the CircuitPython API so code written for CircuitPython can run on CPython or MicroPython hosts such as Raspberry Pi boards.

Facts

GitHub stars
542read on 27 Nov 2026
Last update
24 Nov 2026Newest commit on main
Maintenance
Activea commit in the last 90 days
Difficulty
Beginner

Checked on GitHub on 27 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 6ac1948 (opens in a new tab), on 27 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Provides CircuitPython-style modules such as digitalio, analogio, busio, pwmio, and keypad on host computers.
  • Offers a board module with breakout-specific pin names so example code can address pins by label.
  • Includes software and hardware I2C and SPI interfaces, plus UART support through busio.
  • On Raspberry Pi, digital GPIO uses the gpiod bindings and PWM uses separate Adafruit PWM backends.
  • Software PWM accepts 1 to 10000 Hz, with timing and jitter depending on Linux scheduling.
  • Installable from PyPI with pip, including into a virtual environment.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
Used by Ball-Balancing Robot.
Licence
MIT. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's website (opens in a new tab)
Maintenance
Active, last commit on 24 Nov 2026.

Works with

1 robot on Robotheca

The robots on Robotheca that use it or can run it, each with how the link was found.

Use it

How to install it, in the creator's words: The project's website (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 6ac1948

Robotheca read the repository at two versions: the summary at 6021fc9 and the facts and the README at 6ac1948 (read on 27 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.rst by Adafruit Industries, at commit 6ac1948, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

Introduction

.. image:: https://readthedocs.org/projects/adafruit-micropython-blinka/badge/?version=latest (opens in a new tab) :target: https://circuitpython.readthedocs.io/projects/blinka/en/latest/ (opens in a new tab) :alt: Documentation Status

.. image:: https://img.shields.io/discord/327254708534116352.svg (opens in a new tab) :target: https://adafru.it/discord (opens in a new tab) :alt: Discord

.. image:: https://github.com/adafruit/Adafruit_Blinka/actions/workflows/build.yml/badge.svg (opens in a new tab) :target: https://github.com/adafruit/Adafruit_Blinka/actions/workflows/build.yml (opens in a new tab) :alt: Build Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg (opens in a new tab) :target: https://github.com/psf/black (opens in a new tab) :alt: Code Style: Black

This repository contains a selection of packages emulating the CircuitPython API for devices or hosts running CPython or MicroPython. Working code exists to emulate these CircuitPython packages:

  • analogio - analog input/output pins, using pin identities from board+microcontroller packages
  • bitbangio - software-driven interfaces for I2C, SPI
  • board - breakout-specific pin identities
  • busio - hardware-driven interfaces for I2C, SPI, UART
  • digitalio - digital input/output pins, using pin identities from board+microcontroller packages
  • keypad - support for scanning keys and key matrices
  • microcontroller - chip-specific pin identities
  • micropython - MicroPython-specific module
  • neopixel_write - low-level interface to NeoPixels
  • pulseio - contains classes that provide access to basic pulse IO (PWM)
  • pwmio - contains classes that provide access to basic pulse IO (PWM)
  • rainbowio - provides the colorwheel() function
  • usb_hid - act as a hid-device using usb_gadget kernel driver

For details, see the Blinka API reference <https://circuitpython.readthedocs.io/projects/blinka/en/latest/index.html>_.

Dependencies

The emulation described above is intended to provide a CircuitPython-like API for devices which are running CPython or Micropython. Since corresponding packages should be built-in to any standard CircuitPython image, they have no value on a device already running CircuitPython and would likely conflict in unhappy ways.

The test suites in the test/src folder under testing.universal are by design intended to run on either CircuitPython or CPython/Micropython+compatibility layer to prove conformance.

Blinka installs a platform-independent base package. On CPython, importing board checks required dependencies for the detected Raspberry Pi, Jetson, or AM33XX platform. In an interactive terminal, Blinka offers to install missing or incompatible required packages with the running Python interpreter. Other boards retain their existing backend selection and manual dependency setup.

Non-interactive programs never prompt or run pip. A missing required backend reports installation guidance when imported; a known incompatible version reports an actionable error rather than silently continuing. After installation, Blinka rechecks imports and versions and reports restart guidance if an upgraded module was already loaded or if the required backend is still unavailable (for example, after the first user-site installation).

Optional Raspberry Pi PWM and NeoPixel backends are not checked or installed when importing board. Creating a PWMOut or importing neopixel_write checks its optional backend and shows manual setup guidance if it is missing or incompatible. Restart Python after installing or updating a backend manually.

Use a virtual environment where practical. The runtime installer does not use sudo, bypass externally managed environment protections, install OS packages, or change GPIO permissions. Native packages may still need a compiler and Python development headers provided by the operating system.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, install from PyPI <https://pypi.org/project/Adafruit-Blinka/>_ in a virtual environment:

.. code-block:: shell

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install Adafruit-Blinka

For MCP2222 setup and backend details, see the implementation notes <https://docs.circuitpython.org/projects/blinka/en/latest/implementation_notes.html>_.

Environments created with uv

By default, uv venv does not install pip into the environment. Blinka's automatic installer requires pip; it does not install pip or run uv for you. If pip has no runnable entry point, a confirmed installation reports manual recovery guidance without launching an installer.

Use uv to install the required backends into the same environment. For Raspberry Pi GPIO, for example:

.. code-block:: shell

uv venv .env
uv pip install --python .env/bin/python Adafruit-Blinka 'gpiod>=2.2.2,<3'

Add the PWM or NeoPixel backend if needed, and run your program with .env/bin/python. Manual recovery commands use the running interpreter's path so an unrelated active environment is not selected. After installing dependencies while Python is running, restart it before trying again. See uv's Python environment documentation <https://docs.astral.sh/uv/pip/environments/#using-arbitrary-python-environments>_. For pip-backed interactive installation, create the environment with uv venv --seed .env instead.

Services and managed environments

Install the backends your program needs before starting a service, cron job, or other non-interactive program. For Raspberry Pi digital GPIO, for example:

.. code-block:: shell

.env/bin/python -m pip install Adafruit-Blinka 'gpiod>=2.2.2,<3'

If the program also uses PWM, install its backend during setup:

.. code-block:: shell

.env/bin/python -m pip install 'Adafruit-Blinka-Raspberry-Pi-PWM>=1.0.2'

Run the service with that same environment's Python. A virtual environment using --system-site-packages can see OS packages, but those packages must still meet the required versions. Blinka does not bypass externally managed system Python protections.

For Raspberry Pi GPIO, Blinka also accepts Debian-style python3-libgpiod bindings labelled 2.2.0 when they come from maintained libgpiod source >=2.2.1,<3 and report a native API version in that range. Trixie's package uses this older Python label despite containing later fixes. In a virtual environment created with --system-site-packages, Blinka checks that the selected binding and metadata paths belong to the installed system package. Security-update revisions are not pinned, and importing gpiod before board works normally. Package-manager queries are cached per process.

This trusts the system administrator and package database; it is not a file integrity monitor. Restart Python after package upgrades rather than reloading native modules. Ordinary PyPI installs retain the conservative gpiod>=2.2.2,<3 baseline: old PyPI 2.2.0 has a native use-after-free during line requests, which a check for available API functions cannot detect. See the upstream fix <https://github.com/brgl/libgpiod/commit/c497e29ca1f88963c525351e60af23ed896a2b8c>_.

For an application that manages its own dependencies, set BLINKA_SKIP_DEPENDENCY_CHECK=1 before importing board to disable its automatic dependency checks and installation prompts:

.. code-block:: shell

BLINKA_SKIP_DEPENDENCY_CHECK=1 .env/bin/python program.py

This does not install packages or make unsupported backends supported. Missing backend imports and PWM/NeoPixel feature checks still report errors.

Application settings

On CPython, Blinka can read settings.toml from your application's working directory. Put application settings at the top level of the file.

.. code-block:: toml

APP_BRIGHTNESS = 0.5

.. code-block:: python

from adafruit_blinka import get_setting

brightness = float(get_setting("APP_BRIGHTNESS"))

A missing setting raises KeyError.

  • Values from the file keep their TOML types. An environment variable with the same name takes precedence and returns a string. Calling load_settings_toml() exports scalar values as strings, so a later lookup for the same key can return a different type. Convert settings to the expected type before using them. For example, Python treats the string "False" as true in a Boolean test.
  • Blinka caches the file from the working directory of the first lookup that needs it. A missing file is cached as an empty dictionary, even if a file is created later. A successful call to load_settings_toml() rereads the file from the current working directory and refreshes the cache. Existing environment variables still take precedence.
  • Tables and lists returned by get_setting() are shared across modules. Treat them as read-only or copy them before making changes. load_settings_toml() accepts only scalar values for environment export and raises ValueError for tables and lists.

Installing on MicroPython

The root package.json installs Blinka's existing MicroPython subset directly from GitHub with mip <https://docs.micropython.org/en/latest/reference/packages.html>_. From a computer with the board connected, run:

.. code-block:: shell

mpremote mip install github:adafruit/Adafruit_Blinka

On firmware that includes mip and has a working network connection, you can instead install from the MicroPython REPL:

.. code-block:: python

import mip
mip.install("github:adafruit/Adafruit_Blinka")

Restart the board after installing. To select a release or branch, append @TAG_OR_BRANCH to the mpremote URL, or pass version="TAG_OR_BRANCH" to mip.install. Choose a ref containing package.json; older releases do not have this manifest. Installation needs network access to GitHub on the computer (mpremote) or board (mip). This is not a PyPI install or a short-name package in the default MicroPython package index.

The manifest includes board, microcontroller, digitalio, busio, bitbangio, and rainbowio, plus the existing Pico-family, Pyboard, and ESP8266 board routes. It installs only the required PlatformDetect source files, pinned to release 3.89.1, and their licenses. Linux drivers, native binaries, pip dependencies, and the CPython micropython shim are not installed. The installed file contents total about 190 KiB, plus filesystem overhead. When updating PlatformDetect, update all its manifest URLs together to the new release's commit; absolute pinned URLs keep Blinka branch/tag installs from accidentally selecting the same ref in another repository.

This packages existing backends, not new hardware or API support. Not every CircuitPython module is implemented on MicroPython, and existing backend/firmware limitations still apply. In particular, the legacy ESP8266 backend's TOUT pin initialization is incompatible with current MicroPython firmware. Source compilation also requires RAM in addition to filesystem space; small boards such as ESP8266 may not have enough. Install CircuitPython libraries needed by your application separately, and verify compatibility on your board. Do not install Blinka on CircuitPython itself.

Raspberry Pi GPIO and PWM

Raspberry Pi digital GPIO uses the official gpiod bindings. pwmio.PWMOut uses Adafruit Blinka Raspberry Pi PWM <https://github.com/adafruit/Adafruit_Blinka_Raspberry_Pi_PWM>_ on Pi 5 and earlier models. Configured BCM/RP1 hardware PWM is preferred on verified pin routes; other pins use native software PWM. This does not use PIO or change boot overlays. Runtime checks select gpiod>=2.2.2,<3 and Adafruit-Blinka-Raspberry-Pi-PWM>=1.0.2 only for Raspberry Pi boards, rather than installing them on every Linux ARM host. These Pi backends require Linux 5.10 or newer. NeoPixel support retains its separate dependencies.

Software PWM accepts 1--10000 Hz, with Linux scheduling affecting timing and jitter. Configured hardware limits depend on its controller and driver, and updates are not guaranteed glitch-free. Hardware channels require separate kernel/overlay configuration and sysfs permissions. See the package's usage guide <https://github.com/adafruit/Adafruit_Blinka_Raspberry_Pi_PWM/blob/main/docs/usage.rst>_ for setup and cleanup limitations; verify the waveform before connecting an actuator. NeoPixel support continues to use its existing separate backends.

Usage Example

The pin names may vary by board, so you may need to change the pin names in the code. This example runs on the Raspberry Pi boards to blink an LED connected to GPIO 18 (Pin 12):

.. code-block:: python

import time
import board
import digitalio

PIN = board.D18

print("hello blinky!")

led = digitalio.DigitalInOut(PIN)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

Contributing

Contributions are welcome! Please read our Code of Conduct <https://github.com/adafruit/Adafruit_Blinka/blob/master/CODE_OF_CONDUCT.md>_ before contributing to help this project stay welcoming.

Building locally

Sphinx documentation

Sphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):

.. code-block:: shell

python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme Adafruit-PlatformDetect

Now, once you have the virtual environment activated:

.. code-block:: shell

cd docs
sphinx-build -E -W -b html . _build/html

This will output the documentation to docs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.