These are some of the common questions regarding CircuitPython and CircuitPython microcontrollers.
We are no longer building or supporting the CircuitPython 7.x or earlier library bundles. We highly encourage you to update CircuitPython to the latest version and use the current version of the libraries. However, if for some reason you cannot update, here are the last available library bundles for older versions:
All CircuitPython boards support floating point arithmetic, even if the microcontroller chip does not support floating point in hardware. Floating point numbers are stored in 30 bits, with an 8-bit exponent and a 22-bit mantissa. Note that this is two bits less than standard 32-bit single-precision floats. You will get about 5-1/2 digits of decimal precision.
(The broadcom port may provide 64-bit floats in some cases.)
Python long integers (integers of arbitrary size) are available on most builds, except those on boards with the smallest available firmware size. On these boards, integers are stored in 31 bits.
Boards without long integer support are mostly SAMD21 ("M0") boards without an external flash chip, such as the Adafruit Gemma M0, Trinket M0, QT Py M0, and the Trinkey series. There are also a number of third-party boards in this category. There are also a few small STM third-party boards without long integer support.
time.monotonic_ns() are available only on builds with long integers.
If you'd like to include WiFi in your project, your best bet is to use a board that is running natively on ESP32 chipsets - those have WiFi built in!
If your development board has an SPI port and at least 4 additional pins, you can check out this guide on using AirLift with CircuitPython - extra wiring is required and some boards like the MacroPad or NeoTrellis do not have enough available pins to add the hardware support.
For further project examples, and guides about using AirLift with specific hardware, check out the Adafruit Learn System.
The nRF52840 and nRF52833 boards have the most complete BLE implementation. Your program can act as both a BLE central and peripheral. As a central, you can scan for advertisements, and connect to an advertising board. As a peripheral, you can advertise, and you can create services available to a central. Pairing and bonding are supported.
ESP32-C3 and ESP32-S3 boards currently provide an incomplete BLE implementation. Your program can act as a central, and connect to a peripheral. You can advertise, but you cannot create services. You cannot advertise anonymously. Pairing and bonding are not supported.
The ESP32 could provide a similar implementation, but it is not yet available. Note that the ESP32-S2 does not have Bluetooth capability.
On most other boards with adequate firmware space, BLE is available for use with AirLift or other NINA-FW-based co-processors. Some boards have this coprocessor on board, such as the PyPortal. Currently, this implementation only supports acting as a BLE peripheral. Scanning and connecting as a central are not yet implemented. Bonding and pairing are not supported.
Check out Adafruit's RFM boards for simple radio communication supported by CircuitPython, which can be used over distances of 100m to over a km, depending on the version. The RFM SAMD21 M0 boards can be used, but they were not designed for CircuitPython, and have limited RAM and flash space; using the RFM breakouts or FeatherWings with more capable boards will be easier.
There is support for asyncio starting with CircuitPython 7.1.0, on all boards except the smallest SAMD21 builds. Read about using it in the Cooperative Multitasking in CircuitPython Guide.
No. CircuitPython does not currently support interrupts - please use asyncio for multitasking / 'threaded' control of your code
The status LED can tell you what's going on with your CircuitPython board. Read more here for what the colors mean!
Memory allocation errors happen when you're trying to store too much on the board. The CircuitPython microcontroller boards have a limited amount of memory available. You can have about 250 lines of code on the M0 Express boards. If you try to
import too many libraries, a combination of large libraries, or run a program with too many lines of code, your code will fail to run and you will receive a
MemoryError in the serial console.
Try resetting your board. Each time you reset the board, it reallocates the memory. While this is unlikely to resolve your issue, it's a simple step and is worth trying.
Make sure you are using .mpy versions of libraries. All of the CircuitPython libraries are available in the bundle in a .mpy format which takes up less memory than .py format. Be sure that you're using the latest library bundle for your version of CircuitPython.
If that does not resolve your issue, try shortening your code. Shorten comments, remove extraneous or unneeded code, or any other clean up you can do to shorten your code. If you're using a lot of functions, you could try moving those into a separate library, creating a .mpy of that library, and importing it into your code.
You can turn your entire file into a .mpy and
import that into code.py. This means you will be unable to edit your code live on the board, but it can save you space.
import statements affect memory?
It can because the memory gets fragmented differently depending on allocation order and the size of objects. Loading .mpy files uses less memory so its recommended to do that for files you aren't editing.
You can make your own .mpy versions of files with
You can download
mpy-cross for your operating system from here. Builds are available for Windows, macOS, x64 Linux, and Raspberry Pi Linux. Choose the latest
mpy-cross whose version matches the version of CircuitPython you are using.
To make a .mpy file, run
./mpy-cross path/to/yourfile.py to create a yourfile.mpy in the same directory as the original file.
Run the following to see the number of bytes available for use:
We dropped ESP8266 support as of 4.x - For more information please read about it here!
We also support ESP32-S2 & ESP32-S3, which have native USB.