Stufin
Home Quick Cart Profile

Raspberry Pi Pico with Headers and Micro USB Cable

Buy Now on Stufin

Microcontroller

RP2040 dual-core ARM Cortex-M0+

Frequency

Up to 133 MHz

Memory

264KB SRAM, 2MB flash

GPIO

26 pins (digital input/output, analog input, UART, SPI, I2C, I2S)

ADC

12-bit, 4 channels

Power Management

On-board voltage regulator (1.8V to 5.5V input, 3.3V output)

Operating System

MicroPython, C/C++

Dimensions

21mm x 51mm

Weight

10g

Operating Temperature

-20C to 85C

Accessories

Micro USB cable (included)

Breadboard or perfboard (optional)

Power source (optional)

Sensors and actuators (optional)

Documentation and Resources

Official Raspberry Pi documentation and tutorials

MicroPython and C/C++ documentation

Community forums and project showcases

By combining the Raspberry Pi Pico with Headers and Micro USB Cable with your creativity and imagination, you can build innovative IoT projects that revolutionize the way we live and work.

Pin Configuration

  • Raspberry Pi Pico with Headers and Micro USB Cable: Pinout Explanation
  • The Raspberry Pi Pico is a microcontroller board that features 40 pins, which can be used for various applications such as digital input/output, analog-to-digital conversion, serial communication, and more. Here's a detailed explanation of each pin, along with their functions and how to connect them:
  • GPIO Pins (GP0-GP28)
  • 1. GP0 (Pin 1): General-purpose input/output pin, can be used for digital input/output, PWM, or as an ADC input.
  • 2. GP1 (Pin 2): General-purpose input/output pin, can be used for digital input/output, PWM, or as an ADC input.
  • ...
  • 28. GP28 (Pin 28): General-purpose input/output pin, can be used for digital input/output, PWM, or as an ADC input.
  • Analog-to-Digital Converter (ADC) Pins
  • 29. ADC_VREF (Pin 29): Analog reference voltage input for the ADC.
  • 30. ADC_GP26_ADC2 (Pin 30): ADC input 2, can be used as a general-purpose input/output pin.
  • 31. ADC_GP27_ADC3 (Pin 31): ADC input 3, can be used as a general-purpose input/output pin.
  • 32. ADC_GP28_ADC4 (Pin 32): ADC input 4, can be used as a general-purpose input/output pin.
  • Power Pins
  • 33. VBUS (Pin 33): Micro-USB bus voltage input (5V).
  • 34. VSYS (Pin 34): System voltage output (3.3V).
  • 35. 3V3 (Pin 35): 3.3V power output.
  • 36. GND (Pin 36): Ground connection.
  • Communication Pins
  • 37. UART0_TX (Pin 37): UART0 transmission pin.
  • 38. UART0_RX (Pin 38): UART0 reception pin.
  • 39. SPI0_SCK (Pin 39): SPI0 clock pin.
  • 40. SPI0_MOSI (Pin 40): SPI0 master out slave in pin.
  • Additional Pins
  • RUN (Pin 30, also ADC_GP26_ADC2): Reset pin, active low. Can be used as a general-purpose input/output pin when not used for reset.
  • BOOTSEL (Pin 29, also ADC_VREF): Boot mode select pin. Holding this pin low during power-up enables UF2 bootloader mode.
  • Connecting the Pins
  • When connecting pins on the Raspberry Pi Pico, follow these guidelines:
  • Use a breadboard or PCB with a compatible pinout to connect components.
  • Use jumper wires or copper tracks to connect pins to components or other pins.
  • Ensure that pins are not short-circuited or connected to incompatible voltage levels.
  • Use a level shifter or voltage regulator if connecting pins to components with different voltage requirements.
  • When using the ADC pins, ensure that the voltage input does not exceed the maximum rating of 3.3V.
  • When using the SPI or UART pins, ensure that the communication protocol and pin configuration are compatible with the connected components.
  • Micro USB Cable Connection
  • The Micro USB cable is used for:
  • Programming the Raspberry Pi Pico using a computer
  • Powering the Raspberry Pi Pico from a USB port
  • Connect the Micro USB cable to a compatible USB port on your computer, and the other end to the Raspberry Pi Pico's Micro USB connector.
  • Remember to always refer to the official Raspberry Pi Pico documentation and datasheet for more information on specific pin usage, voltage levels, and programming guidelines.

Code Examples

Raspberry Pi Pico with Headers and Micro USB Cable
Overview
The Raspberry Pi Pico is a low-cost, high-performance microcontroller board from Raspberry Pi, featuring a dual-core Arm Cortex-M0+ processor, 264KB of SRAM, and 2MB of flash memory. The board comes with headers and a micro USB cable, making it an ideal choice for IoT projects, robotics, and prototyping.
Technical Specifications
Microcontroller: RP2040 (Dual-core Arm Cortex-M0+)
 Processor Speed: Up to 133 MHz
 RAM: 264KB
 Flash Memory: 2MB
 Operating Temperature: -20C to 85C
 Dimensions: 51mm x 21mm
 Headers: 40-pin GPIO header, 3-pin debug header
 USB: Micro USB B
Programming Languages
The Raspberry Pi Pico can be programmed using C, C++, and MicroPython.
Code Examples
### Example 1: Blinking an LED using C
This example demonstrates how to use the Raspberry Pi Pico to blink an LED connected to GPIO 25.
Hardware Requirements
Raspberry Pi Pico with headers
 LED
 1k resistor
 Breadboard
 Jumper wires
Code
```c
#include <stdio.h>
#include "pico/stdlib.h"
#define LED_PIN 25
int main() {
    stdio_init_all();
    gpio_init(LED_PIN);
    gpio_set_dir(LED_PIN, GPIO_OUT);
while (true) {
        gpio_put(LED_PIN, 1);
        sleep_ms(500);
        gpio_put(LED_PIN, 0);
        sleep_ms(500);
    }
    return 0;
}
```
Compile and Run
1. Open a terminal and navigate to the directory where you saved the code.
2. Compile the code using `gcc`: `gcc -o blink blink.c -ludev -lstdc++`
3. Run the program: `./blink`
### Example 2: Reading Temperature and Humidity using MicroPython
This example demonstrates how to use the Raspberry Pi Pico to read temperature and humidity values from a DHT11 sensor using MicroPython.
Hardware Requirements
Raspberry Pi Pico with headers
 DHT11 temperature and humidity sensor
 Breadboard
 Jumper wires
Code
```python
import machine
import dht
# Initialize the DHT11 sensor on GPIO 22
d = dht.DHT11(machine.Pin(22))
while True:
    # Read temperature and humidity values
    temp = d.temperature()
    humid = d.humidity()
    
    # Print the values
    print(f'Temperature: {temp}C, Humidity: {humid}%')
    
    # Wait for 1 second before taking the next reading
    machine.sleep(1000)
```
Run
1. Open a terminal and navigate to the directory where you saved the code.
2. Run the program using MicroPython: `python dht_example.py`
Note: Make sure to install the necessary libraries and drivers for the DHT11 sensor before running the code.
### Example 3: USB Communication using Python (Optional)
This example demonstrates how to use the Raspberry Pi Pico as a USB device, communicating with a Python script on a host computer.
Hardware Requirements
Raspberry Pi Pico with headers
 Micro USB cable
 Host computer with Python installed
Pico Code (usb_example.py)
```python
import usb
# Initialize the USB device
usb.init()
while True:
    # Wait for a USB connection
    if usb.connected():
        # Read data from the host computer
        data = usb.recv(64)
        
        # Print the received data
        print(data.decode())
        
        # Send a response back to the host computer
        usb.send(b'Hello from Pico!')
```
Host Computer Code (usb_host.py)
```python
import pyusb
# Open the USB device
dev = pyusb Device(0x0004, 0x00A2, 0x00)  # Replace with your Pico's USB ID
while True:
    # Send a message to the Pico
    dev.write(b'Hello Pico!')
    
    # Read the response from the Pico
    response = dev.read(64)
    
    print(response.decode())
```
Run
1. Run the Pico code using `python usb_example.py` on the Raspberry Pi Pico.
2. Run the host computer code using `python usb_host.py` on the host computer.
Note: This example requires additional setup and configuration for USB communication. Refer to the Raspberry Pi Pico documentation for more information.