This guide requires CircuitPython to be installed on your Pico

If you have not yet installed CircuitPython on your Raspberry Pi Pico, visit our Getting Started product page for the Pico and come back here when you've installed CircuitPython.

Pico Wiring

You MUST use the Pico's VSYS pin for powering the AirLift Breakout.
  • Pico VSYS to AirLift Vin
  • Pico GND to AirLift GND
  • Pico GP10 (SPI1 SCK) to AirLift SCK
  • Pico GP11 (SPI1 TX) to AirLift MOSI
  • Pico GP12 (SPI1 RX) to AirLift MISO
  • Pico GP13 (SPI1 CSn) to AirLift CS
  • Pico GP14 to AirLift BUSY
  • Pico GP15 to AirLift !RST

For more information about the SPI peripherals and pinouts of the Pico, check out this guide.

CircuitPython Installation of ESP32SPI Library

You'll need to install the Adafruit CircuitPython ESP32SPI library on your CircuitPython board.

First make sure you are running the latest version of Adafruit CircuitPython for your board.

Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle.  Our CircuitPython starter guide has a great page on how to install the library bundle.

You can manually install the necessary libraries from the bundle:

  • adafruit_bus_device
  • adafruit_minimqtt
  • adafruit_io
  • adafruit_esp32_spi
  • adafruit_requests

CircuitPython Usage

Connect to the board's serial REPL via Mu so you are at the CircuitPython >>> prompt. Once that's done, load up the following example in Mu and save it to the Pico as code.py.

import board
import busio
from digitalio import DigitalInOut

from adafruit_esp32spi import adafruit_esp32spi
import adafruit_requests as requests

print("Raspberry Pi RP2040 - ESP32SPI hardware test")

esp32_cs = DigitalInOut(board.GP13)
esp32_ready = DigitalInOut(board.GP14)
esp32_reset = DigitalInOut(board.GP15)

spi = busio.SPI(board.GP10, board.GP11, board.GP12)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)

if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
    print("ESP32 found and in idle mode")
print("Firmware vers.", esp.firmware_version)
print("MAC addr:", [hex(i) for i in esp.MAC_address])

for ap in esp.scan_networks():
    print("\t%s\t\tRSSI: %d" % (str(ap['ssid'], 'utf-8'), ap['rssi']))

print("Done!")

Once all the files are copied from your computer to the Pico, you should have the following files on your CIRCUITPY drive.

The output to the serial monitor should look something like the following:

Make sure you see the same output! If you don't, check your wiring. Once you've succeeded, continue onto the next page!

If you can read the Firmware and MAC address but fails on scanning SSIDs, check that your AirLift is wired to the Pico's VSYS pin.

This guide was first published on Mar 05, 2021. It was last updated on Apr 15, 2024.

This page (CircuitPython WiFi) was last updated on Mar 08, 2024.

Text editor powered by tinymce.