Introducing the Pico W Microcontroller
In June 2022, the DIY world took a giant leap forward with the introduction of the Raspberry Pi Pico W microcontroller.
This little gem is both amazingly powerful and astoundingly cheap (at a cost of $6).
But that alone isn’t all that surprising. After all, according to Moore’s Law, we have come to expect advances in integrated circuit technology to continue to produce devices that are ever faster, smaller and cheaper.
But what makes the Pico especially remarkable is that it threatens to disrupt the status quo in the field of microcontrollers. The Pico has been very deliberately targeted with the purpose of being easy to install and run MicroPython on it.
Up until now, the world of microcontrollers (for DIY projects) has been dominated by Arduino devices programmed with “C type” code. And here’s why.
1. Microcontrollers typically don’t have a lot of computing resources (speed & memory).
2. The C programming language is small, fast, and powerful.
3. C is a compiled language. This means it can be be compiled into a compact executable file that will fit and run on a microcontroller.
So what is the problem with that? Well if you’re like me, you’ve probably discovered that there is a pretty long and steep learning curve associated with becoming a decent C/C++ programmer. Believe me, I know, because at various times in my life (as a mechanical engineer), I have tried to learn C (or C++) and each time, I would throw up my hands and say “It’s just not worth it! This is too tedious!” And I’m pretty sure I’m not alone. When it comes to writing C code for Arduino, most of us don’t really do it. We just look around on the internet, find something that looks close to what we need, then copy/paste it into our project.
Then in the early 2000’s, the Python programming language began to catch on, with its intuitive, simple syntax and its reputation for being easy to learn and fun to use. By 2012, when the Raspberry Pi single board computer came out, one of its main goals was to make computer programming more accessible to everyone. The ‘Pi’ in its name stands for Python.
But despite Python’s growing popularity, it has not been a candidate for use on microcontrollers because it is not compiled (like C). You can’t just compile a Python program into a tiny executable file and put it on a microcontroller. Python is an interpreted language. Python code needs an interpreter in order to run. And a Python interpreter is pretty big. Not so big that it’s a problem for a Raspberry Pi computer, but way too big for a microcontroller.
Then in 2014, Damien George remedied this problem with the initial release of MicroPython, a light weight version of the Python interpreter intended to be small enough to fit on a microcontroller. Gradually, MicroPython continued to mature and improve. And now the Raspberry Pi Foundation has come out with the Pico and the Pico W (WiFi version) capable of easily accomodating the latest version of MicroPython.
Microcontrollers are a doorway to physical computing projects
Being able to run Python programs on microcontrollers is a big breakthrough, opening up lots of possibilities for various physical computing projects in which there is a need to communicate with physical sensors, motors, and actuators. Apart from the fact that microcontrollers are smaller and cheaper than computers, they also have the advantage of being able to tolerate abrupt power cycling. With a computer, you are supposed to shut it down gracefully so that everything is in a known and predictable state when it gets powered back up again. With a microcontroller, you don’t need to be concerned about unplanned power outages and graceful shutdowns. You just shut it off when you’re done using it and turn the power back on when you want it to run again.
In another article I will explore a robotic car project that uses the Pico W to control the car’s movement through a WiFi interface.