Online Tips n Tricks
Raspberry Pi Pico - Printable Version

+- Online Tips n Tricks (https://a-zgsm.com/tipsntricks)
+-- Forum: Home Automation (https://a-zgsm.com/tipsntricks/forum-17.html)
+--- Forum: IOT (https://a-zgsm.com/tipsntricks/forum-24.html)
+--- Thread: Raspberry Pi Pico (/thread-3726.html)



Raspberry Pi Pico - nnm - 25-07-2021

The Raspberry Pi Pico is vastly different from any model before it. It is the first device to use RP2040 “Pi Silicon” which is a custom System on Chip (SoC) developed by the Raspberry Pi team which features a dual core Arm Cortex M0+ running at 133 MHz, 264KB of SRAM and 2MB of flash memory used to store files.

The one downside of the Raspberry Pi Pico is that there is no wireless connectivity. The RP2040 is the first microcontroller in the Pi range and this brings with it a new way of working. The Pico is not a computer, rather we need to write code in an external application on a different computer and “flash” the code to the microcontroller over USB. In our tutorial on how to get started with Raspberry Pi Pico, we explain how to connect a PC to the Pico and use it to upload MicroPython code.

The Pico and third-party RP2040 boards can use a variety of programming languages, include MicroPython, CircuitPython, C/C++ and Arduino language. There's even Piper Play, a block-based version of Python for the Pico.

MicroPython and C/C++ are the officially supported languages from the Pi Foundation, but CircuitPython, which is similar, has certain advantages such as its built-in support for USB HID, which means that you can turn your Pico into a keyboard, mouse or joystick that's recognized by a PC.

MicroPython on Raspberry Pi Pico
MicroPython is a version of Python 3 for microcontrollers. It was created by Damien George and first used with the PyBoard development board back in 2014. Since then, more devices have adopted this easy to use language and there is a further fork of MicroPython,CircuitPython created by Adafruit which adds further enhancements for their range of boards.  Writing MicroPython code for the Raspberry Pi Pico is possible using the Thonny Python IDE, which is available for all the major OSes, and it is the most accessible way to get started with your Pico.

A fork of MicroPython, CircuitPython has been released for RP2040 boards. Created by Adafruit, CircuitPython has an impressive library of pre-written modules for sensors, LCD / OLED / LED screens and output devices such as thermal printers. Flashing CircuitPython to the Raspberry Pi Pico is as simple as flashing MicroPython, and it is reversible should you wish to revert back to MicroPython or C/C++.

C/C++
Writing code in C/C++ is made possible via two methods. Firstly we can write the code directly in a text editor of our choice and then follow a workflow to build the files which are then flashed to the Pico. Or we can use a graphical workflow and have Microsoft’s Visual Studio Code handle the creation, build and flash process in one application.

You can now now use the Arduino IDE to write code for your Pico. Arduino code is loosely a version of C/C++ so this might be a simpler way to write and upload your code.

Raspberry Pi Pico GPIO Pinout
[Image: NF4vsRaVqecVwjpmX8Cj8n.png]
  • 26 × multi-function 3.3V GPIO pins
  • 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
  • 8 × Programmable I/O (PIO) state machines for custom peripheral support.
  • Castellated module allows soldering directly to carrier boards.
Operating at 3.3V, the Raspberry Pi Pico has a 40 pin GPIO, but it does not share the same form factor as the Raspberry Pis before it. We have GPIO pins for digital inputs / outputs, pulse width modulation (PWM) and for specialist communication protocols such as I2C, SPI, UART/Serial. The GPIO also has three Analog inputs, something other Raspberry Pis lack,  that use variable voltages to connect to, for example, a potentiometers, joystick or light-dependent resistor. 

More importantly, we can also solder header pins to the Pico and use it in a breadboard. See our tutorial on how to solder Raspberry Pi Pico pins for more details.

What You Do With a Raspberry Pi Pico

Retailing for $4, the Raspberry Pi Pico is a cost effective means to tinker with electronics projects and study physical computing.

We can use the power of Pico at the heart of robotics and motorized projects, collect data using sensors for temperature, humidity, light and pollution and we can learn the basics of programming and electronics.

[Image: 8jZ6FYVAoYr9L2ajAEYB6o-970-80.jpg]

The RP2040: Raspberry Pi Silicon
The Raspberry Pi Pico is the first but not the only board to use RP2040. There are around a dozen third-party boards that have been announced and three that we know have hit the market thus far.

Our favorite third-party RP2040 board is Adafruit's Feather RP2040, which features 16MB of storage (versus 2MB on the Pico), 4 ADC channels (versus 3 on the Pico), an RGB light, a built-in Lipo battery connector and, most importantly, the ability to connect to Adafruit's huge ecosystem of Featherwing add-on boards.

We've also tested the Pimoroni Tiny RP2040, which is an extremely-small board that sports 4 ADC channels, 8MB of storage and an RGB light. SparkFun's MicroMod RP2040 puts the SoC on a tiny M.2 board which you can plug into a variety of carrier boards with different features.

Adafruit has also announced an ItsyBitsy 2040, which follows the "ItsyBitsy" form factor and a tiny QT Py 2040 board. Arduino have announced that they are working on the Arduino Nano RP2040 Connect, a variant of the RP2040 with WiFi and Bluetooth. In addition to the MicroMod, SparkFun has two other RP2040 boards coming out.