When products first come out, and the inevitable add-on boards appear, one of the things that you pray for are clear, concise instructions that take you through, step-by-step how to do something basic. The Raspberry Pi Pico is incredibly “new and exciting”, but I found myself struggling this afternoon trying to get an add-on board going in a basic fashion – the Pico Explorer from Pimoroni. This board, which comes in at £22.50, is programmed using MicroPython, more specifically a version of MicroPython especially written to interface with their products. It would be nice, of course, if you could just install the MP library for their products into a basic MicroPython install (in a similar way that you drop library files onto a Pico running CircuitPython. However, this will do “for now”, so I thought I’d let you know how I faired and how to do it yourself.
The picture above is a demo picture from Pimoroni – I did not manage to get anything like as complicated as that running!
Beware! Windows user ahead
Please note, I’m using Windows (shock, horror), but as this is still the number one Operating System in the world, and it’s what I’ve got at the moment (my desk space is set-up for work as a home office), I don’t think that’s a bad thing, exactly.
Step 1: Install the MicroPython firmware
Go to this page on GitHub and download the latest version of MicroPython from Pimoroni (NOT the normal MicroPython firmware). You want the .uf2 file (which we’ll refer to as UF2) listed nearest the top. It’s an “alpha” but don’t let that put you off too much. Unplug your Pico, hold down the BOOTSEL button and plug it back in again. You will get a drive called RPI-RP2 on your computer. Drop the UF2 file onto that drive.
The Pico will reboot and then you will be told that another device is being set-up on Windows. Another drive does not appear – this isn’t CircuitPython, this is MicroPython. It works differently.
Step 2: Install Thonny
Download the latest release of the Thonny editor from their website. This lets you interact with the Pico in the right way. Thonny’s pretty good (a favourite amongst the Raspberry Pi engineers) but it would be nice if the more user-friendly Mu was an option. That will probably come in time.
Anyway, once you’ve got it installed, run it and then immediately go to the bottom-right of the window. Change the interpreter to MicroPython (Raspberry Pi Pico). This lets you use the REPL of the Pico, if you want to. This is an interactive prompt (which appears at the bottom of Thonny) where you can run code directly on the Pico. To be honest, it’s just as easy to create a file and save it to the Pico rather than mess around with the REPL interpreter.
More importantly, it lets you save MicroPython files direct to the Pico and run them interactively.
Step 3: Get the demo sketch up-and-running
Visit this page on GitHub and copy the code from there.
In the main editor area of Thonny, paste in this code. Do Ctrl-S to save and choose to save it to the Raspberry Pi Pico. Save it as main.py on the Pico (the name is important as it specifies that, once it’s uploaded, the code should run automatically).
At the moment, all it will do is display some text on the LCD.
Step 4: Make some noise
As it says on the screen, if you plug in a Male-to-Male jumper to GP0 and then the other end into ‘AUDIO’, this should make a very 8-bit-type sound.
To go further, you’ll need a pinout diagram (thanks to Pimoroni):
This tells you what is connected to what pin. I then suggest taking a look at the Raspberry Pi MicroPython tutorial which will tell you how to define inputs and outputs.
For instance, to use one of the buttons that border the LCD, you’ll want to do something like:
button = Pin(16, Pin.IN, Pin.PULL_DOWN)
This should, although I haven’t tried it, give you a button object to query to see if value() is True or False.
Apart from that, there’s a lot of things you can do with the Explorer.
- You can use the mini breadboard to do your own electronics (such as that pictured at the top of the screen). I plugged in an LED, resistor and button and created a button-activated lamp. That’s a small thing, but it’s a good first step.
- You can use the Breakout slots to try interfacing with the Breakout Garden set of products (but I’m not sure how well supported they’ll be yet).
- You can use the buttons bordering the LCD, as I mentioned above, to get inputs to do things.
- You can use the DRV8833 chip on the bottom to activate motors, the pins for which are broken out on top.
- You can read analog inputs (these are also broken out) – be careful here as you can only use 3v3 analog sensors with the Pico (without lots of messing about with level converters!)
What did I think of the Pico Explorer?
I think it’s a great product to get you going – there’s lots of in-built functionality, the breadboard area is great as it means you can do your “Hello World” LED lighting and button inputs. However, the documentation is a bit “all over the place” and, as far as I can tell, the MicroPython functions aren’t quite fully documented yet – you have to infer them from the demo code that you cut-and-pasted in step 3. That’s fine, but some additional documentation and a “bringing it all together” needs to be done if Pimoroni expect beginners not to get lost, bewildered and dispirited by the experience. I was just about okay, but a beginner may not be.