0

empowering creative people

CircuitPython vs MicroPython: Key Differences

Have you ever wanted to program your microcontrollers with Python instead of Arduino? MicroPython and CircuitPython bring the ease of Python to microcontrollers by adding hardware support! In MicroPython, Python is largely unchanged other than the added functionality to interface with hardware.

CircuitPython is a derivative of MicroPython that changes a few things to make the language easier to learn and use. CircuitPython is created and maintained by Adafruit. It’s an education friendly open-source derivative of MicroPython. CircuitPython is supported on Adafruit’s educational development boards. Updates to MicroPython are rolled out to CircuitPython as well.

So what in CircuitPython is different then MicroPython? Lets break down the key differences. If you want a comprehensive list, the Adafruit CircuitPython Documentation has a full list of differences between CircuitPython and MicroPython.


Supported Boards

The most important difference between CircuitPython and MicroPython is that CircuitPython includes a port for Atmel SAMD21 (usually called M0), and only supports Atmel SAMD21 and ESP8266 ports. CircuitPython is designed by Adafruit for Adafruit boards, and is not supported for anything else. The following list are the differences in CircuitPython that will be most relevant to the average user:

Behavior

  • The order that files are run, and the state that is shared between them. CircuitPython makes each files role clearer and makes each file independent. 
  • boot.py or settings.py runs only once on start up before USB is initialized.
  • Code.py (or main.py) is run after every reload until it finishes. After it is done running, the vm and hardware is reinitialized. This means you cannot read state from “code.py” in the REPL.
  • After code.py, you can enter REPL by pressing any key. It does not share state with code.py

API

Unified hardware APIs: audioio, analogio, busio, pulseio, touchio, microcontroller, board, bitbangio.

Modules

Tick count is available as time.monotonic()

If you are new to both CircuitPython and MicroPython, there are no real limitations to either that will stop you from achieving your project goals. If you are learning to code or are an educator teaching others. CircuitPython is designed with ease of use for beginners in mind, and is easer to teach and learn. If you want to learn more about CircuitPython, check out our  Introduction to CircuitPython Tutorial for the Adafruit Circuit Playground Express! If you want to learn about some microcontrollers that use MicroPython, check out our Pycom Tutorials.

Have you ever wanted to program your microcontrollers with Python instead of Arduino? MicroPython and CircuitPython bring the...

Have a question? Ask the Author of this guide today!