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,940+ 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. Pow!
Happy July! 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. Let’s get started!
CircuitPython on the Seeed Studio Wio Terminal
The Wio Terminal, an all-in-one microcontroller development kit which includes sensors, buttons, Grove connectors, and a screen, is now officially-supported in CircuitPython.
The Seeed ‘s Wio Terminal is an ATSAMD51-based microcontroller with wireless connectivity supported by a Realtek RTL8720DN. Its CPU speed runs at 120MHz (Boost up to 200MHz). Realtek RTL8720DN chip supports both Bluetooth and WiFi providing the backbone for IoT projects. The Wio Terminal itself is equipped with a 2.4” LCD Screen, onboard IMU(LIS3DHTR), microphone, buzzer, microSD card slot, light sensor, and infrared emitter(IR 940nm). Note: The RTL8720DN isn’t currently supported from CircuitPython. Therefore, WiFi and Bluetooth will not currently work.
CircuitPython 6.0.0 Alpha 1 released!
The first alpha release of CircuitPython 6.0.0 is out now. It is a renumbered version of 5.4.0 because i2cslave module and class have been renamed to i2cperipheral. It is alpha because the developers may remove or rename additional APIs. It is relatively stable.
Feature-wise, this stable release adds basic lower power support when in time.sleep() and initial ESP32-S2 support. The lower power work changed time keeping and may have introduced bugs. Please use 5.3.0 if you need a stable version of CircuitPython.
New features and improvements since 5.4.0 Beta 1
- Added sdioio and sdcardio for native SDCard support. Available on SAMD51 and spresense. Thanks to @jepler and @kamtom480.
- Added busio support to ESP32-S2. Thanks to @tannewt
- Add support for SAME54. Thanks to @jepler
- Add global navigation satellite system (gnss) support for Spresense. Thanks to @kamtom480
- Improved ESP32-S2 performance. Thanks to @tannewt and @DavePutz
- Updated ulab thanks to @jepler and @v923z
- Fix time.sleep() after it has been ctrl-c’d. Thanks to @DavePutz
- Fix microcontroller.cpu.temperature read hang. Thanks to @dhalbert
- Fix ScanEntry prefix matching when any=False. Thanks to @dhalbert
- Fixed port D pins on STM32 LQFP64 boards. Thanks to @hierophect
- Fixed I2C timing on STM32 F7 and H7. Thanks to @hierophect
- Fixed display refresh when changing palette transparency. Thanks to @DavePutz
- Meowbit build is now UF2 rather than a bin. Thanks to @hierophect
- Documentation improvements thanks to @AndrewR-L
- Improved Dutch, German, Brazilian Portuguese and Spanish translations. Thanks to @buchen, @fede2cr, @ryevertigo, and @wtuemura.
A full commit log is here.
Breaking changes since 5.x
- i2cslave is now i2cperipheral and the class in it is changed as well.
- New boards since 5.4.0 Beta 1
- Seeeduino Wio Terminal Thanks to @ansonhe97
- Atmel SAME54 Xplained Thanks to @jepler
- Loc Ber M4 Thanks for @florin-trutiu
- UnexpectedMaker FeatherS2 Thanks to @tannewt and @unexpectedmaker
CircuitPython on a Watch
SciPy 2020, the 19th annual Scientific Computing with Python conference, is a virtual conference being held July 6-12, 2020. The annual SciPy Conference brings together over 900 participants from industry, academia, and government to showcase their latest projects, learn from skilled users and developers, and collaborate on code development. The full program consists of 5 days tutorials and talks (July 6-10) and 2 days of developer sprints (July 11-12) – Event.
Python Resource Humble Bundle
Humble Bundle is offering a “Pay what you want” offer for Python learning texts. $1,400 worth of materials. And portion of each sale goes to the Python Software Foundation. – Humble Bundle.
CircuitPython Deep Dive Stream with Scott Shawcroft
This week, Scott streams his ESP32-S2 SPI bug recap discusses networking.
You can see the latest video and past videos on the Adafruit YouTube channel under the Deep Dive playlist – YouTube.
Adafruit is shipping!
Please Shop Adafruit to support open source hardware, software, and publications like this newsletter.
News from around the web!
Development on the Open Book eInk reader continues with a new revision out in the last week:
I’ve assembled and tested one; written a system test script and a sketch to burn the bootloader using a Feather M0; completed a first draft of the documentation, and I’m almost done with the Kitspace BOM. The goal for these is to sell the bare PCBs on Tindie, for folks who want to build at home. I had hoped to have that done by the end of June, but pandemic drama has slowed me down; still, they should be available by next week. Watch the Tindie store for updates.
More – Hackaday.io.
Designing Winterbloom’s Big Honking Button – a Eurorack module running CircuitPython – Thea Codes.
An Espressif Systems ESP32-S2 Saola running CircuitPython 6.0.0-alpha with the ESP32SPI library to also use an Adafruit AirLift FeatherWing for Wi-Fi.
With the new Pylance language server in the Visual Studio Code editor, you can now get auto-imports! – Twitter.
Using Ultrasonic Sensors with CircuitPython and Arduino – YouTube
freeCodeCamp has added 4 new Python Certifications – freeCodeCamp.
Porting an Altair simulator to an ESP2866. 1+2=3. It uses MicroPython, an OLED display and IR for minimal (3 pin) GPIO. Octal data entry – Twitter.
Web Scraping Crypto Prices With Python using BeautifulSoup – Towards Data Science.
KoNLPy (pronounced “ko en el PIE”) is a Python package for natural language processing (NLP) of the Korean language – KoNLPy.
Create and Modify PDF Files in Python – Real Python.
Get free historical and live stock prices and FX rates using Python – Medium.
The Learning Python 10 minutes a day series – Towards Data Science.
Make Your Code Great, Python Style – Live Code Stream.
8 Advanced Tips to Master Python Strings – Towards Data Science.
7 cursos para aprender a programar con Python online gratis – TICbeat.
Python training for business analysts and traders by J.P. Morgan – GitHub.
JSON explained for Python users: Data Science Edition – Towards Data Science.
Guess the song that the “program” above refers to.
PyDev of the Week: Philip James on Mouse vs Python
Made with Mu
Why code your Python programs in 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 had one new board added!
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!
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 262!
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 checking back for 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!
Another week, more libraries, and a new revision of the CAN FeatherWing. We decided to switch to using an older CAN controller at least for early iterations because the available libraries for it are more mature. Once we get a handle on things, we will consider moving to a newer and likely faster chip. I also worked on a quick and relatively simple CircuitPython library for the BH1750 ambient light sensor from Rohm.
Earlier in the week, I worked on wrapping up the CircuitPython library for the PCF8591 ADC+DAC combo chip but ran into some strange behavior while testing before release. When I was reading the ADC for more than one channel, the results for the channel were getting switched around! To cut a long story slightly shorter, after verifying that my wiring was correct I dug into the datasheet to read about the timing of how the ADC reads are trigger and returned. As it turns out, an ADC reading is triggered on the rising/trailing edge of the ACK/NACK clock pulse. The result for that measurement is returned in response to the second read after the measurement is triggered.
To understand why this caused me a headache, I’ll briefly explain how reading from a sensor on an I2C bus generally works. This is a very simplified diagram and not to scale, so bear with me:
Generally but not always, every I2C transaction between a microcontroller and a sensor on the bus starts with the address of the intended recipient
With that implied, to read a register, the normal pattern from the perspective of the micro:
In these cases, you’re generally reading a register that already has the data available to send back, so after the microcontroller sends the address of the register it wants to read, it can immediately read the response back, even without giving up control of the bus.
Since in this case we’re talking to an ADC that starts taking a new measurement as soon as it’s requested, this won’t work because the data hasn’t been generated and it takes a bit of time to do so. Rather than sitting around waiting for the measurement to finish, the ADC kindly does two things at once: it starts measuring the requested channel, and while it’s doing that, it returns the result for the previous request. That ends up looking approximately like:
This is explained in the datasheet, of course, and it even includes this handy diagram:
So, you can see why our reads were delayed. It was by design! Once we accounted for this in the libraries, all was well, but it took some head scratching to figure out. Let this serve as a reminder: The Datasheet Has All The Answers (except for when it doesn’t and it’s in the errata that you neglected to read).
I’m continuing to work on an implementation of _bleio that supports the HCI Bluetooth protocol available on ESP32, used on our AirLift boards. I have “first light”: I can talk to the ESP32 and ask it simple commands.
I’ve also fixed a number of small bugs in various BLE libraries, and there are more still to fix.
We have decided to move our next CircuitPython alpha or beta release from 5.4.0 to 6.0.0, so that we can make some incompatible changes, which are allowed when we do a major version change.
I’ve been working on various guides this week. I updated the BNO055 guide to include the STEMMA QT version of the board. As this board is so popular, we will continue carrying the previous header-only version as well, so the guide update was simply integrating the STEMMA QT version. I finished updating the ST 9-DoF Combo Boards guide with the final FeatherWing. I started work on a guide to using the 74HC595 shift register. The guide will provide basic info about the chip including pinouts. It will also include an example of using it to control 8 LEDs using CircuitPython, with a detailed wiring diagram to help you get it going.
We haven’t had PyPI download stats available for some time as the site we were getting them from instituted rate limiting and we were well over the limit with the number of libraries we were querying. Thanks to sommersoft’s research, we now have a way to roll our own query, though it has a few necessary prerequisites before we can get that going. We should have it up and have download stats available again soon.
As well, thanks to sommersoft, I have the tools necessary to shift the CircuitPython libraries from using the default branch master on GitHub to using the default branch main. I am looking forward to updating all of the CircuitPython libraries to this change to welcoming and inclusive language. We have already shifted the CircuitPython core to main, and will be making the move across the rest of the project soon.
This past week I worked on creating a timer management system for STM32, which allows various different modules in the port to share a pool of timer peripherals. The system allows modules to prioritize certain kinds of timers based on whether they have pins exposed, aiming for the minimum number of conflicts possible between internal timer use (such as in modules like PulseOut or RGBMatrix) and external use (PWMOut). I also worked on some miscellaneous bug fixes to modules and peripherals affected by this new timer mediator, and fixed a crash related to simplex SPI on the STM32.
This past week I ported the PyPortal library over to Blinka so that many of the PyPortal examples work with little modification. As I’ve ported over examples, I’ve found small bugs both in the PyPortal library and displayio for Blinka that I have been slowly fixing, which is leading to a more stable displayio for Raspberry Pi and other Single Board Computers.
This last week I’ve tested and debugged the busio implementation on ESP32-S2. My stream last week was me stumped by internal seemingly being crossed when doing SPI. Only after the stream did I realize there was another setting that was messing me up. Luckily, I sorted it out and got the PR. It’s been reviewed and will be checked in shortly.
This week, I’m starting to work on our network related libraries and brainstorming what the API should be from CircuitPython on the ESP32-S2. I’m also hoping to reduce the memory overhead in making JSON requests because they are very common. I may also add memory debugging/monitoring APIs to better track how many allocations occur and what size for a section of code.
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.
PyConline AU will be an online event, held September 4–6, 2020 – pycon.org.au.
PyGotham is a New York City based, eclectic, Py-centric conference covering many topics. PyGotham TV taking place October 2-3, 2020 with a single track of talks presented online – Event Website and Call for Proposals.
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.
20200704 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.
The Adafruit Discord community, where we do all our CircuitPython development in the open, reached over 21,870 humans, thank you! Adafruit believes Discord offers a unique way for CircuitPython folks to connect. Join today at https://adafru.it/discord.
ICYMI – In case you missed it
The wonderful world of Python on hardware! This is our first video-newsletter-podcast that we’ve started! The news comes from the Python community, Discord, Adafruit communities and more. It’s part of the weekly newsletter, then we have a segment on ASK an ENGINEER and this is the video slice from that! 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.