Daily tips and tricks from the experts at Adafruit!
View this email in your browser

View this email in your browser.

Welcome to the Python on Microcontrollers newsletter, brought you by the community! We’re on Discord, Twitter, and for past newsletters – view them all here. If you’re reading this on the web, subscribe here. It’s been a busy week, here’s the news:

Upstream MicroPython Versions Merged Into CircuitPython

MicroPython & CircuitPython

Adafruit has recently incorporated updates from MicroPython: 1.9.4ish through six releases to the latest, 1.15. It is nearly three years of changes to MicroPython. This brings the Python core used in CircuitPython very close to the one in MicroPython. It’ll make it easier to collaborate on the core going forward. MicroPython’s new release policy of one every two months or so should make it easier for CircuitPython to keep up to date. We don’t share much port-specific code but we’re excited to be able to collaborate on the core Python VM going forwards.

Our community has expressed interest in more advanced features of upstream MicroPython such as native modules. This merge will make it easier to bring those advancements to CircuitPython.

CircuitPython 7 – New Core Language Features from MicroPython

  • Assignment expressions, sometimes called the “walrus operator”:
    if (m := rx.match(line)):
    print(m.group(0))
  • Variable type annotations:class Foo:
    x: int = 1
  • Matrix multiplication operator (used in numpy, but not yet supported by ulab):
    a = l @ u

PyCon US 2021

PyCon US 2021

PyCon US, the official annual Python gathering, was May 12-15, 2021. The event was entirely virtual and content is currently available for registered participants. The event talks will be released on the PyCon US YouTube channel approximately a week after the event – https://us.pycon.org/2021/

PyCon US Sprints

Kattni is hosting CircuitPython Development Sprints on May 17-18, 2021. Be aware that this year is a little different with it being virtual. Stop by the PyConUS Sprints 2021 Discord and check out the #circuitpython-discussion channel if you’re interested in contributing to CircuitPython in a guided setting – PyCon and Adafruit Blog.

PyLadies Auction

The PyLadies Auction team put together a rousing event full of joy and generosity to raise over $11,000. This will benefit women around the world to ensure that the Python community is welcoming to them.

Adafruit Discord reaches 29,000+ members!

29000 THANKS

Adafruit Discord

The Adafruit Discord community, where we do all our CircuitPython development in the open, reached over 29,000 humans last week, thank you! Adafruit believes Discord offers a unique way for CircuitPython folks to connect. Join today at https://adafru.it/discord.

See other Adafruit Discord milestones – Adafruit Blog.

The Hunt for a Faster Python

Pyston

The quest for faster Python: Pyston returns to open source, Facebook releases Cinder, or should devs just use PyPy? – The Register.

Python programming: We want to make the language twice as fast, says its creator – ZDnet.

Faster CPython

Guido van Rossum talk at PyCon US: Faster CPython – GitHub and Twitter.

Mark Shannon: Implementation plan for speeding up CPython – GitHub.

A New Book on Programming Microcontrollers with CircuitPython

Programming Microcontrollers with Python

Apress has recently published a new book by Armstrong Subero: “Programming Microcontrollers with Python”. See more on the book and a mini-review – Adafruit Blog.

CircuitPython Deep Dive Stream with Scott Shawcroft

Deep Dive with Scott

This week, Scott streams his work on LED Debugging and more.

You can see the latest video and past videos on the Adafruit YouTube channel under the Deep Dive playlist – YouTube.

News from around the web!

Late breaking: Siemens acquires Supplyframe. Adafruit has contacted Siemens and emailed their Hackaday / Supplyframe contacts to see if Siemens has also acquired Hackaday and Tindie – Adafruit Blog.

Siemens has signed an agreement to acquire Supplyframe, a leading Design-to-Source platform for the global electronics value chain, for USD 0.7 billion. The transaction unlocks significant value for customers of Supplyframe and Siemens, providing seamless and quick access to both Siemens’ offerings and Supplyframe’s marketplace intelligence. This will help customers to reduce costs, increase agility and make highly informed decisions. The acquisition also strengthens the Siemens portfolio through Software as a Service (SaaS) – not only in the field of Electronic Design Automation (EDA) and Printed Circuit Boards (PCB), but also scaling into other domains and technology fields.

Filament Box Monitoring

A RepBox filament box monitored with an Adafruit e-ink MagTag with an SHT40 sensor for the box. It displays temperature, humidity, and, thanks to AdafruitIO, updates a remote dashboard – Twitter.

macOS Big Sur’s CIRCUITPY Eject Notifications

HOW-TO: Tone Down macOS Big Sur’s CIRCUITPY Eject Notifications – Adafruit Blog.

-and-

Free/Busy Indicator

Another option is to use a switch (like those on the Circuit Playground Express) to remount the filesystem read-only – MacOS won’t alert on the removal of a read-only filesystem – Twitter and GitHub.

Dynamic USB Descriptors

Using Dynamic USB Descriptors in CircuitPython – hackaday.io.

Keyboard Shortcuts Keypad

A Keyboard Shortcuts Keypad with Raspberry Pi Pico and CircuitPython – YouTube.

Soft Bubbles

Making Soft Bubble robotics with Raspberry Pi Pico and CircuitPython – hackaday.io.

Pico e-ink

How to use Raspberry Pi Pico and electronic paper with CircuitPython (Japanese) – SwitchScience.

QTPy-knob

QTPy-knob: A simple USB knob with CircuitPython – Dangerous Prototypes.

Raspberry Pi Pico and LoRaWAN

Raspberry Pi Pico and LoRaWAN from CircuitPython – GitHub.

Double Up touch-sensitive sculpture

Designer and educator Andrew Kleindolph’s Double Up touch-sensitive sculpture. He used the Bantam Tools PCB mill to machine its wood base and then used CircuitPython to program the Adafruit QT Py controller that allows the light to change colors – Twitter.

Weather forecasting station

Create a weather forecasting station using a Feather S2 and an OLED display with CircuitPython – Raspberry Pipod.

Metronome from an Event Badge

Making a Metronome from an Event Badge with MicroPython – Lushprojects Blog.

mdis

mdis: an attempt at a disassembler for MicroPython bytecode – GitHub.

Melbourne MicroPython Meetup

The Melbourne MicroPython Meetup has posted information from their sessions in March and April: talking about general news updates and Damien discussing recent MicroPython changes, including the v1.15 release. – github.io.

Menus for MicroPython

Menus for MicroPython – simple but powerful, multitasking menus for MicroPython, using a little display board and a rotary encoder – hackaday.io.

Crypto Mining with Raspberry Pi

Solar-Powered Crypto Mining with Raspberry Pi – hackster.io.

Pyntendo

Pyntendo: a Nintendo Entertainment System (NES) emulator written in Python and Cython – GitHub.

Python Project to an Executable

Convert a Python Project to an Executable (.exe) File using Auto PY to EXE – Python in Plain English.

PuDB: a console-based visual debugger for Python

PuDB: a console-based visual debugger for Python – GitHub and Twitter.

Humble Bundle

A new Humble Bundle of books on Learning Python – pay $1 or more, part of proceeds go to the Python Software Foundation – Humble Bundle.

namedtuple

Write Pythonic and Clean Code With namedtuple – Real Python.

Pyodide

Pyodide: Python for the browser, with the scientific stack, compiled to WebAssembly – LWN.net and GitHub.

Python and Malware

Python and Malware: Developing Stealth and Evasive Malware Without Obfuscation – Twitter and Paper.

Pyre

Pyre: a performant type-checker for Python 3 by Facebook Open Source – Pyre.

Python Projects on Github That Are Examples of Best Practices and Good Architecture

Python Projects on Github That Are Examples of Best Practices and Good Architecture – Reddit.

PyDev of the Week: Tim Arnold from Mouse vs Python.

CircuitPython Weekly Meeting for May 17th, 2021 on YouTube and notes.

#ICYDNCI What was the most popular, most clicked link, in last week’s newsletter? The new TI-84 Plus CE Python graphing calculator.

New Boards Supported by CircuitPython

The number of supported microcontrollers and Single Board Computers (SBC) grows every week. This section outlines which boards have been included in CircuitPython or added to CircuitPython.org.

This week, we had 3 new boards added!

Looking to add a new board to CircuitPython? It’s highly encouraged! Adafruit has four guides to help you do so:

New Learn Guides!

New Learn Guides

FunHouse Mail Slot Detector from John Park

Adafruit I2C QT Rotary Encoder from Kattni

CircuitPython Project Bundle

Bundle with Bundlefly

When you get to the CircuitPython code section of an Adafruit Learn Guide, sometimes things can get a bit complicated. You not only have the code you need to upload to your device, but you likely also need to add some libraries that the code requires to run. This involved downloading all the libraries, digging through to find the ones you need, and copying them to your device. That was only the beginning on some projects, as those that include images and/or sound files required further downloading and copying of files. But, not anymore!

Now, with Project Bundles, you can download all the necessary code, libraries and, if needed, asset files with one click! We automatically check which libraries are required for the project and bundle them up for you. No more digging through a huge list of libraries to find the ones you need, or fiddling with looking for other files or dependencies. Download the Project Bundle, copy the contents to your device, and your code will simply work. We wanted to make this the easiest way to get a project working, regardless of whether you’re a beginner or an expert. We’ll also be adding this feature to popular IDEs as an add-on. Try it out with any Circuit Python guide on the Adafruit Learning System. Just look for the ‘Download Project Bundle’ button on the code page.

To download and use a Project Bundle:

In the Learning System – above any embedded code in a guide in the Adafruit Learn System, you’ll find a Download Project Bundle button.

Project Bundle download button

Click the button to download the Project Bundle zip.

Project Bundle zip downloaded

Open the Project Bundle zip to find the example code, all necessary libraries, and, if available, any images, sounds, etc.

Project Bundle unzipped

Simply copy all the files over to your CIRCUITPY drive, and you’re ready to go!

If you run into any problems or bugs, or would like to submit feedback, please file an issue on the Adafruit Learning System Guides GitHub repo.

CircuitPython Libraries!

CircuitPython Libraries

CircuitPython support for hardware continues to grow. We are adding support for new sensors and breakouts all the time, as well as improving on the drivers we already have. As we add more libraries and update current ones, you can keep up with all the changes right here!

For the latest libraries, download the Adafruit CircuitPython Library Bundle. For the latest community contributed libraries, download the CircuitPython Community Bundle.

If you’d like to contribute, CircuitPython libraries are a great place to start. Have an idea for a new driver? File an issue on CircuitPython! Have you written a library you’d like to make available? Submit it to the CircuitPython Community Bundle. Interested in helping with current libraries? Check out the CircuitPython.org Contributing page. We’ve included open pull requests and issues from the libraries, and details about repo-level issues that need to be addressed. We have a guide on contributing to CircuitPython with Git and Github if you need help getting started. You can also find us in the #circuitpython channel on the Adafruit Discord.

You can check out this list of all the Adafruit CircuitPython libraries and drivers available.

The current number of CircuitPython libraries is 314!

Updated Libraries!

Here’s this week’s updated CircuitPython libraries:

What’s the team up to this week?

What is the team up to this week? Let’s check in!

Dan

I am fixing bugs for CircuitPython 6.x and 7.0.0, and will continue to do that in the near future.

Now that the first version of dynamic USB descriptors is merged in, there are some more features to be added. First, I’ll be looking at supporting “boot”-profile keyboards. Currently all CircuitPython HID devices are merged into a single “composite” HID device. This saves USB endpoints, which are a scarce resource. But the simple BIOS code on your computer typically does not understand these composite devices. The BIOS can recognize a single HID keyboard device, which is specially marked as being a “boot” keyboard. The BIOS assumes that all boot keyboards are the same and have the same report descriptor, so it does not actually read it. So I’ll add the ability to define and use boot devices.

Jeff

I continued helping Scott test the MicroPython “merges” and fixed a bunch of resulting problems. I think we’re done for now, at least until MicroPython releases version 1.16.

I made some changes that allowed all of the MicroPython “natmod” examples to compile, and tested some of them on a host computer. “natmod” is a way to write code in a subset of C that gets compiled to a “mpy” file which can then be loaded on a microcontroller with “import”. I didn’t test or enable it for any CircuitPython boards yet so if you’re motivated to use this feature, please come help us out with this.

Speaking of MicroPython, I’ve opened several Pull Requests there that have generated interest, and I’ve also seen renewed interest in one that I first opened in 2018. These PRs help speed up the process of testing MicroPython, and address a few obscure bugs.

Last of all, I’ve been working on supporting RGBMatrix on ESP32-S2 microcontrollers in CircuitPython. This was available in Arduino but we neglected to add it to CircuitPython. At the moment, it works well enough to show a demo but there are still some bugs to fix before it can be turned into a Pull Request.

Kattni

This week I published the guide for the Adafruit I2C QT Rotary Encoder. This guide has everything you need to get started using your rotary encoder breakout with both Arduino and CircuitPython, as well as pinouts and downloads resources.

I updated the blink program on the Welcome to CircuitPython: Creating and Editing Code page to use board.LED in the code. It previously use board.D13 which not all boards supported, for example, Raspberry Pi Pico. The issue was that not all Adafruit boards supported board.LED, which was what we use in the Blink template anyway. So, I went through and added the LED pin to 31 more boards in CircuitPython. This update is only available in the absolute newest version of CircuitPython, so if you run into an issue with the pin not being found, try using the “Absolute Newest” version of CircuitPython for your board. Eventually, we will release another stable version with these updates, but I’m not certain when.

Lucian

This week I spent on bugfixes and catchup – I resolved a boot issue on an STM32 board caused by outdated clock settings, tracked down a few more issues with deep sleep on the RP2040, fixed the circuitpython-adjacent RMT settings for the Arduino NeoPixel library, and dove into the guts of set-next-file.

Melissa

This past week, I finally had the opportunity to use MicroPython. Blinka, our CircuitPython compatibility layer which runs on Single Board Computers such as the Raspberry Pi, was originally written to run on MicroPython. However, over the year it hadn’t really been tested as new boards were added. So I went through and tested it all out, fixed Digitalio, I2C, SPI, and UART and in the process, I added the Raspberry Pi Pico with MicroPython. Be sure to keep an eye out for an upcoming guide, or if you’re feeling brave, you can download it to try on your board right now.

Scott

MicroPython 1.15 was just merged in! So, we’re just over 100 commits away from the newest MicroPython code. We’ve merged in the code from the latest release. I chatted with Damien and Jim and we’re hoping to move to a shared py core. There are a few changes to upstream and we have a plan to see how it goes.

Now that the merge is done, we’ll start doing alpha releases. They’ll be a bit unstable but should have some good stuff including dynamic USB descriptors thanks to Dan. I’m working on making the status LED blinking lower power but have a bug to fix on SAMD before I can merge it in.

After that, I’ll be back on BLE workflow.

Upcoming events!

EuroPython 2021

EuroPython, the largest conference for the Python programming language in Europe, will be held online July 26 – August 1, 2021. More information at https://ep2021.europython.eu/.

PyOhio

PyOhio 2021, a free event, is to be held on July 31, 2021 – PyOhio.org via Twitter.

PyConline AU

Call for proposals for PyConline AU 2021 runs until June 10th, 2021 with the event held 10-12 September, 2021 – pyconlineau

Send Your Events In

As for other events, with the COVID pandemic, most in-person events are postponed or cancelled. If you know of virtual events or events that may occur in the future, please let us know on Discord or on Twitter with hashtag #CircuitPython.

Latest releases

CircuitPython’s stable release is 6.2.0. New to CircuitPython? Start with our Welcome to CircuitPython Guide.

20210514 is the latest CircuitPython library bundle.

v1.15 is the latest MicroPython release. Documentation for it is here.

3.9.5 is the latest Python release. The latest pre-release version is 3.10.0b1.

2,428 Stars Like CircuitPython? Star it on GitHub!

Call for help – Translating CircuitPython is now easier than ever!

CircuitPython translation statistics on weblate

One important feature of CircuitPython is translated control and error messages.

With the help of fellow open source project Weblate, we’re making it even easier to add or improve translations.

Sign in with an existing account such as GitHub, Google or Facebook and start contributing through a simple web interface. No forks or pull requests needed!

As always, if you run into trouble join us on Discord, we’re here to help.

jobs.adafruit.com – Find a dream job, find great candidates!

jobs.adafruit.com

jobs.adafruit.com has returned and folks are posting their skills (including CircuitPython) and companies are looking for talented makers to join their companies – from Digi-Key, to Hackaday, Micro Center, Raspberry Pi and more.

Job of the Week

Shop Supervisor & Lead Technician – MICRO – Adafruit Jobs Board.

ICYMI – In case you missed it

ICYMI

The wonderful world of Python on hardware! This is our Python video-newsletter-podcast! The news comes from the Python community, Discord, Adafruit communities and more and is reviewed on ASK an ENGINEER Wednesdays. The complete Python on Hardware weekly videocast playlist is here.

This video podcast is on iTunes, YouTube, IGTV (Instagram TV), and XML.

Weekly community chat on Adafruit Discord server CircuitPython channel – Audio / Podcast edition – Audio from the Discord chat space for CircuitPython, meetings are usually Mondays at 2pm ET, this is the audio version on iTunes, Pocket Casts, Spotify, and XML feed.

And lastly, we are working up a one-spot destination for all things podcast-able here – podcasts.adafruit.com

Codecademy “Learn Hardware Programming with CircuitPython”

Codecademy CircuitPython

Codecademy, an online interactive learning platform used by more than 45 million people, has teamed up with the leading manufacturer in STEAM electronics, Adafruit Industries, to create a coding course, “Learn Hardware Programming with CircuitPython”. The course is now available in the Codecademy catalog.

Python is a highly versatile, easy to learn programming language that a wide range of people, from visual effects artists in Hollywood to mission control at NASA, use to quickly solve problems. But you don’t need to be a rocket scientist to accomplish amazing things with it. This new course introduces programmers to Python by way of a microcontroller — CircuitPython — which is a Python-based programming language optimized for use on hardware.

CircuitPython’s hardware-ready design makes it easier than ever to program a variety of single-board computers, and this course gets you from no experience to working prototype faster than ever before. Codecademy’s interactive learning environment, combined with Adafruit’s highly rated Circuit Playground Express, present aspiring hardware hackers with a never-before-seen opportunity to learn hardware programming seamlessly online.

Whether for those who are new to programming, or for those who want to expand their skill set to include physical computing, this course will have students getting familiar with Python and creating incredible projects along the way. By the end, students will have built their own bike lights, drum machine, and even a moisture detector that can tell when it’s time to water a plant.

Visit Codecademy to access the Learn Hardware Programming with CircuitPython course and Adafruit to purchase a Circuit Playground Express.

Codecademy has helped more than 45 million people around the world upgrade their careers with technology skills. The company’s online interactive learning platform is widely recognized for providing an accessible, flexible, and engaging experience for beginners and experienced programmers alike. Codecademy has raised a total of $43 million from investors including Union Square Ventures, Kleiner Perkins, Index Ventures, Thrive Capital, Naspers, Yuri Milner and Richard Branson, most recently raising its $30 million Series C in July 2016.

Contribute!

The CircuitPython Weekly Newsletter is a CircuitPython community-run newsletter emailed every Tuesday. The complete archives are here. It highlights the latest CircuitPython related news from around the web including Python and MicroPython developments. To contribute, edit next week’s draft on GitHub and submit a pull request with the changes. You may also tag your information on Twitter with #CircuitPython.

Join our Discord or post to the forum for any further questions.