PyDev of the Week: Scott Shawcroft

This week we welcome Scott Shawcroft (@tannewt) as our PyDev of the Week! Scott is the lead developer of CircuitPython, a variant of the Python programming language made for microcontrollers. If you’d like to see what else Scott is up to, his website is a good place to start. Let’s take a few moments to get to know Scott better!

Can you tell us a little about yourself (hobbies, education, etc):

I’m Scott, I graduated from the University of Washington in 2009 in Computer Engineering. Afterwards, I joined the Maps team at Google where I worked on rendering and styling of the map. I left in 2015 to do my own thing. I designed a modular flight controller system for racing quadcopters and learned about hardware at the same time. My hobbies include running, rock climbing, video gaming and thrift shopping for retro electronics (so I can put CircuitPython in them.)

Why did you start using Python?

I started using Python to make my first desktop application (Denu) back in 2004 or so. I first learned programming with PHP and websites. I wanted to move to programming the desktop and remember standing in a bookstore deciding between Perl and Python books. I picked Python for some reason and have never looked back.

What other programming languages do you know and which is your favorite?

As I said, I learned PHP first after wanting dynamic HTML. (This is before CSS and Javascript were really a thing.) I haven’t really touched PHP since then.

In school we did mostly Java with a small sampling of other languages. While I TAed the intro computer programming course I taught an optional section that taught the course in Python too. After buying a new MacBook Pro, I reverse engineered the Apple multitouch pad using Python and implemented a daemon for it in C in 2008. (It’s my Linux kernel claim to fame.)

I did Javascript at Google for an internship on GMail. Once I started full time at Google, I did C++ on servers. For my embedded work I primarily do C (even in CircuitPython).

It’s a bit tough to pick a favorite. Python is always a great start for scripting, prototyping and teaching. The newest versions of C and C++ are also really nice when you want to manage your own memory.

What projects are you working on now?

My core project is CircuitPython. It is a reimplementation of Python with the goal of making it easy to get started programming and building something. It is based on MicroPython which laid the foundation for the refinements we’ve done in CircuitPython. My day-to-day job is to expand and refine the underlying C code of CircuitPython.

I design and hack hardware to get CircuitPython running on new devices in my spare time. For example, I’ve designed a GameBoy cart that runs CircuitPython to make it easier to program a GameBoy. I also have a toaster oven and piano keyboard waiting for a CircuitPython brain. Previously, I’ve made a custom mechanical computer keyboard with CircuitPython. I like hacking devices to have CircuitPython because it is simply the easiest way to hack on code.

Which Python libraries are your favorite (core or 3rd party)?

Struct is probably my favorite when using hardware. It is immensely useful for interfacing with external sensors.

My favorite third party library is requests because it makes scripting REST APIs like GitHub’s easy.

How did you become the lead developer for CircuitPython?

To some degree it was happenstance. I discovered Adafruit while making sensors for my house. While making my flight controllers a few years later I became a regular on Adafruit’s Show and Tell. Once it was clear that my hardware business was not sustainable I started looking for a software gig. I asked Adafruit if they had anything and they offered to pay me to port MicroPython to their M0 boards (which became CircuitPython). It went really well and I continued to work on it.

So, I became lead by being first to some degree. As the project has grown I’ve set the vision for the project and on boarded a number of others. We’ll see how CircuitPython evolves as it continues to grow.

What excites you about the future of CircuitPython?

I’m excited to see all of the different things people make with it. CircuitPython combines the ease of Python with the tangibility of hardware in a way that hasn’t been done before.

As we broaden our device support, we’ll see a wider variety of projects built with CircuitPython. When we add mobile workflow support, we’ll see our audience broaden to include those who primarily use a mobile device instead of a laptop or desktop.

Can you describe some of the challenges for making Python work on embedded systems?

The biggest challenge to making Python on embedded systems is limited RAM. As a project grows to using many libraries, the ram footprint grows as well. Once the RAM is full or fragmented, the code cannot continue. Luckily, the inexpensive microcontroller space is still very much in Moore’s Law territory. The original microcontroller I ported MicroPython to, the SAMD21, has 32 kilobytes of ram. Our newest, the SAMD51, has between 192 kilobytes and 256 kilobytes. Plenty of space. 😉

Is there anything else you’d like to say?

I’d like to encourage software folks to try building something with hardware. It’s incredibly fun to hold and interact with a physical thing you’ve programmed.

Microcontroller programming brings a whole new meaning to “full stack”. Code running on a microcontroller is much closer to “the metal” by skipping the many layers a full OS like Windows or Linux includes. Without those layers, it’s easier to appreciate the machinery of a CPU and memory because it’s just your code running.

Thanks for doing the interview, Scott!