Hello and welcome back. In this tutorial, we will learn what is Raspberry Pi Pico board and How to use it step by step. For that, I used an LED blink example. If you are not familiar with this Raspberry Pi, please read my previous article. Then, you can get a basic knowledge of this Raspberry Pi. To do so, use this link.
What is Raspberry Pi Pico?
This is the First microcontroller board and the cheapest board on the Raspberry Pi platform. Also, this board is similar to Arduino Nano. But, the Raspberry Pi Pico board is more powerful than the Arduino Nano board. Because it has a dual-core ARM cortex 32bit CPU,264KB SRAM,2MB Flash memory, and a clock speed 133MHz. Therefore, we can get the best performance on this board. And also, it has 26 GPIO pins. GPIO means General Purpose Input Output. It is a good advantage for making advanced projects. Also, we can program this board using three high-level programming languages. That is MicroPython, C, and C++. We are already used C and C++ in the Arduino platform. But, we will use Python language for this lesson series. I think this is a good opportunity to learn a new programming language. Also, the official language of the Raspberry Pi is Python. But don’t worry, we will guide you step by step from LED blinking to advanced projects. This is just the beginning. Stay with us.
What is Python language?
This computer language belongs to the high-level language category. Also, this is a most famous and powerful computer language around the world. This language is mainly used for functions like AI (Artificial Intelligence), ML (Machine Learning), and DP (Deep Learning). MicroPython is part of this language and is optimized for use in microcontrollers.
We can buy this product in 2 types, That is,
- Pre-soldered male headers.
- Not soldered male headers.
You can choose it, as you like. However, you must solder the Male pin headers to this board. Then, we can use it easily with a breadboard. That is, the Raspberry Pi Pico board is breadboard friendly. Therefore, you can easily connect sensors, displays, and drivers. OK, let’s see other details of this Raspberry Pi Pico.
OK, now we will learn how to use it step by step. For that, the required components are given below.
- Raspberry Pi Pico board x 1 — Amazon
- LED bulb x 1 — Amazon / Banggood
- 180 ohm Resistor x 1 — Amazon / Banggood
- Jumper wires — Amazon / Banggood
- Breadboard x 1 — Amazon / Banggood
- Male pin header x 1 — Amazon / Banggood
Firstly, identify these components.
Secondly, solder the male pin header to the Raspberry Pico board.
Thirdly, mount it to the Breadboard. Then, connect the other components to the Raspberry Pi Pico board. For that, use the circuit diagram below.
Now, let’s download and install the Thonny IDE to the computer. For that follow the instructions below.
- First, go to the Thonny official website and click the download button. Otherwise, click on the link below to download.
- Thonny website — Click me
- Thonny setup — Download
- Now, install it on your computer.
OK, the Thonny IDE is ready for you.
Now, install MicroPython on the Thonny IDE. We can do it in two main ways.
- First, open the Thonny IDE. Then, click the Tool tab and click the Options button.
- Next, select the Raspberry Pi Pico from this list and click the OK button.
- Now, press the hold the BOOTSEL button and plug your Raspberry Pi Pico board to your computer. Then, click the Stop/Restart button and install the MicroPython.
- OK, now run the first test code in the Thonny IDE. For that, use the pictures below.
Ok, now MicroPython is successfully installed.
- First, press and hold the BOOTSEL button and plug your Raspberry Pi Pico board to your computer. Now, you can see the new storage in my computer window.
- Now, open this storage and go to the link using your browser. Then, click the MicroPython and download the “MicroPython UF2” file.
- Next, drag and drop that file to the Raspberry Pi Pico board storage. Then, open the Thonny IDE and select the board as Raspberry Pi Pico.
- Now, you can run your test code.
Ok, now MicroPython is successfully installed.
Now, let’s create the LED blink code. It is as follows.
- Full details of this project – Download
#Import the library files import machine import utime #Include the LED PIN LED = machine.Pin(0,machine.Pin.OUT) while True: LED.value(1)#Turn on the LED utime.sleep(0.5)#Set the delay time LED.value(0)#Turn off the LED utime.sleep(0.5)#Set the delay time
- Now, click the run button and save it on the Raspberry Pi Pico board. Also, you must remember to save it as main.py.
Now, you can see how the LED turns on and off. If you want to blink the onboard LED, use the code below.
#Import the library files import machine import utime #Include the LED PIN LED = machine.Pin(25,machine.Pin.OUT) while True: LED.value(1)#Turn on the LED utime.sleep(0.5)#Set the delay time LED.value(0)#Turn off the LED utime.sleep(0.5)#Set the delay time
Ok, enjoy this project. The full video guide is below. So see you in the next project.
What is Raspberry Pi Pico board and How to use it | Step by step instructions