APC Australia

Raspberry Pi Pico: the Pi meets Arduino

Meet the new makerboard and chip from Raspberry Pi that takes the famed single-board computer to a whole new (and lower) level. Darren Yates explains.

-

The arrival of the Raspberry Pi back in 2012 revolution­ised computing. All of a sudden, we had this single-core single-board computer that cost less than $50. It wasn’t the only option, with a number of Android TV sticks also hitting the market for around the same price, but it was the Raspberry Pi that turned computing into a commodity item. However, prior to the Pi, another revolution had sparked up in the electronic­s engineerin­g world – Arduino created a new common platform for single-function or ‘embedded’ applicatio­ns, no operating system required.

For the last ten years, both Raspberry Pi and Arduino have built their respective ecosystems. But now in 2021, the new Raspberry Pi Pico microcontr­oller board and the Arduino IDE allow these two ecosystems to collide. This month, we look at the Pico and why it’s an important evolution in the Raspberry Pi ecosystem.

What is the Raspberry Pi Pico?

The Pico is a small circuit board about the size of a USB stick with two rows of connecting pins on either side. It’s designed to slot into a reusable circuit builder called a ‘breadboard’ that allows you to create your own electronic circuits. The Pico itself features a special self-contained microproce­ssor called a ‘microcontr­oller’.

This microcontr­oller on the Pico is the new RP2040 and features a dual-core 32-bit ARM Cortex M0+ design running at up to 133MHz, with 264KB of RAM and 2MB of on-board flash storage.

Now if you’re thinking these specs sound very 1990s and much less than previous Raspberry Pi boards, hold your horses for a sec.

The Pico is a completely different beast to previous Pi boards. Rather than being a general-purpose single-board computer requiring operating system and external storage, the Pico is designed for lower-level or ‘embedded’ specificfu­nction applicatio­ns. The Pico’s microcontr­oller chip has its own RAM and storage and doesn’t need an operating system. Instead, it runs your compiled code directly on the chip’s CPU core, which gives you two benefits. First, running your code directly means there’s no need for an operating system, which greatly reduces the amount of RAM and storage you need to perform a specific task. But second, since your code runs right on the ‘bare metal’ (the chip itself with no operating system layer), it runs much more efficientl­y – you can still achieve complex tasks, but with lower (and more powereffic­ient) clock speeds.

What can you do with it?

Whereas a computer is meant to interface with monitors, storage, keyboards and USB devices, microcontr­ollers in general (and the Pico in particular) are designed to connect directly to electronic components – resistors, capacitors, transistor­s, sensors, motors, buzzers, LEDs. They enable you to interface with the real world – measure temperatur­es, actuate motors, light LEDs, sound buzzers. Microcontr­ollers provide more limited computing power but at very low cost.

If you followed our Arduino series in APC a few years ago, we used Arduino microcontr­ollers to build robots, a working Enigma Cipher Machine and even a stereo digital audio recorder. Think of it like this – computers are very good at many things; microcontr­ollers are exceptiona­l at one thing, whatever that one thing is you want to make.

More recent developmen­ts now even bring machine-learning to microcontr­ollers and the Pico is no exception, thanks to efforts such as TinyML. With machine-learning, you can use a Pico to detect different objects from a camera sensor, for example, or even do speech recognitio­n.

How do you use it?

Microcontr­ollers like the Pico are where software meets hardware – and you get to design both. While you plug in your LEDs, resistors and other components to make a circuit, you also write the software that makes the microcontr­oller do something with those components.

The Pico supports a number of programmin­g languages – you can code it with Micropytho­n and you can even hook it up to the Arduino integrated developmen­t environmen­t (IDE) and use a simplified version of C++.

If you remember your highschool coding lessons, you may have coded a program that takes user input from the keyboard, for example if the ‘y’ or ‘n’ keys are pressed. By contrast, with microcontr­ollers, you can check whether one of the digital input/ output (I/O) pins is connected to the electrical-high or low voltage lines. This might be if a doorbell pushbutton is pressed.

You can also measure the analog value of a light-dependent resistor or temperatur­e sensor using the analog-to-digital converter. The ADC converts analog voltage into a digital number that you can use to perform a task. For example, if the ADC shows the resistance level of an LDR has risen above a certain level (meaning the light-level has dropped), you can activate an output pin that has an LED connected to it and create an automated light switch.

Not perfect, but looks a solid effort

At time of writing, local Australian supply of the Pico was still a bit tight, with at least one retailer limiting sales to one per customer. However, given its $6 price tag, expect demand to continue. The interopera­bility of the Pico with the Arduino IDE, combined with the ability to code in C++ or Python will ensure the Pico is used in a wide range of applicatio­ns.

That said, I wouldn’t call the Pico ‘perfect’. For example, you only get one analog-to-digital converter (ADC), its sample rate is only 500-kilo-samples-per-second (500kSps) and it doesn’t have a dedicated ADC voltage reference. There’s also no on-board wireless connectivi­ty and no digital-toanalog converter (DAC). As an alternativ­e, popular boards based on the STM32F103 microcontr­oller sell on Ebay for around $8 and include two 12-bit ADCs with one-mega-sample-per-second (1000kSps) sample rates. More recent Arduino boards offer Bluetooth and WiFi wireless connectivi­ty.

The point is there are many different microcontr­oller boards on the market, each with their own mix of processing power and built-in peripheral features. The Raspberry Pi Pico is now another option in this increasing­ly crowded market, albeit an instant market heavyweigh­t thanks to its huge Raspberry Pi community. What’s more, for those who have never stepped outside of the Raspberry Pi ecosystem, the Pico is a step into the broader world of embedded electronic­s engineerin­g, where appliances and machines are powered by microcontr­ollers, everything from phones to dishwasher­s, TVs to cars and the Internet of Things. If the Pico introduces people to this fascinatin­g world of electronic­s, more’s the better.

 ??  ?? The Raspberry Pi Pico features two rows of pins to connect to electronic components.
The Raspberry Pi Pico features two rows of pins to connect to electronic components.
 ??  ?? The Pico is about the size of a USB stick with a new RP2040 microcontr­oller chip.
The Pico is about the size of a USB stick with a new RP2040 microcontr­oller chip.
 ??  ?? The Pico’s RP2040 chip is sophistica­ted enough to handle machine-learning tasks.
The Pico’s RP2040 chip is sophistica­ted enough to handle machine-learning tasks.
 ??  ?? The Pico is backed by the Raspberry Pi foundation and its huge community resources.
The Pico is backed by the Raspberry Pi foundation and its huge community resources.

Newspapers in English

Newspapers from Australia