Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces.

Other Raspberry PI boards are SBC –  Single Board Computer which requires an OS on a SD card.

But PICO is a Microcontroller like Arduino.

RPI boards do not have ANALOG inputs , PICO has 3 ANALOG inputs.

Designed on RP2040 IC (Dual-core Arm Cortex M0+ processor flexible clock running up to 133 MHz)

, this PICO board has 26 GPIO pins including 3 Analog Inputs.

As such RP2040 HAS 30 GPIO pins including 4 Analog inputs, but on board the user is offered with only 26 GPIO pins including  3 Analog Inputs.

  • 264KB of SRAM, and 2MB of on-board Flash memory
  • Castellated module allows soldering direct to carrier boards
  • USB 1.1 with device and host support
  • Low-power sleep and dormant modes
  • Drag-and-drop programming using mass storage over USB
  • 26 × multi-function GPIO pins
  • 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
  • Accurate clock and timer on-chip
  • Temperature sensor inbuilt
  • Accelerated floating-point libraries on-chip
  • 8 × Programmable I/O (PIO) state machines for custom peripheral support

https://www.raspberrypi.org/products/raspberry-pi-pico/

pico_pins

PICO can be programmed with C / C++ SDK or MicroPython.

In this blog, we work with MicrPython.

To start with Press & Hold the BOOTSEL button on board and connect the USB to Windows PC.

CONNECT

Release the BOOTSEL button to see PICO appear as a mass storage device RPI-RP2.

Image 1

Open the Device Manager , you see PICO under Portable Devices as RPI-RP2.

Image 2

Open the RP2 storage .

Double click on the INDEX.HTM file to visit the official PICO website.

Image 3

Image 4

Scroll down to click Getting started with MicroPython.

Image 5

https://www.raspberrypi.org/documentation/pico/getting-started/static/f70cc2e37832cde5a107f6f2af06b4bc/rp2-pico-20210205-unstable-v1.14-8-g1f800cac3.uf2

Here download the UF2 file , which is USB Flashing Format by Microsoft.

UF2 files can be opened and edited using a variety of Microsoft MakeCode editors.

To transfer a UF2 file to a microcontroller, developers plug their microcontroller into their PC’s USB drive. Their PC then recognizes the microcontroller as a FLASH DRIVE, allowing the developer to drag their UF2 file to the microcontroller and install their MakeCode program.

Image 6

Drag and Drop the UF2 file on to RPI-RP2.

Image 7

RPI-RP2 now disappears indicating Micropython installation is complete.

If you open the Device Manager , PICO appears as USB SERIAL DEVICE and a COM port is allotted.

Image 8

For GUI interface we use THONNY PYTHON.

Download and install Thonny Python

https://thonny.org/

Image 9

Open Thonny Python

Under Tools –> Options

click INTERPRETER

th1

Under Interpreter drop down select

MicroPython Raspberry Pi PICO   and select the COM port allotted to PICO.

PICO is listed only in the newer version of Thonny.

th2

Now click on the RED stop button to get the Interpreter CHEVERON 3 greater than symbol at the bottom.

You can try MicroPython commands here.

Image 10

To blink the on board LED let us start the coding under Editor.

First import PIN Class from machine module.

Functions are called modules in Micropython.

Then import sleep class from utime module for delay.

Create an led object which takes 2 parameters.First is the GPIO PIN , which is 25 where the inbuilt led is connected.

Second parameter to declare this pin as OUTPUT.

Then starts the never ending loop

while True:

After the colon you get an indentation space automatically.

This is equal to braces in Micropython.

Here we toggle the led and provide a delay of 1 second.

Image 11

Click File –> Save As

Image 12

You get 2 options to save.

Select Raspberry Pi PICO to save the file.

Image 13

Provide the filename as

main.py

Auto execution takes place only if the file name is main.py.

So it is a must to provide file name as main.py.

Image 14

Click on the green RUN button

Image 15

Now the LED on board blinks according to code.

C2[3]

To RESET the PICO back to factory condition

there is another UF2 file under Resetting Flash memory.

Download this nuke UF2 file.

Image 16

Press hold the BOOTSEL button and connect the USB to pc.

IMG_20210205_182142

Drag and drop the nuke UF2 file on to RPI-RP2 to erase flash memory back to factory condition.

There is no RESET button on PICO.

You can connect a RESET button between RUN and GND pin as shown below :

reset

video :

blog_image