The Raspberry Pi Pico is a versatile microcontroller board that’s perfect for a variety of projects. Follow these steps to get started with your Pico on a Windows PC.
Step 1: Gather Your Materials
- Raspberry Pi Pico board
- Micro-USB cable (for power and data transfer)
- Windows PC
- Breadboard and jumper wires (optional, for experiments)
- LEDs, resistors, sensors (optional, for projects)
Step 2: Install the Raspberry Pi Pico Software
1. Download and Install Thonny IDE:
- Visit the [Thonny website](https://thonny.org/) and download the installer for Windows.
- Run the installer and follow the prompts to complete the installation.
2. Download MicroPython UF2 File:
- Visit the [Raspberry Pi Pico MicroPython page](https://www.raspberrypi.com/documentation/microcontrollers/micropython.html).
- Download the MicroPython UF2 file from the official website.
Step 3: Prepare the Raspberry Pi Pico
1. Connect the Pico to Your PC:
- Hold down the BOOTSEL button on the Pico.
- While holding the button, connect the Pico to your PC using the micro-USB cable.
- Release the BOOTSEL button once the Pico is connected. Your Pico should appear as a removable drive named RPI-RP2 on your computer.
2. Copy the MicroPython UF2 File:
- Open the RPI-RP2 drive on your PC.
- Drag and drop the MicroPython UF2 file you downloaded earlier onto the RPI-RP2 drive.
- The Pico will automatically reboot, and the drive will disappear from your file explorer.
Step 4: Configure Thonny IDE
1. Open Thonny IDE:
- Launch the Thonny IDE from your Start menu.
2. Select the Interpreter:
- Go to Tools > Options and select the Interpreter tab.
- Choose MicroPython (Raspberry Pi Pico) from the drop-down menu.
- Ensure the correct COM port is selected for your Pico (you can find this in the Device Manager under Ports).
Step 5: Write and Run Your First Program
1. Write a Simple Script:
- In the Thonny editor, type the following code to blink an onboard LED:
from machine import Pin
from time import sleep
led = Pin(25, Pin.OUT)
while True:
led.toggle()
sleep(1)
2. Save and Run the Script:
- Save the script by going to File > Save As, then choose Raspberry Pi Pico.
- Click the Run button (green arrow) to execute your script. You should see the onboard LED start blinking.
Temperature Reading using R-pi :
Write the given code in your IDE and Save as Temp.py file.
from machine import ADC
import utime
temp_sensor = ADC(4) # Default connection of temperature sensor
while True:
# get raw sensor data
raw_sensor_data = temp_sensor.read_u16()
# convert raw value to equivalent voltage
sensor_voltage = (raw_sensor_data / 65535)*3.3
# convert voltage to temperature (celcius)
temperature = 27 - (sensor_voltage - 0.706)/0.001721
print("Temperature : ",temperature, " degree celcius")
utime.sleep(1)
Follow the Steps given above to Complete the project.
Conclusion :
Congratulations on completing all the steps! You now have a solid understanding of how the Raspberry Pi Pico works. Feel free to experiment with various projects to further enhance your skills. For more project ideas and detailed guides, visit our website. Additionally, explore Skill-Hub by EmbeddedBrew to acquire a wide range of skills in embedded systems. Happy learning!
Hozzászólások