Raspberry Pi Pico

by Ramatronics Laboratory in Circuits > Raspberry Pi

876 Views, 9 Favorites, 0 Comments

Raspberry Pi Pico

pico.png
pico.png
832996a9-4ef9-491f-bc31-fb719e7e7865.jpg

INTRODUCTION:

In modern world, coding(programming ) is being used widely in every field of engineering. So for engineering students it is necessary that they should learn coding or programming. There are many programming languages to learn. Some of the programming languages which are mostly used are listed below:

  1. Basic
  2. C
  3. C++
  4. Python
  5. Java
  6. Cobol

all programming based projects that I have uploaded before were based on Arduino programming which is a combination of C and C++. But there are some other languages such as python which is as popular as C and C++. So I am going to give you a basic knowledge of python programming and which IDE is easier to start learning python programming. We shall also find is there any microcontroller board available in the market which can be programmed using python. If available, how we can use it to make projects, robots and IOT projects. So let's get started.

Supplies

Raspberry Pi Pico

raspberry_pi_pico_pinout.png
Pico-R3-A4-Pinout_page-0001.jpg

Raspberry pi pico

Raspberry pi pico is a microcontroller development board developed by Raspberry. The main thing about this microcontroller board is that it can be programmed either by C/C++ or by Python. This quality of this board makes it unique for using it in project designing.

Some advanced features of Raspberry pi pico over arduino are given below

Raspberry pi pico uses Raspberry pi 'RP2040' dual core ARM microcontroller. The microcontroller's name can be broken down into sections, each of which has a particular meaning:

RP: means 'Raspberry Pi' simply enough

2: is the number of processor cores the microcontroller has

0: is the type of processor core, indicating in this case the RP2040 uses a processor core called Cortex-M0+ from Cambridge-based Arm.

4: is how much random access memory(RAM) the microcontroller has, based on a special mathematical function: floor(log at base 2 (RAM/16)). In this case, '4' means the chip has 264 Kilobytes(KB) of RAM.

0: is how much non-volatile(NV) storage the chip has, and is worked out in the same way as the RAM: floor(log at base 2(NV/16)). In this case, 0 simply means there is no non-volatile memory storage on-board. The RP2040 is the first microcontroller from Raspberry Pi.

CPU: 32bit dual-core ARM Cortex-M0+ at 48MHz, configurable up to 133 MHz

RAM: 264KB of SRAM in six independently configurable banks

Storage: 2MB external flash RAM

GPIO: 26 pins

ADC: 3 x 12-bit ADC pins

PWM: Eight slices, two outputs per slice for 16 total

Clock: Accurate on-chip clock and timer with year, month, day, day-of-week, hour, second, and automatic leap-year calculation.

Sensors: On-chip temperature sensor connected to 12-bit ADC channel.

LEDs: On-board user-addressable LED

Bus Connectivity: 2 x UART, 2 x SPI, 2 x I2C, Programmable Input/Output(PIO)

Hardware Debug: Single-Wire Debug(SWD)

Mount Options: Through-hole and castellated pins(unpopulated) with 4 x mounting holes

Power: 5V via USB connector, 3.3 V via 3V3 pin or 2-5V via VSYS pin



Programming Raspberry Pi Pico

Screenshot (104).png

Programming the Raspberry pi pico.

As I have mentioned earlier that the Raspberry pi pico can be programmed using either C/C++ or python(Micro Python/Circuit Python). Here I am going to program the raspberry pi pico using Python(Micro Python) programming language. To write python code or sketches, obviously, we need an Integrated development Environment (IDE). The most popular and simplest IDE is Thonny. you can download the Thonny by the link provided below

https://thonny.org/

you can visit the above link to install Thonny on computer or laptop:

Connecting Raspberry Pi Pico to Laptop and Installing Firmware on It

Screenshot (111).png
Screenshot (112).png
Screenshot (113).png
Screenshot (114).png

Connect your Raspberry pi pico board to the computer through a micro-B USB Cable. Now download the UF2 file from the link given below:

https://micropython.org/download/rp2-pico/

https://www.raspberrypi.com/documentation/microcontrollers/micropython.html

After downloading UF2 file, disconnect you Raspberry pi pico board from laptop and now keep on pressing the bootsel button of pico board and again connect the board to the laptop and now please release bootsel button. As you release the bootsel button a folder will automatically open on the screen of your laptop, now paste the downloaded UF2 file in this folder and now your pico board will automatically connect to your laptop and install the latest Raspberry pi pico firmware on the Raspberry pi pico. now open run Thonny on your computer and now you have to select the micropython Raspberry pi pico and COM port at which your pico board is connected to and click on ok. Now to check whether your pico board is connected to Thonny or not type print('hello world') in the shell and just press enter. now if pico board returns you hello world back, means your pico board is connected to Thonny successfully.

Soldering Male Headers on Pico

3d8ee73e-92ff-4be3-b038-360b5656aaf1.jpg
5dfe7711-6fa7-4182-8066-6f1d6c36c8ac.jpg
4cbe53ea-21a9-4026-bbf3-b6753284e3d1.jpg
0e25bd76-d674-456b-8c4d-d3004b9aa13b.jpg

To make your raspberry pi pico breadboard friendly, you should solder male headers to both left and right side of your pico board using soldering tools. you can take the help of my pictures if you don't know how to do that and follow the given steps:

  1. Insert male headers inside the holes provided on both sides of pico board.
  2. Now you can insert the pico board in bread board.
  3. Start soldering the male headers with soldering tools(Soldering iron, flux and wire)

Warning: it is necessary to insert the pico board in bread board and after this you should start soldering otherwise. pico board will not insert in the breadboard easily.

Run Led Blinking Program on Pico Board

6d8e952e-2090-4aff-a167-54401849e70b.jpg

Now go to files and click on new to open a new python file and then type the given python program on the editor

from machine import Pin
from time import sleep

led = Pin(25, Pin.OUT)

while True:
  led.toggle()
  sleep(1)

after writing the above program click on save and then save it either on your computer or Raspberry pi pico board with name. main.py and click on run option. and on-board LED which is connected to the GPIO 25 of the RP2040 starts blinking.

Congratulations! now you have successfully run your first python program on Raspberry pi pico

Enjoy it

Thank you

Read This Book to Understand More About Raspberry Pi Pico

81Ag24mOy-L.jpg