Raspberry Pi Pico - First Impressions

Introduction

After Raspberry Pi Foundation announced RPi0 back in 2016, I was excited as nobody ever. Big RPi was kind of out of reach for me, as it was pretty expensive for 16 year old me, and you know, it is hard to tell your parents to give you 35$ for a computer that might do things. Anyways. When Zero launched, I immediately wanted to buy one. Unfortunately for me, it was such a big boom, that I was unable to buy one in Czech Republic for almost 2 years. But when I got one, oh boy. It was love at the first sight. It is slow for desktop usage, video playback is basically not possible, but for light programming, controlling and serving as standalone console device, incredible.

Moving on the other side of spectrum, but still very much related, it was christmas 2015 when I’ve gotten my first Arduino board. It was an Uno, and it still lives today. I cannot count (and probably don’t even want to) how many hours have I sunked into that little device, be it programming different things (temperature logger for my dad’s craft beer freezer, controller for geoanalytical machine, pc usage monitor) or designing other projects with it. Although it does have many flaws, and it is not suited for big and intensive projects, it is an excellent tool for rapid prototyping, because the syntax is relatively simple, and there is massive amount of libraries for basically everything you can think of.

I’ve started loving both of these platforms. All of my Arduinos, and like 4 Pi Zeros. All of them were or are doing something. And I love it. But sometimes I’m thinking to myself, “man, Arduino is sometimes really underpowered, but Zero is overpowered”. And if I weren’t stupid, I would’ve started with something like BluePill or deeply dived into ESP32 (I have few 8266 boards, but meh, it didn’t got me as much).

Here comes the Pico

When I’ve heard that Raspberry Pi Foundation announced their new board called “Pico”, I immediately thought “wow, somehing better than Zero?”. Well, not quite. You see, all of the previous RPi’s were single board computers, with basically fully featured Linux OS. Pico, is something else. It is a microprocessor, a powerful one, but still. Reading through the feature set, it was like a dream come true. Many GPIOs, two sets of basically every communication protocol every tinkerer needs, debugger, real fast clock, PWM, precise ADCs.. what more do you want. And when I saw the price - 4$. Four. Dollars. I need one, NOW. So I bought one.

Specifications

It is tiny, smaller than Zero. 21x51mm in fact. Only dissapointing thing is that it still uses USB Micro instead of Type C, but hey, we can live with that. But I would love to see the type C on more devices, c’mon, it’s 2021, everybody has at least one cable by now. Now for the feature set:

  • CPU is RP2040, a Dual-Core ARM Cortex M0+ at 133MHz
  • 264KiB on-chip SRAM
  • 2MiB of on-board FLASH
  • 26x GPIO pins, 3 of which are analogue inputs
  • 16x PWM Channels, 2x UART, 2x SPI, 2x I2C, 8 Programmable IO
  • USB 1.1 Controller with PHY, Host and Device mode

The small but powerful Pico

The small but powerful Pico

Incredible. Whole board runs on 1.8 - 5.5V, although all GPIO is only 3.3V tolerant. The board has standard THT holes for header pins, but also castellated edges, so you can solder it as an SMD module (which is really cool). From less relevant, but still cool features, there is deep sleep, on-chip clock (not RTC) , temperature sensor and accelerated math libraries. Yes, you’re getting all of this, for less than the price of McDonald’s menu. Again, incredible.

My first impressions

I’ve played it with only for a few hours, but I fell in mad, deep love with it. Here are some insights, my feelings and a small review at the end.

Micropython

I’m a big Python fan. So first thing I’ve decided to do, is to try out MicroPython. For those that don’t know what is it, it’s basically Python interpreter but optimized for microprocessors. Python is interpreted language, meaning it does all the code you’ve written in the file at the runtine, thus consuming a bit more RAM than compiled languages like C. At first I was skeptical, 264KiB of RAM isn’t really that much.. but it ran flawlessly. Heading to their getting started page, I’ve downloaded the .uf2 file with (presumably) the uPy interpreter, followed simple instructions consisting of holding down BOOTSEL button on board, plugging it in, pasting the file onto the board and .. well, being done really. Then, I connected to the board using Putty, and I was greeted with >>> prompt, which meant Python was running. Sweet. I messed around a bit with the LED, ADC and the temperature sensor, everything from the console. But that’s not particuraly useful, when you want to keep your program. So, I’ve installed Pico-Go VS Code plugin, configured some stuff, and was immediately able to code. Great feature is, that you can either run the code on the board without actually moving the files to it. It is almost instantenous. Great tool for prototyping. When you’re done, you just upload your files to the board, reboot and off you go.

Micropython-cli configuration succesfull

Micropython-cli configuration succesfull

Of course, Python is very cool, but quickly I became a bit dissapointed. How on Earth do you install packages with micropython. It took me probably 2 hours before I gave up, doing basically everything that google had to offer. I still don’t know, and it kind of killed the entire charm of being able to run Python on the board. Still, it is cool and a lot simpler than C++, but not being able to use packages with Python.. it’s like tea without water. You can chew the leafs, but it’s just not it.

C++

On Windows

So I’ve decided to try C++ next. Actually, my friend (s/out nicx) made me. I don’t really like C or C++, if I have to use it, well OK, but when I can choose between C and anything else, I’ll go with anything else. But, it was promised that C++ is better than C, so I gave it a shot. After seeing the absolutely crazy long and complicated setup guide for Windows, I’ve started to doubt if I’m doing something right, or rather, seeing the correct document. Raspberry Pi Foundation, the company known for working out-of-the-box products requires setup this complex? What the hell. But anyways, I’ve installed everything necessary, configured VS Code in the meantime aaaaaand.. big bad. First of all, you have to download 6GB of Windows C++ build tools in order to compile some stuff for ARM. Unbelievable. Then, the MICROSOFT’S OWN installer failed to include stuff in $PATH, breaking everything. After spending probably an hour trying to fix these paths, I gave up. FYI, you need it to properly compile some stuff for the pico using nmake. But it was still crashing with error U1077, which, as Microsoft loves to do it, is a 1000 things at once. And I didn’t felt like turning on verbose mode and digging deep into it, so I just gave up and continued reading the C++ reference guide. But then, I’ve noticed…

On WSL (Linux)

… that there is one line setup script for Linux systems. What. Anyways, I quickly opened up WSL shell, and started the script. EVERYTHING INSTALLED WITHOUT A PROBLEM. Well, it crashed at the end trying to install VS Code, because the script is mainly built for RPi, which is ARM based. But I already had VS Code, and it was the only ARM specific package, so it doesn’t matter. Important thing is, that all headers, builders and whatnot is installed for proper version. It also clones pico-examples repo with.. examples. So I’ve compiled it as a whole (took a bit of time to be honest), copied blink.uf2 file onto the board the same way as I did with the uPy, and hey, IT WORKED. Naturally, I messed around with it, recompiling and uploading manually every time. A bit painful, but very rewarding when you see it working.

This is the image of first succesfull compilation

This is the image of first succesfull compilation

Then I’ve moved to “Creating Your Custom Project”, where you create your own makefile and basically do all of this “backend” stuff by yourself. Very cool, a bit more complex than just simple Python prompt, but nothing too bad if you’ve ever worked with C++ before. So, I’ve tested out ADC, USB communication, PWM LED dimmer and the timer. It all worked flawlessly, and I really liked it. I don’t really like the extremely complex C/C++ syntax, especially when you do a lot of bitwise operations and pointer operations, it looks really messy. But it has some sort of charm, and after a long time of working in JS and Python, putting that good old ; at the end of each and every line felt satisfying.

ADC Measurements in Putty

Live ADC measurements in Putty

Conclusion

It is simply amazing. If it were 20$, I would say something along these lines:

Wait until the support and forums are full, get to know your thing and buy it.

BUT IT COSTS 4$ for Christ’s sake. Buy two of them, and do crazy things. It is incredible how much power you are getting for how little money. Yes, the support may be sparse now, it is indeed just a few days after it got released, but I can bet that it won’t took long, and it will be supported as much as Arduino is. EDIT: I’ve just found out it is a collaboration between RPi Foundation and Arduino LLC, and they PROMISED to port all default Arduino libraries to Pico. SO YES, THERE WILL BE EXCELLENT SUPPORT.

Working with uPython is great, it is easy, pylint works perfectly and mentioned Pico-Go is a perfect plugin. However (maybe it’s just that I’m an idiot) the upip module is a bit broken, and I wasn’t able to install any packages. Just keep that in mind.

C++.. it’s complicated. While it works, and it works god damn perfectly, it was an incredible pain to set up. So if you’re on Windows, either install WSL, or virtualize a Linux distro. It might work for others, but I personally found it a lot simpler to use one script to install everything, rather than having to change environmental variables and modify stuff in registry.

So, with that said, my final verdict is:

GO FUCKING BUY ONE RIGHT NOW.

It is great platform not to just start learning programming, but to also do amazing projects. This is everything, I strongly recommend this board to everyone. Just go for it, it’s 4$.