Material for a UC Irvine course offered by the Department of Physics Astronomy and developed by David Kirkby.
The Pico-W is a small, low cost ($6) microcontroller board designed by the Raspberry Pi foundation based on a powerful and low-cost chip, the RP2040. It also contains a 2.4 GHz module for wifi communications (and there is an even cheaper Pico without this wifi module).
Useful links:
Since the silkscreen labels for each pin are on the bottom side of the board, the following diagram is very helpful (download a PDF here):
The Pico includes advanced programmable input/output (PIO) hardware that allows any of the general-purpose (GP) pins to used for hardware-level PWM or communications protocols. For example, to use GP14
for PWM at 1kHz, use:
import board
import pwmio
pwm = pwmio.PWMOut(board.GP14, frequency=1000)
Similarly, to use GP0
and GP1
to run an I2C bus, use:
import board
import busio
i2c = busio.I2C(sda=board.GP0, scl=board.GP1)