ICYMI (In case you missed it) – Yesterday’s Python on Microcontrollers Newsletter from AdafruitDaily.com went out.
If you missed it, subscribe now! – You’ll get one terrific newsletter each Tuesday (before this post). Over 7,878 subscribers worldwide!
The next newsletter goes out in a week and being subscribed the best way to keep up with all things Python for hardware. No spam, no selling lists, leave any time. On with the show:
It’s here! The latest Python for Microcontrollers newsletter is 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. What’s new this week:
Greetings! It’s the latest Python for 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. Here’s this weeks’ takes:
20,000+ Members on the Adafruit Discord Server
The Adafruit Discord community, where we do all our CircuitPython development in the open, last week surpassed 20,000 humans! Today it stands at 20,295, thank you very much! Adafruit believes Discord offers a unique way for CircuitPython folks to connect. Join today at https://adafru.it/discord – Adafruit Blog.
Summer of Making – Hack Club
Learning Python from Scratch
An article with ten recommendations on resources on the internet for learning beginning Python, from someone knowing absolutely no coding to course catalogs – GitHub.
Students of this course are usually professional scientists, engineers, and programmers who already have experience in at least one other programming language. No prior knowledge of Python is required, but knowledge of common programming topics is assumed. Most participants find the course challenging–even if they’ve already been doing a bit of Python programming.
An Overview of CircuitPython in Japanese
Irieda presents an overview of CircuitPython (in Japanese) – 144Lab.
Write code in a web browser with GitHub Classroom
Microsoft and GitHub announce that they are making online integrated development environments (IDEs) such that students can get right to work in a web browser, avoiding software conflicts that might happen with code installs on their local machines.
Code on a laptop or with a tablet—students won’t be slowed down by their devices. Students can get started quickly in the same coding environment, so educators may teach instead of troubleshooting.
Currently integration includes MakeCode Arcade which will likely receive Python programmability later this year as it is rolled out across the MakeCode family – GitHub.
CircuitPython Deep Dive Stream with Scott Shawcroft
This week, Scott streams his work on debugging the busio library for CircuitPython on the ESP32-S2.
You can see the latest video and past videos on the Adafruit YouTube channel under the Deep Dive playlist – YouTube.
Weekly Python Tea: A chat with the Python Community
CircuitPython/Pythonista Nina Zakharenko is starting a new video webcast – Weekly Python Tea: A chat with the Python Community. Fridays at 4 PM US PDT – Twitch.
Python 3.9: What’s new and better
The Python Software Foundation has announced the first beta of Python 3.9, scheduled for production release in October. With the release of the beta, all of the major changes of Python 3.9 are set. Python has been previously developed and released every eighteen-months. PEP 602 was accepted with the Python development team adopting an annual release cycle.
The new timeline means Python 3.9 will ship in October 2020. Python 3.10 officially started pre-alpha development on May 19, 2020, will enter the alpha development phase when Python 3.9 ships, and will ship in October 2021. Future Python releases will follow the same pattern – InfoWorld and the Python Blog.
The Zen of Python, the PEP and a New Song
The Zen of Python is a well-known collections of aphorisms which describe the aesthetics of the Python language. They were channeled by Pythonista Tim Peters in 2004 and codified as PEP20 – Python.org.
It was a throwaway python-list post. But like all great triumphs of literature, it was written during commercials breaks while watching professional wrestling on TV, and munching on a ham sandwich. All true!
Barry Warsaw recently wrote a song and lyrics based on the Zen of Python under the terms of a Creative Commons CC BY-NA-SA 4.0 license – We Fear Change.
The Raspberry Pi Weekly Newsletter
The Raspberry Pi Foundation has a weekly newsletter where you can the latest news on the Pi platform. Some items of note this week:
- 8GB Raspberry Pi 4 on sale now
- Latest Raspberry Pi OS update – May 2020
- A virtual tour of Raspberry Pi OS
And you can find all your favorite Raspberry Pi products and accessories available at Adafruit – Shop.
Adafruit is shipping regular (non-emergency) orders after priority orders are filled.
Note: there may be a number of out of stock items as manufacturing gears back up. Adafruit suggests if an item is out of stock and needed, searching at resellers may yield results. In the US, Digi-Key is suggested.
News from around the web!
Audiomixer in CircuitPython allows two voices to play simultaneously, with separate controls and levels! Here, on Feather M4 with a Prop Maker FeatherWing for audio amp, tap trigger and NeoPixels – Twitter and YouTube.
A few weeks ago Scott helped merge in countio into Circuitpython. The StudioBot robot uses countio to drive a PID on the robot’s motors to keep it driving straight. The encoder also counts to get a better idea of distance – YouTube.
Duplicating a USB keyboard to USB and BLE with CircuitPython. The USB keyboard is connected via the OTG port to a Trinket M0 running KBDADVUARTUSBH from @gdsports1. The Trinket sends it via UART TX to the UART RX of a nRF52840 – Twitter.
A colorful Chevrolet emblem animated with CircuitPython, controlled via a phone. The brains are an Adafruit Feather nRF52840 Bluefruit – Twitter.
A line animation in CircuitPython on an Adafruit PyGamer – Twitter.
A light up Rainbow Pride fountain pen with CircuitPython and NeoPixels – Twitter.
An animated Pacman light up hoodie by @CaitlinsDad – Twitter.
An early version of CircuitPython with the Espressif ESP32-S2 on a mysterious board – Twitter.
The MicroPython on U-BLOX NINA W102 work continues with MicroPython receiving voice commands from Amazon Alexa Voice! – Smartcore
Interactive Disassembler (IDA) Pro Batch Binary Analysis with IDAPython scripts – IRQ5.
Why Can’t Python Find My Modules? – Real Python.
CircuitPython Weekly for June 1st, 2020 on YouTube.
PyDev of the Week: Seth Michael Larson on Mouse vs Python.
Made with Mu
Mu is a text editor specifically for Python programming. Why Mu? Mu tries to make it as easy as possible to get started with programming but aims to help you graduate to “real” development tools soon after. Everything in Mu is the “real thing” but presented in as simple and obvious way possible. It’s like the toddling stage in learning to walk: you’re finding your feet and once you’re confident, you should move on and explore! Put simply, Mu aims to foster autonomy. Try out Mu today! – codewith.mu
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 did not have any new boards added but more are being ported!
Looking for adding a new board to CircuitPython? It’s highly encouraged! Adafruit has four guides to help you do so:
- How to Add a New Board to CircuitPython
- How to add a New Board to the circuitpython.org website
- Adding a Single Board Computer to PlatformDetect for Blinka
- Adding a Single Board Computer to Blinka
New Learn Guides!
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 drivers, download the Adafruit CircuitPython Library 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! 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. Feel free to contact Kattni (@kattni) with any questions.
You can check out this list of all the CircuitPython libraries and drivers available.
The current number of CircuitPython libraries is 231!
Here’s this week’s new CircuitPython libraries:
Here’s this week’s updated CircuitPython libraries:
PyPI Download Stats!
We’ve written a special library called Adafruit Blinka that makes it possible to use CircuitPython Libraries on Raspberry Pi and other compatible single-board computers. Adafruit Blinka and all the CircuitPython libraries have been deployed to PyPI for super simple installation on Linux! Here are the top 10 CircuitPython libraries downloaded from PyPI in the last week, including the total downloads for those libraries:
Keep an eye out here for more updated download stats coming soon!
What’s the team up to this week?
What is the team up to this week? Let’s check in!
This past week has seen me returning to working on the libraries for the ST ICM20948 9-DoF motion sensor. You may recall from previous updates that this chip integrates its magnetometer a bit differently. While it’s common to see multiple sensors integrated into the same package, it is not all that common to see one of the included sensors accessed through one of its neighbors in the package.
Like some other chips, the ICM20948 includes an external I2C bus that can be used to integrate with and control additional sensors through the same libraries. This is likely done to allow flexibility with what sensors are used to augment the existing ones. In the case of the ICM20948, the gyro and accelerometer are bundled together in the same register space, however the integrated AK09916 3-axis magnetometer/compass by AsahiKASEI is connected to the external I2C bus controlled by the ICM20948!
The result of this is that the normal configuration of the magnetometer has to be orchestrated by the I2C master controller in the ICM20948. The biggest struggle I’ve had while working on these libraries, and indeed any library, was surrounding this orchestration. To make a long story short, in certain situations the I2C master controller in the ICM20948 would get into a bad state and not be able to communicate with the magnetometer.
As the song goes, “I get by with a little help from my friends” and indeed our friends at SparkFun had already ran into and solved this issue in their Arduino and Python libraries. The solution was to check for a bad connection by trying to read from the sensor a number of times, then resetting the I2C master if it was unsuccessful. Indeed I had tried this, however the key was that they continued this cycle until the sensor responded or a given number of failed attempts.
Big thanks to SparkFun engineers Pete Lewis, Nathan Seidle, Owen and others for saving my bacon!
As a result of the newfound stability of the magnetometer, I was able to add in support for adjusting the data rate of the magnetometer, so I have some pretty graphs for you! First is the magnetometer measuring at 10Hz
and then at 100Hz.
I’m re-implementing the CircuitPython _bleio API using bleak. So far I’ve implemented scanning for advertisements. The bleak library uses Python asyncio capabilities but _bleio is a conventional “sync” interface. So I spent time learning the details of using asyncio with threads, and used the janus.queue library to pass data between the sync and async worlds as it arrives. It works on Linux and Windows, but I’m having issues with MacOS due to threads, and have submitted a bug report.
The next step is to extract as much information from the bleak scanning results as possible. The _bleio scanning interface passes back more information than is available via bleak, so I have to figure out what is essential and simulate or avoid the rest.
I’ve been working on support for SD cards using a potentially-faster interface called SDIO. This is the way the SD card is connected on the STM32F405 Feather, and is not currently usable from CircuitPython, which only understands SD cards connected via SPI. My early results show that when reading bulk data directly from the SD card (not using a FAT filesystem), some pretty impressive data rates are achieved. Next up, I’ll give the same treatment to the SAMD51 port of CircuitPython.
This week I continued working with LED animations and published the CircuitPython LED Animations guide. There’s nothing like writing a guide for a library to find bugs in that library. So, along with the guide came a series of bug fixes and GitHub issues for bugs that weren’t as urgent. As for the guide, apparently making 31 animated GIFs takes much longer than I expected, so it took a bit longer than I originally planned. But the guide turned out really well. If you’re interested in displaying animations on your NeoPixels or DotStars, check out the CircuitPython LED Animation library and the associated guide.
Next up is porting the Arduino AHTx0 library to CircuitPython for the AHT10 sensor.
This past week I’ve mostly been bug-hunting on the mimxrt10xx, adding in pin reset features and stress testing busio as much as possible. My time has been cut a little by the fact that my home office has been unbearably hot during the summer days, but I’ll be returning to the core of Boston soon for a (hopefully) more regular schedule.
In the coming week, I’ll be working pulseio for the i.MX port, and possibly revisiting STM32 for some older bugs and other issues I turned up while working on the i.MX’s implementations.
This past week, I was pretty focussed on porting displayio over to Blinka. This was really a lot of fun and I probably spent more time working on it than I normally do on projects, but I also got a lot out of it.
One of the more interesting challenges was having the Raspberry Pi writing to the display without blocking the user’s script. The way I got around that was to implement threading for the display and as depending on whether auto_refresh was on or off, it would automatically start or stop the thread.
I also implemented fontio as part of it so that we could have even more compatibility between the CircuitPython and Blinka platforms. The way that it works is that it uses Pillow to render its fallback font and then converts that into a displayio Bitmap for complete compatibility. I was able to get the font transparencies working as well.
One of the more pleasant surprises I had was during testing (in that I had written it to be compatible enough), was that it ran the example for the Display Shapes library perfectly and I wasn’t even expecting it to run.
There’s still a lot of items to tackle to make it complete, but you can find the library at https://github.com/adafruit/Adafruit_Blinka_Displayio if you would like to experiment with it or work on some of the issues.
The improvements to the ESP32S2 port for pin tracking and digitalio has been merged. I’ve started on busio and will stream more about that work this week. Thanks to Ivan for helping me get over some hurdles with that.
FlaskCon is a community driven Flask event being held July 4th and 5th. It is intended for speakers and attendees all over the world to participate in technical and evangelical sessions related to Flask. Flask is a micro web framework written in Python – Event and Call for Papers.
EuroPython 2020 this year will be an online conference from July 23-26. The schedule is now available – Website.
Attending the conference days will require a ticket, participating in the sprint days will be free – EuroPython.
PyCon AU has announced they are holding PyConline AU, an online event, in August 2020 – pycon.org.au.
PyCon India 2020: the premier conference in India on using and developing the Python programming language. Held online October 3-5, 2020. A call for proposals is now open through August 14, 2020. – Website and Twitter
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.
20200601 is the latest CircuitPython library bundle.
Call for help – Translating CircuitPython is now easier than ever!
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 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, Microcenter, Raspberry Pi and more.
ICYMI – In case you missed it
The wonderful world of Python on hardware! This is our video-newsletter-podcast that we’ve started! The news comes from the Python community, Discord, Adafruit communities and more. The news is part of the weekly newsletter, then Kattni brings it to video, and Adafruit has it as a segment on ASK an ENGINEER. The complete Python on Hardware weekly videocast playlist is here.
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, 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.
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.
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. Join our Discord or post to the forum for any further questions.