.st0{fill:#FFFFFF;}

Raspberry Pi

Raspberry Pi Pico W: first connection 

 September 8, 2022

By  Peter

I got a brand-new Raspberry Pi Pico W, courtesy of Sunfounder, and took a day to play with it. In the video (above) and the article in this page I have documented my experimentation with this powerful new microcontroller board.

List of hardware, software, resources

In this experiment, I used this hardware:

I also used this software:

Other useful resources that I mention in the video:

Wiring

For the experiment, the wiring is very simple. As I have not decided what I want to do with my Raspberry Pi W, I decided not to solder the headers. I still wanted to use an external LED for the blink example.

So, I wrapped the LED and resistor pins together (no soldering needed). Here is how to do this:

  1. Find the cathode of the LED (the shorter of the two pins). If both pins have the same length, use the diode function of your multimeter to determine the cathode.
  2. Take one pin of the resistor, and wrap it around the cathode pin of the LED.
  3. Take the free pin of the resistor, pass it through the GND pad of the Raspberry Pi Pico. There are several GND pins on the Raspberry Pi Pico; you should use the one that is next to the GP2 pad, close to the USB connector. Gently bend the resistor pin in a loop and wrap it around it self to minimize movement.
  4. Take the free pin of the LED (the anode) and pass it through the GP2 pad of the Raspberry Pi Pico. Gently bend the LED pin in a loop and wrap it around it self to minimize movement.
  5. In the end, your resistor and LED should be attached to the Raspberry Pi like in the example in the photo (place your mouse pointer over the image to zoom in).

Example code

In this experiment I used simple Micropython code to control the LED, check the model of the Raspberry Pi Pico, and fetch data from the Internet. You can find this code here:

Make the LED blink

>>> from machine import Pin
>>> led = Pin(2, Pin.OUT)
>>> led.value(1)
>>> led.value(0)

Get the model of the Raspberry Pi Pico

>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 19, 1), _machine='Raspberry Pi Pico W with RP2040', _mpy=4102)

Connect to Wifi and fetch data from the Internet

import network

ssid = 'wifi-id'
password = 'wifi-password'

wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)

# Make GET request
import urequests
#r = urequests.get("https://www.google.com")
r = urequests.get("http://date.jsontest.com")
print(r.content)
r.close()

Learn MicroPython with the ESP32

With this course, you will learn how to use the MicroPython programming language with the ESP32 microcontroller.

MicroPython is a high-level programming language specifically designed for microcontrollers and resource-limited embedded devices. Think of MicroPython as “Python for Microcontrollers”.

Learn more…


Tags


You may also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

I got my first Raspberry Pi in 2012 when this single-board computer made its debut. In the following years, I purchased all models: Raspberry Pi 2, 3, 4, Zero and Zero W. In most cases,

Read More
A smart enclosure for your Raspberry Pi: Pironman

Our new course, Raspberry Pi Full Stack Upgrade Project, is now published! See our Black Friday offer at the bottom of this post. This course is perfect for original Raspberry Pi Full Stack graduates and

Read More
New Course: Raspberry Pi Full Stack Upgrade Project (PLUS our Black Friday offer)