Skip to content

CircuitPython

The majority of Adafruit hardware can run either

Note

A Beginner's Recommendation.

CircuitPython

What is CircuitPython?

This website focuses on CircuitPython which is a version of python for microcontrollers. Adafruit is the principle backer for CircuitPython.

I recommend CircuitPython over Arduino for beginners because:

  • Python is a more accesible programming language than C++ (which is what Arduino uses).
    • Python syntax is more similar to plain language
  • Python gives beginners an easier and quicker feedback loop
    • Python code does not need to be compiled in the way that C++ (Arduino) code requirees.
      • With CircuitPython, the code is stored and run directly on the microcontroller, aka "click save and your code starts running"
    • Arduino code requires the traditional method of:
      • Compiling code on an external device (e.g., your laptop)
      • Downloading the compiled binary to the microcontroller through the Arduino IDE
      • Debugging the code
      • Watching the output
  • Edit with any code editor

Because of these and other reasons, Python continues to be increasingly used for microcontroller projects.

Code.circuitpython.org is a Browser-Based CircuitPython Editor and Serial Terminal

Code.circuitpython.org is a browser-based CircuitPython editor and serial terminal

MakeCode

Note

Great for younger students, MakeCode is a blocked-based programming language which is similar to Scratch.

Block-based programming, such as MakeCode or Scratch, is great for younger beginners. Using drag-and-drop blocks avoids common syntax errors like typos or formatting issues, which can be source of frustration for new programmers. However, the power and flexiblity of block-based programs is limited.

Hence for older students, or those students already experienced with Scratch or MakeCode, I recommend jumping straight into python.

Edublocks

For those looking to ease the transition from block-based programming to python, EduBlocks is an interesting hybrid which offers python in a block-based format.

The CircuitPython Show interviews Joshua Lowe, the creator of EduBlocks (Aug 8, 2022).
Joshua Lowe joins the show and shares how he started programming and created Edublocks.

CodeSkool

CodeSkool is a block based Python for Raspberry Pi Pico https://www.reddit.com/r/circuitpython/comments/uri5ws/teach_kids_python_and_embedded_electronics_with_4/ https://ide.codeskool.cc Now at CodeSkool (https://ide.codeskool.cc) we support the complete examples of PicoZero Python API https://picozero.readthedocs.io/en/latest/recipes.html All you need is a $4 raspberry Pico board, few led, resistors, a buzzer & a speaker. Now write programs that runs and interact with the physical world, using drag & drop scratch blocks with our Python extension. With Scratch Kids can use the familiar environment to program Pico. Just drag the blocks and it will generate the python code, that they can upload directly, i.e. save directly using the upload button to the device. The kids don't need any tool, just a browser and there familiar scratch environment and they can write code that is running on embedded hardware and can interface with the real world like they used to do with makey makey, etc

What about Micropython?

MicroPython is an open source Python programming language interpretor that runs on small embedded development boards, aka microcontrollers.

  • Lean and efficient implementation of Python 3
    • Includes a small subset of Python standard library
  • Optimized to run on microcontrollers
  • Micropython developed by Damien George in 2013
    • CircuitPython is a fork of Micropython
      • CircuirtPython developed by Adafruit in 2017
    • While CircuitPython looks somewhat like MicroPython there are some differences.

Choose MicroPython

  • For advanced features like interrupts and threading
  • Complete access to the RP2040’s Programmable I/O (PIO) in Python

Choose CircuitPython

  • Beginner friendly
  • Extensive library support for sensors and other breakouts
  • Well supported by Adafruit

CircuitPython Documentation

CircuitPython documentation is hosted at Read the Docs.

http://docs.circuitpython.org/

CircuitPython Community

https://learn.adafruit.com/welcome-to-the-community

Additional References

Additional CircuitPython Resources

Adafruit has a great walkthrough on how to get started with CircuitPython with Raspberry Pi Pico

This page was last updated on 2024-06-25 15:25:07 -0500.