The Raspberry Pi foundation changed single-board computing when they released the Raspberry Pi computer, now they’re ready to do the same for microcontrollers with the release of the brand-new Raspberry Pi Pico.
Microcontroller and single board computers what are they? Are they any different?
Let’s clarify that first.
The computer runs on operating systems and designed to complete multiple tasks at the same time. While on the other hand, Microcontrollers are a different type of device than Single Board Computers (like the Raspberry Pi 4 and previous generations of Pi), they don’t run an operating system and they are typically programmed to do just one task – though that task can be pretty intricate and exciting! They’re perfect for experimenting with hardware and using it as the brains of custom devices, machines, and inventions.
Examples of Single Board computers are Nvidia Jetson, Raspberry pi etc
And Microcontrollers includes our lovely Arduino, ESP8266, ESP32, STM32 and a new name in this list The Raspberry Pi Pico.
Now the question arises… when we already have a lot of microcontroller boards why we need a new one? And how is it different from Arduino? And should we consider buying it?
Technology changes every day, every new year we get new and faster iPhones and the Arduino UNO R3 which most enthusiasts use released in 2010. We are using a 11-year-old technology.
The Pico is faster than Arduino. As it has faster clock, more memory, more data lanes and capable of handling two tasks at a time using its Dual Cores. It can be programmed with C++ as well as MicroPython.
Pico comes at a small price of 400 rupees only. So, you should definitely buy it.
In this video series we are going to learn how to use a Pico step by step.
This is first video of this series and we will learn
- Installing Firmware in Pico
- Setting up VS Code
- Writing Code for Blinking LED
Firstly, we have to download MicroPython firmware for Pico.
- Open the link in description and go to getting started with MicroPython and download the uf2 file
- Take a data cable and connect Pico to your computer but before connecting press the bootsel button on Pico
- A window will open. Copy the uf2 file to this folder
- and firmware installation is done.
Now we will setup vs code. You may have watched my previous video on how to setup vs code for Arduino. You can check it out from link in description.
- Open vs code and go to extensions
- Search for Pico and install the Pico go extension
- Now we have to install NodeJS and python… using links in description download and install python and NodeJS
- Automatically vs code will give you advise to install python extension … install it also.
Now our setup is done… we are ready to rock
But before that let’s hear a word from sponsors of this video.
Let’s program the Pico
- Close vs code and make a new folder… let’s name it as Pico … now create a new folder with name first project.
- Right click and click on open with code
- Vs code will open.
- Now press control shift + p and search for Pico and select configure project
- Now a .vscode folder will appear in explorer
- Let’s connect the Pico with cable to our computer
- You will see connected to COM port in terminal means Pico is connected
- Create a new file flash.py
- And write code here …
from machine import Pin import time pin = Pin(25, Pin.OUT) while True: pin.toggle() time.sleep_ms(1500) pin.toggle() time.sleep_ms(500)
First line imports pins
Then we will import time for creating delay
Then we will set our pin as output… built-in led is connected to pin 25 on Pico
Then we will create an infinite loop where we use pin.toggle to change led state and give delay in between
- Then we will click on run to run the code
- Now you will see led starts to blink
- Now we can try changing delay to change blink timing.
MicroPython is really an easy language to learn and there are lots of libraries which we can use to program our microcontrollers.
In the next tutorials we will check out PWM pins of Pico.
So that was it for this video. If you like this video give this video a thumbs up share with your friends and don’t forget to subscribe.
Thank you for watching and have a nice day.