Coloured Header Pins
/I needed some header pins for connecting PICO devices to the outside world. I found these on Amazon. They should make the innards of my devices look colourful, which I find rather pleasing.
Rob Miles on the web. Also available in Real Life (tm)
I needed some header pins for connecting PICO devices to the outside world. I found these on Amazon. They should make the innards of my devices look colourful, which I find rather pleasing.
The Adafruit Feather and the Raspberry Pi PICO are boards based on the RP2040 processor from the Raspberry Pi people. They are obviously different (for a start one is black and the other green) but what other differences are worth knowing about?
Both of them are programmed in exactly the same way. The biggest difference is that you use a usb-c cable to connect to the Feather and a micro-usb cable for the PICO. You can write C++ or Python. Both have connections for hardware debugging. On the Feather you can solder a socket on to connect the debugger, on the PICO you add some pins.
Both of the devices use the same chip, the RP2040, which has 264K of internal memory for code and data storage. If you install Circuit Python or MicroPython you end up with around 200K of free memory as reported by my tiny memory size reporting program:
import gc
print("Memory free:",gc.mem_free())
Loading a 500 line Python program left me with a reported 130K or so free so there is scope for these devices to run quite chunky amounts of code.
Both devices use an EEPROM (or ‘flash’) memory chip to store program code and data. If you use Circuit Python they appear as external usb storage devices where you can drop the files. Above you an see what Windows thinks of a PICO (called CheesBox - oops) and a FEATHER. Note that the Feather has much more storage space. This is because the Feather device has an 8Mb flash chip, while the PICO only has 2M.
This doesn’t affect the largest program size you can run - that’s down to the program memory size, but if you want your application to use graphics and sound samples or other data resources then the Feather is the way to go.
Both devices have lots of pins for connecting things. Things to know:
The Feather has four analogue inputs, the PICO only has three.
The Feather has a STEMMA QT connector that you can use with lots of I2C devices sold by AdaFruit and others. It also has an on-board Neopixel and an on-board led.
The Feather can be used with a rechargeable lithium ion battery. It has a connecter and circuit to control charging.
The Feather has both a BOOTSEL and a RESET button. The PICO only has a BOOTSEL button. You use the BOOTSEL button to boot a device into firmware loading mode after a reset. You don’t need to use this very often, you only do it when you want to load new firmware into the device. In other words, if you are using Python you use this once to install the Python firmware. However, having a RESET button makes this easier. For the PICO you have to hold the button down when you apply power, there is no other form of reset. For the Feather you can just hold down BOOTSEL and press RESET.
With the PICO you get the PICO, nothing else. If you want to add pins or sockets you'll have to add them. With the Feather you get solder pins for the device, whether you need them or not.
Both these devices are very well supported. The AdaFruit Feather system has loads of devices you can stack on top (or underneath) a Feather board. The PICO hasn't been around as long, but there are now a huge range of additions for that too.
This is where the PICO comes in ahead of the Feather. It costs around £3.50 ($4.00) per device, against £12:00 ($12:00) for the Feather. Having said that, both are stupidly cheap for what you get.
These are amazing devices. For me I see the PICO as a Ford Focus and the Feather as a BMW. Both do the same job, but the Feather has extra features that make it easier to use (a reset button, an on-board neopixel and QT). If you really need lots of local storage, four analogue inputs or on-board charging, the Feather is the way to go. Otherwise, I'd pick the PICO on price.
The Raspberry Pi PICO is turning into a “consumable” device for me. They are small and cheap enough to spread all over the place, have a huge pin count and, best of all, you can program them in Python. I’ve just bought another batch.
I seem to have written 500 lines of Python which is now running inside a Raspberry Pi PICO. I’ve no real idea how much space this occupies on the device, all I can say is that it works really well. I’m using the Thonny IDE which has a setting for Circuit Python and works a treat.
I’m building a MIDI keyboard device (that’s what the box here is for). One of the great things about this is that the when you use the Adafruit adafruit_bus_device and adafruit_midi libraries from here you have a MIDI device that works with MIDI applications on your PC (I’m using Pure Data), but you also retain the serial port connection from the PC to the device. So you can write Python to send MIDI messages at the same time as use the console for talking to your program. Very useful and rather fun. And I’m loving writing Python again.
Now have a working box with lights and buttons. It is quite pleasing of itself. But what does it do?
I’ve printed a part with the right sized holes, fitted the switches and the pixel ring and wired it up. And it lives (or at least lights up red). Now I have some software to write.
I’ve got another Raspberry Pi PICO powered project (that’s a lot of alliteration) in the works. To celebrate this I visited my box designer program (otherwise known as 2,500 lines of ‘technical debt’) and added the PICO platform to it. Then I printed it out and it works fine. This is the smallest box you can make, it just has a hole for cables and a slot for the USB connector. I can now add the PICO to other device designs and it should just work. I’ve put the design on Thingiverse, you can find it here.
It has been really nice to see how the folks at AdaFruit have got behind the Raspberry Pi Pico device. They’ve just released a set of 3D printable designs that you can use to make cases , some of which fit onto Lego parts.
This is the flip side of the fitting. It looks a bit of a mess because it was all printed on top of support material. However, it does work. The circles get a good grip on the pins. You can find these, and the other designs, on the AdaFruit site here.
This is a nice little add-on for a Raspberry Pi Pico. It’s a hex keypad with very pretty illuminated buttons. It’s easy to set the colours of the buttons and read their state into a Python program (not tried C++yet).
I’m very tempted to move the two button game onto this platform, I think it would work rather well. You can get the kit from here. Remember that you’ll need a Raspberry Pi Pico to plug into it as well.
I’ve designed a little holder for the Raspberry Pi Pico which makes it easy to fit inside a case. I usually make do with double sided sticky tape, but this lets me give my builds a slightly more professional appearance. The pillars will take M2 self tapping screws and the mounting holes M3 bolts. You can find it on thingiverse here.
The pillars have holes which have a radius of 2.0mm and the mounting holes have a radius of 1.6mm. These are numbers that I’ve found work with my printer. If you want to change these values you can find the OpenSCAD program that made the mounting plate here.
This is the holder in use, fitted inside my two button game.
What can you get for £3.60? Maybe a half a pint of craft beer? Perhaps a Happy Meal? Or a magazine? Or an embedded computer with enough power to drive a video display directly?
I’ve been going on about cheap computers ever since I discovered AliExpress.com where you can buy tech straight from China at silly prices. I’ve been getting ESP32 and ESP8266 devices shipped over for a few quid and even with the recent changes to tax (we actually have to pay VAT now) they are still a very good deal. But they have to come all the way from China which takes time and you’re never quite sure what you are going to get. And if you want to use them as the basis of a product it gets tricky as ordering large numbers of devices turns out to be much harder than just buying one or two.
The new chip from Raspberry Pi is going to change a lot of this. It’s called the RP4020 and takes the Raspberry Pi expertise in hardware design into a new area. This is not a personal computer. You can’t process words on it. But you can put it inside devices and get it to control them. It runs C++ or Python code which you can create on a Raspberry PI, Windows PC, Apple Mac or Linux computer.
You can get the new chip in a variety of platform configurations. I think the best configuration available at the moment is the one sold by Raspberry Pi. It’s called the “Pico”. You can buy it for 3.60. I ordered a couple as soon as I heard about it and they arrived yesterday.
It just works and the documentation support is fantastic. You can get complete details here. These include datasheets for the chip, pinouts and specifications for the Pico configuration and full details of Python and C++ development. It took me no time at all to get the device working and my code running on it.
A while back I made a Two Button Game written in Python and using a Raspberry Pi. I wondered how easy it would be to convert it to use a Raspberry Pi Pico device. So at 1:00 pm I started and by 2:00 it was all working on the device. This is not because I’m clever. It’s because of the effort they have put into making the process smooth. These are the things I learned doing the conversion.
Creating and deploying Python programs is very quick to do. I used the Thonny program which lets you edit and deploy your code. The latest version even helps you get MicroPython onto your Pico.
You can power the device from a wide range of sources. I should be able to halve the number of batteries I have to use in my little game, and they should last a lot longer.
You have to search around for some of the code you’ll need, but the application notes are a great start. I got the code to control the NeoPixels from there.
There are some really interesting features on the new chip. It has special hardware to automatically generate sequences of pulses without the involvement of your code. It has two processors which can run at full speed together. It has a real time clock. You can use a second Pico device to read the debug signals from a first and provide hardware level debugging. it will act as a USB host, so you can hang a keyboard or a mouse off it.
The Pico device has been designed to be easy to mount on a PCB so that it can form the “heart” of a device which needs a few more components.
This is a lovely new device for developers and hobbyists. The fact that you are buying it from a UK suppler makes using it much easier and I really like the idea of a UK company making something as gosh-darned useful as this.
From a performance perspective the Raspberry Pi device stands up very well against the ESP32 that I would normally use. The only snag (and I think it is a big one) is that there is no wireless connectivity. You can connect a Pico device via serial, USB, I2C and SPI but all these use cable. The ESP32 device that I normally use provides both Bluetooth and WiFi connectivity. I really, really, really hope that the Raspberry Pi people have a roadmap for the platform that includes popping WiFi and Bluetooth on a future Pico board. Because then it would be unbeatable.
Update: Ha. Digital dyslexia. I got the number of the chip the wrong way round in title of the original post. It’s fixed now.
These arrived today. Very interesting. I’m looking forward to playing with them.
Rob Miles is technology author and educator who spent many years as a lecturer in Computer Science at the University of Hull. He is also a Microsoft Developer Technologies MVP. He is into technology, teaching and photography. He is the author of the World Famous C# Yellow Book and almost as handsome as he thinks he is.
Make your own programming language. Find out more here.