Open source · free files
Ball-Balancing Robot
Other · Intermediate
- Score
- Buildability 81 out of 100
- Cost
- Not stated
Software
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)
A library that emulates the CircuitPython API so code written for CircuitPython can run on CPython or MicroPython hosts such as Raspberry Pi boards.
Checked on GitHub on 27 Nov 2026.
Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 6ac1948 (opens in a new tab), on 27 Nov 2026.
Robotheca's summary of the project's documents, not the creator's words.
The robots on Robotheca that use it or can run it, each with how the link was found.
Open source · free files
Other · Intermediate
Found by Robotheca in ballbot/requirements.txt (opens in a new tab)
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.
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 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).
.. 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:
For details, see the Blinka API reference <https://circuitpython.readthedocs.io/projects/blinka/en/latest/index.html>_.
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.
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>_.
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.
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.
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.
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.load_settings_toml() rereads the
file from the current working directory and refreshes the cache. Existing
environment variables still take precedence.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.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 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.
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)
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.
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.