Wednesday 20 January 2021

Playing with the Raspberry Pi Pico!

I've been incredibly lucky to get to play with the new Raspberry Pi Pico in pre release and, in short, it's rather brilliant! First up, this new board contains custom Raspberry Pi silicon, the RP2040 chip, which will also be sold as a standalone product for people to develop products/systems/boards with.

The Pico is set to retail at  less than a £5er and you'll want to check out this page for the full spec and the pin in/out of the Pico but the highlights are;

  • Dual-core ARM Cortex M0+ processor, with clock running up to 133 MHz
  • 264 KB of SRAM and 2MB of flash onboard
  • 26 multi function GPIO
  • 2x SPI, 2 x I2C, 2 x UART, 3 x 12bit ADC, 16 PWM channels
  • 8 x PIO Programmable state machines


  • It  has USB Host and Device, compatible back to 1.1 and it's programmable via drag and drop using mass storage mode. If that last line didn't make sense, put simply, you create some code, attach the Pico via USB (whilst holding down a button)  it appears as a drive and you drag your script file to the Pico and it is automatically installed! Simple!


    Language wise there is a C/C++ and  a port of Micro Python and I've played a little with both, working through some of the examples in both C/C++ and also Micro Python. All my tinkering has been done using my Raspberry Pi400 and it's worked excellently as a pairing! 

    I started following the Getting Started PDF for C/C++ and installed the SDK/ toolchains. The guide walks you through installing everything you need from the terminal and steps through how to make and build the examples. Many will opt to edit and create code in something like Visual Studio (again bundled into the Rasbian image) but for my simple tinkering I opened some of the examples using nano, tweaked and then rebuilt them in the terminal. You honestly don't need to be a terminal guru to get to this point, simply follow the documentation. The resulting tweaked examples, when built, create a .UF2 file which you can drag and drop to the Pico which flashes incredibly quickly. 

    Perhaps more accessible for some is the Micro Python or "Pico Python"route, the first task here is to drag and drop the Pico Python firmware onto the device, for convenience a pre built binary is available on the Pico Getting Started page. Also in the getting started with Micro Python on Pico documentation there is a guide for you if you are keen and want want to build your own binary. Flashing the micro python firmware to the Pico is another simple drag and drop operation and you can, of course, swap between C/C++ and Micro Python by re-flashing.

    Following the micro python getting started guide it walks you through interacting with the REPL using minicom within the terminal which is fun to tinker with. There's a decent walk through of all the examples in the micro python repository in the documentation. This includes examples that use most of the Pico's features, PWM, UART, SPI, PIO , but there's also examples for things like interrupts, and additional common sensors, Neopixels and LED's. 

    Towards the end of the Micro Python guide there is a section on setting up an IDE, Thonny, to provide a nice environment for working with the Pico. Thonny is a nice simple IDE that's again bundled in the Raspbian OS, it's pretty straightforward to set up and get going and you can work directly with the REPL via a shell window or you can save and deploy scripts temporarily or with persistence to the Pico.

    So! My thoughts, it's great, a low price, really fast and well spec'd micro controller that at launch already has a heap of resources and examples, I'm sure that at the price point it will attract a mass of users and a strong community which will create and share lots of wonderful projects. I can't wait to see it grow!


    2 comments:

    Andy from Workshopshed said...

    A powerful board. I found the documentation on the Pi website with full schematics for the board and advice on how to implement hardware designs using their chip. Had a quick look at the SDK, the C syntax/SDK seems easier to understand than the Python which seems more like assembler.

    Anonymous said...

    The docs for the board and the uController, on day 1, are stunning!