6

The Raspberry Pi Pico is a new $4 microcontroller

 3 years ago
source link: https://www.jeffgeerling.com/blog/2021/raspberry-pi-pico-new-4-microcontroller
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The Raspberry Pi Pico is a new $4 microcontroller

January 21, 2021

Raspberry Pi Pico on breadboard

tl;dr: The Raspberry Pi Pico is a new $4 microcontroller board with a custom new dual-core 133 MHz ARM Cortex-M0+ microprocessor, 2MB of built-in flash memory, 26 GPIO pins, an assortment of SPI, I2C, UART, ADC, PWM, and PIO channels.

It also has a few other party tricks, like edge castellations that make it easier to solder the Pico to other boards.

The Pico is powered by a new RP2040 chip—a brand new Raspberry-Pi-built ARM processor. And the best thing about this processor is the insanely-detailed Datasheet available on the Pico website that steps through every bit of the chip's architecture.

Video Review and 'Baby Safe Temperature' Project

I posted an entire video reviewing the Pico and demonstrating a MicroPython project. The video is embedded below:

Compared to other microcontrollers

When I saw the Pico, I thought immediately of the Teensy LC that's almost identical in size, and also has an ARM M0 processor, but 3x, with a single core, and a lot less flash storage.

The going rate for a Teensy LC is $8, twice the Pico.

There's also the ESP32, but a full package like the Pico offers costs $10-20.

Obviously wireless capabilities on the ESP32 aren't present on the Pico, so you have to discount that in the price, but it is a lot less money for any project that doesn't require WiFi or Bluetooth.

Finally, there's also the Pro Micro, but it offers a different set of tradeoffs and a way slower clock speed than the Pico, and it also costs $10 or more most places online!

Anyways, here are the specs of the Raspberry Pi Pico:

  • It has an RP2040 microcontroller with 2 megabytes of flash storage

    • The processor runs up to 133 MHz, and is based around a dual-core Cortex M0+ design
    • The processor also has 264 KB of SRAM
    • The processor has 2 UART, 2 I2C, 2 SPI, and up to 16 PWM channels
    • The processor includes a timer with 4 alarms and a real time counter, as well as dual Programmable IO peripherals
  • It uses a Micro USB port for power and data, and for programming the flash
  • 40 pins are both through-hole and castellated for mounting flexibility

    • There are 26 3.3V GPIO pins
    • 23 of the GPIO pins are digital-only, and 3 are ADC capable
  • It has a 3-pin ARM Serial Wire Debug port
  • And finally, it can be powered via micro USB or a dedicated power supply or battery

Programming the Pico and writing to the Flash memory

The easiest way to get started with the Pico is to hold down the BOOTSEL button on it while you plug it into a computer. It will be mounted as a Mass Storage Device!

Thonny Python IDE with Raspberry Pi Pico

To program the Pico with MicroPython, you can use the Thonny Python IDE that's already built into Raspberry Pi OS, or you can install it on any Mac, Windows, or Linux PC.

Before you can run MicroPython code, though, you need to follow the instructions on the Pico Getting Started Guide to download a UF2 file that will install MicroPython on the Pico and reboot it. After that, the Pico will automatically run whatever's stored in main.py on the Pico's filesystem when it boots up.

There's an entire book, [Get started with MicroPython on Raspberry Pi Pico](TODO: Add link) available through the Pico website, and I highly recommend it!

Power Consumption

Now that we know a bit about the Pico itself, and how to program it, I need to explain when I'd use a microcontroller instead of a full computer like a Raspberry Pi with it's GPIO pins. For me, the main reason is usually power consumption.

I've done a LOT of power testing for my Raspberry Pi projects. Typically I measure power consumption in Amps and Watts, though there are a few Pi models, like the Model A+ and Zero, that sip only a few hundred milliamps when running at 5V, which translates into 1 to 2 W.

Well, when we talk about microcontrollers like the RP2040 on the Pico, power efficiency on a different planet. In sleep or dormant mode, the Pico consumes less than 2 milliamps, or 6 milliwatts! That's .006 W!

And even when it's running full tilt, doing graphics rendering, it uses less than 100 milliamps, or .33 watts.

If you program it efficiently, you can run the Pico off a small rechargeable battery for days or even weeks!

Conclusion

Raspberry Pi Pico Top

One of the things I don't like about the Pico's design is the lack of pin labels on the top of the device.

Raspberry Pi Pico Bottom

They're all labeled nicely on the bottom, but only pins 1, 2, and 39 are labeled on the top.

There's no way to see which pin is which when I have it plugged into a breadboard. It would be nice if the Pi Foundation could silkscreen labels on top somehow, maybe like the Teensy does it, with little angled labels:

Teensy 4.1

Other than that, there's not much downside to the Pico. I mean, having two cores may be nice for some projects, but most of my own work wouldn't benefit from dealing with the complexity of multiple threads in software. But that's not really a bad thing.

All-in-all, I think the Pi Foundation has a winner with their new $4 microcontroller board, and I can't wait to see what other people come out with based on the RP2040.

You can get a Pico from any of Raspberry Pi's authorized resellers, and I really hope the Pi Foundation can keep up with demand. It would be really sad if they're hard to find months after launch, like what's happened with the Compute Module 4!

One other thing I want to see is a full getting started kit, like you can find for the Arduino. I'm sure some companies will be putting these together.

Anyways, for more details, and a hands-on project, check out my video: The Raspberry Pi Pico Review - $4 ARM Microcontroller


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK