talira

CircuitPython

A Python implementation for teaching coding with microcontrollers

open sourceMITfree

Forked from MicroPython in 2016.

CircuitPython is Adafruit's beginner friendly, open source version of Python for microcontrollers, based on MicroPython. Most boards install it by drag and drop and then show up as a USB drive called CIRCUITPY: edit code.py there and the board reloads it, with no other software than a text editor. Boards without native USB connect over Bluetooth Low Energy, and code.circuitpython.org edits code in the browser. Compared with MicroPython it has unified hardware APIs instead of the machine module, CPython-compatible os, time and random, a safe mode after crashes, translated error messages and over 300 device libraries and drivers, which also run on single board computers through Adafruit Blinka; interrupts and threading are disabled. It runs on SAMD, nRF52, RP2040, RP2350, ESP32, STM32, i.MX RT, Silicon Labs EFR32, Analog Devices MAX32 and Sony Spresense boards, with more through its Zephyr port.

Problems it solves

  • learn to code by making LEDs, sensors and buttons do things on a cheap board
  • program a microcontroller in Python without installing a toolchain or IDE
  • edit my board's code like a file on a USB drive and see it run right away
  • teach a classroom of beginners electronics and programming with the same boards
  • use ready-made Python drivers for hundreds of sensors and displays
  • run the same Python sensor code on a microcontroller and a Raspberry Pi
  • program a board that only has Bluetooth from my phone or the browser
  • make a USB keyboard, mouse or MIDI device from a microcontroller in Python
  • recover a board after my code crashed it, without reflashing

Features

  • CIRCUITPY USB drive: edit code.py and it reloads automatically
  • file and serial access over Bluetooth Low Energy on boards without USB
  • browser editor at code.circuitpython.org
  • unified hardware APIs across boards
  • CPython-compatible os, time and random modules
  • safe mode after a hard crash or brown out
  • error messages translated into 10+ languages
  • 300+ device libraries and drivers, also usable on single board computers via Adafruit Blinka
  • USB HID, MIDI and mass storage from Python
  • settings.toml for Wi-Fi and other settings

Limitations

  • No interrupts or threading in Python: async/await for cooperative multitasking on some boards1

Alternatives

The same job

These do what CircuitPython does.

  1. MicroPython Python for microcontrollers
  2. Espruino JavaScript for microcontrollers

Compare CircuitPython with the top 3