The Raspberry Pi Foundation have released another single board computer. This time there is no SD memory card, no hdmi port or camera port because they have made microcontroller. A low powered device that can be programmed in C++ or Python to sense the world around.
The Raspberry Pi4 is great as a desktop computer in the Rpi range but requires a lot of power in comparison to the other Raspberry Pi’s. If you want something more low powered then there is the Raspberry Pi Zero W which is a great device for sensors and building smaller projects. For some projects even the the Pi Zero seems over kill to just sense a button press or for motion detection, if you are not going to need Wifi to do something with the results. This is where microcontrollers are useful.
They run a small programs and manage inputs and outputs to real world devices. These microcontrollers are everywhere hidden away in everyday objects, often these are encountered where there is a control panel such as a vending machine, kitchen appliances, electronic toys.. There are loads of options around already for the hobbyist to build projects with microcontrollers. such as the Ardrunio boards amongst others.
So what does a Raspberry Pi microcontroller add to the current microcontroller market place?
I have always been interested in computing but didn’t really get into electronics programming until the first Raspberry Pi was released in 2012. For Several of my projects I have thought a microcontroller would be a better option but it seemed you needed to know C++ for Ardruno and I didn’t see any options for my preferred programming language of python. So I didn’t pursue that route.
So for me a Raspberry Pi microcontroller that can programmed in C++ or MicroPython suddenly takes my interest. It is already familiar to me with similar GPIO features plus a few new ones and I can use my python knowledge to use with MicroPython. My first steps will be at a good pace.
So in answer to the question, it brings new users from the massive Raspberry Pi teaching and hobbyist community who will gain interest in a similar but different area of electronics. The Raspberry Pi Pico along with the BBC MicroBit will lead children, students and general users off into the diverse area of microcontroller programming with the wide range of boards available by many manufactures.
What can a Pico do that a Pi Zero W or Pi4 can’t?
The Raspberry Pi single board computers are good at what they do but to make them a good all round machine at the low price some features have to be compromised. The limitations are usually are made available via add on boards for controlling servos, motors, analogue devices, real time clock. The Pico is able to use these devices natively.
The PI4 has 1 i2c, 1 SPi , 1 UART available. It can have addition but these have to be configured in the Pi OS to be enabled. The main GPIO pins available are
28 user GPIO pins that are setup as:
1 x i2c
1 x SPi
1 x UART
17 General I/O Pins
These can be configured to use a selection of
Up to 6x UART
Up to 6x I2C
Up to 5x SPI
Up to 2x PWM channels
Up to 3x GPCLK outputs
The Raspberry Pi Pico can have several combinations without further settings.
30 multi-function General Purpose IO (4 can be used for ADC)
1.8-3.3V IO Voltage (NOTE Pico IO voltage is fixed at 3.3V)
12-bit 500ksps Analogue to Digital Converter (ADC)
Various digital peripherals
2 × UART,
2 × I2C,
2 × SPI,
16 × PWM channels
1 × Timer with 4 alarms
1 × Real Time Counter
2 × Programmable IO (PIO) blocks,
8 state machines total Flexible, user-programmable high-speed IO Can emulate interfaces such as SD Card and VGA
The Pico can use analogue inputs where as the RPi4 only uses digital. Analogue inputs sense the change in voltage from devices such as a rotary switch as they are rotated or moisture sensor as they get wetter. Digital devices are just on or off and data specifically needs to be transferred to get readings such as temperature.
Programming in Python
Micropython is the recommended python language on the release of the Pico. The default Python editor for the Raspberry Pi, Thonny, has been updated to use Micropython for the Pico directly from the interface.
There has been many setup guides to use Led’s and Motion Sensors with the Pico to get started but I wanted to try it out with variouse sensors that use i2c such as a Spectral Light Sensor, Time of Flight device and Air Quality & Temperature sensor. This is where I found the difference with programming the microcontroller.
With python used on a desktop computer there are a wide range of libraries which work on any system. You type a few simple commands and you are off. With micropython there are libraries available for sensors but they are for specific devices or family of devices. This means that the code has to be adapted to the Pico.
When you want to communicate with the i2c sensor you have to specifically call memory addresses such as i2c.writeto_mem(0x39, 0x00 | 0x80, 3). This is usually hidden in the libraries of desktop python. After several hours rummaging around in datasheets and guides online I had no real results. So not as straight forward as I was hoping.
I then tried Circuit Python. This is an alternate version of Micropython adapted by adafriut that comes with libraries for their various addon boards and sensors. This was more like i’m use to. Drop a library on the Pico write your own code using the library and you are off.
As before thare are many microcontroillers and they all need different setups but Circuit Python standardises a lot of it. I still had to adapt the commands for the i2c pins I wanted to use but I found it far easier to use than Micropython and got results within an hour of starting.
I have not written my own program yet but getting the i2c connected AS7282 Spectral Sensor sending results to a SPi connects 1.3 inch ST7789 display felt like a win.
What I ike about the Pico, and probably all microcontroller devices, is that it dosn’t need to be shutdown. So I can setup a VL53L0X Time of Flight sensor and ST7789 display for measuring or motion detection. Plug in the power and off it goes. When I have finished there is no shutting down, just switch of the power and it will be fine. This has been a limitation with a Raspberry Pi zero unless you have configured a shutdown button.
So in future it will be a decision between a larger Raspberry Pi, a Raspberry Pi Zero or a Raspberry Pi Pico on what is suitable for my projects and most probably other microcontroller devices as well.
Last Updated: 13 February 2021