The essence of this tutorial is to show you the very fist steps to take after purchasing your Raspberry Pi Pico for the very first time.
If you want to get started with microcontrollers and embedded development, one of the most popular and useful devices to use is the Raspberry Pi Pico. The Raspberry Pi Pico is a small low-cost microcontroller device that is capable of handling small uni-directional operations.
It has GPIO pins, much like a Raspberry Pi computer, which means it can be used to control and receive input from a variety of electronic devices.
Before you can get started, you will require the following:
- A functioning Raspberry Pi Pico.
- A Micro USB Cable capable of data transfer.
- Thonny Python IDE.
- Network Connectivity
With the above requirements met, we can proceed.
Installing Thonny IDE
The first step is to install the Thonny IDE on your machine. Thonny is a free and open-source IDE for Python that is well suited for beginners. It is a cross-platform allowing you to install and work with Python on any Operating System.
For simplicity, we will use the Windows Version of Thonny.
Open your browser and navigate to the resource shown below:
Select the IDE for your machine and click Download
Once Downloaded, launch the installer and follow the instructions on the setup device to install Thonny.
Explore the Raspberry Pi Pico
The Raspberry Pi is a simple and powerful device. An example image of the Raspberry Pi Pico is as shown:
Feel free to download the documentation for your device to learn more about the included features.
Add Micro Python Firmware
Before using the Raspberry Pi Pico with Thonny, you need to install the MicroPython firmware on your device.
Step 1. Locate the
BOOTSEL button on your Raspberry Pi Pico device.
Step 2: Press and hold the
BOOTSEL button while connecting the Micro USB cable to your computer and into the Raspberry Pi Pico.
This should connect your Raspberry Pi Pico to your machine as a Mass Storage device.
Launch the Thonny IDE and select Install MicroPython(Raspberry Pi Poco) at the bottom right corner.
This will prompt you to install the MicroPython firmware for your device. Select your target firmware and the version.
Finally, click install to begin the installation process.
Wait until the installation is complete and select Close.
Once completed, from the bottom right corner, select the interpreter and set it to MicroPython.
This will setup the firmware for your device allowing you to plug and start developing your Pico apps.
Lighting the LED For Your Pico
Once the Pico is ready, we can test with a simple LED application.
MicroPython adds hardware-specific modules, such as
machine, that you can use to program your Raspberry Pi Pico. Let’s create a
machine.Pin object to correspond with the onboard LED, which can be accessed using GPIO pin 25. If you set the value of the LED to
1, it turns on.
In the Thonny IDE, Select Shell and add the code as shown below:
>>> from machine import Pin >>> led = Pin(25, Pin.OUT) >>> led.value(1)
This should turn ON the LED on the Raspberry Pi Pico.
You can turn it off by setting the
led.value() to 0.
In this post, you learned how to connect your Raspberry Pi Pico for your device, installing the MicroPython firmware and turning ON the LED on your Raspberry Pi Pico.
Thanks for reading, Leave us a comment down below for a chance to Win a Raspberry Pi Pico.