Raspberry Pi Pico W Complete Setup Guide¶
Get your Pico W running with OceanRemote - MicroPython & Arduino
📦 What You'll Need¶
| Item | Notes |
|---|---|
| Raspberry Pi Pico W | Must be W version (WiFi capable) |
| USB cable | USB-A to micro-USB (data sync capable) |
| Computer | Windows/Mac/Linux |
| WiFi network | 2.4GHz only |
🐍 Option 1: MicroPython (Easier, Recommended)¶
Step 1: Download MicroPython Firmware¶
Download from: https://micropython.org/download/rpi-pico-w/
Choose the latest .uf2 file.
Step 2: Flash Firmware to Pico W¶
- Hold BOOTSEL button on Pico W
- Connect USB cable to computer
- Release BOOTSEL after connection
RPI-RP2drive appears- Drag the
.uf2file toRPI-RP2drive - Pico W automatically reboots
Step 3: Install Thonny IDE¶
Download from: https://thonny.org
Install for your OS (Windows/Mac/Linux)
Step 4: Connect Thonny to Pico W¶
- Open Thonny
- Run → Select Interpreter
- Choose MicroPython (Raspberry Pi Pico)
- Select the correct port
- Shell should show
>>>
Step 5: Generate & Run OceanRemote Code¶
- Go to OceanRemote Dashboard
- Click "Your Device"
- Select Pico W
- Configure relays and sensors
- Click Generate Code (MicroPython version)
- Copy entire code
- Paste into Thonny editor
- Click Run (green button) or press F5
🔌 Option 2: Arduino IDE (Advanced)¶
Step 1: Install Arduino IDE¶
Download from: https://www.arduino.cc/en/software
Step 2: Add Pico Board Support¶
File → Preferences → Add this URL:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
Step 3: Install Board Package¶
Tools → Board → Boards Manager → Search "Raspberry Pi Pico" → Install
Step 4: Select Board¶
Tools → Board → Raspberry Pi RP2040 Boards → Raspberry Pi Pico W
Step 5: Select Flash Size¶
Tools → Flash Size → 2MB (no FS)
Step 6: Generate & Upload¶
Same as ESP32 process → Click Upload (→)
🔌 Wiring Guide¶
DHT22 Temperature & Humidity¶
| DHT22 Pin | Pico W Pin | Wire Color (typical) |
|---|---|---|
| VCC (pin 1) | 3.3V (pin 36) | Red |
| DATA (pin 2) | GP15 (pin 20) | Yellow |
| GND (pin 4) | GND (pin 38) | Black |
Add 4.7k-10kΩ pull-up resistor between DATA and 3.3V
Soil Moisture Sensor (Capacitive)¶
| Sensor Pin | Pico W Pin |
|---|---|
| VCC | 3.3V or 5V (pin 40) |
| OUT | GP26 (ADC0, pin 31) |
| GND | GND (pin 38) |
Rain Sensor¶
| Sensor Pin | Pico W Pin |
|---|---|
| VCC | 5V (pin 40) |
| AO (Analog) | GP26 (ADC0, pin 31) |
| DO (Digital) | GP14 (pin 19) - optional |
| GND | GND (pin 38) |
Relay Module¶
| Relay Pin | Pico W Pin |
|---|---|
| VCC | 5V (pin 40) |
| IN1 | GP16 (pin 21) |
| IN2 | GP17 (pin 22) |
| IN3 | GP18 (pin 24) |
| IN4 | GP19 (pin 25) |
| IN5 | GP20 (pin 26) |
| GND | GND (pin 38) |
Use external 5V power supply for multiple relays
📊 Pico W Pinout Reference¶
┌─────────────┐
GP0 ─┤ 1 40 ├── VBUS (5V)
GP1 ─┤ 2 39 ├── VSYS (2-5V)
GND ─┤ 3 38 ├── GND
GP2 ─┤ 4 37 ├── 3V3_EN
GP3 ─┤ 5 36 ├── 3.3V
GP4 ─┤ 6 35 ├── ADC_VREF
GP5 ─┤ 7 34 ├── GP28 (ADC2)
GND ─┤ 8 33 ├── GND
GP6 ─┤ 9 32 ├── GP27 (ADC1)
GP7 ─┤ 10 31 ├── GP26 (ADC0)
GP8 ─┤ 11 30 ├── RUN
GP9 ─┤ 12 29 ├── GP22
GND ─┤ 13 28 ├── GND
GP10 ─┤ 14 27 ├── GP21
GP11 ─┤ 15 26 ├── GP20
GP12 ─┤ 16 25 ├── GP19
GP13 ─┤ 17 24 ├── GP18
GND ─┤ 18 23 ├── GND
GP14 ─┤ 19 22 ├── GP17
GP15 ─┤ 20 21 ├── GP16
└─────────────┘
ADC Pins: GP26, GP27, GP28 (0-3.3V input)
PWM Pins: All GP pins except GP26-28
I2C Default: GP4 (SDA), GP5 (SCL)
SPI Default: GP2 (TX), GP3 (RX), GP6 (SCK)
⚠️ Common Issues & Solutions¶
| Problem | Solution |
|---|---|
| Pico not detected | Hold BOOTSEL while connecting USB |
| Thonny can't connect | Check Tools → Options → Interpreter → Port |
| WiFi won't connect | Pico W only supports 2.4GHz networks |
| ADC reads inaccurate | Use GP26, GP27, or GP28 only (not GP26-28 have better accuracy) |
| Upload fails (Arduino) | Hold BOOTSEL, release when upload starts |
| Device stays offline | Check serial monitor for WiFi errors |
| Relay not clicking | Add external 5V power supply |
| Code won't save | Thonny: File → Save As → Raspberry Pi Pico |
💡 Power Options¶
| Power Source | Max Current | Best For |
|---|---|---|
| USB port | 500mA | Testing, 1-2 relays |
| Phone charger | 1-2A | Multiple relays |
| Battery (3.7V Li-ion) | 2000mAh+ | Portable projects |
| External 5V supply | 5-10A | Many relays/pumps |
Pico W draw: ~80mA WiFi active, ~2mA sleep
Relay draw: ~70mA per active relay
🔧 Testing Your Pico W¶
Check WiFi Connection¶
Serial Monitor (Thonny Shell) should show:
Connecting to WiFi...
WiFi connected!
IP: 192.168.1.xxx
Check MQTT Connection¶
Connecting to MQTT...
MQTT connected!
Device registered
Test Relay Control¶
Click relay button in OceanRemote dashboard → You should hear click
Test Sensors¶
DHT22: Temp=23.5°C, Humidity=62%
Soil: 45%
Rain: 0%
📊 Pico W vs ESP32 vs ESP8266¶
| Feature | Pico W | ESP32 | ESP8266 |
|---|---|---|---|
| Price | $6 | $5-10 | $3-5 |
| CPU | RP2040 (133MHz) | Dual-core 240MHz | 80MHz |
| RAM | 264KB | 520KB | 80KB |
| Flash | 2MB | 4-16MB | 4MB |
| GPIO pins | 26 | 25 | 11 |
| ADC pins | 3 (12-bit) | 18 (12-bit) | 1 (10-bit) |
| WiFi | 2.4GHz | 2.4GHz | 2.4GHz |
| Bluetooth | No | Yes | No |
| USB | Native USB | Yes | No |
| Programming | MicroPython/Arduino | Arduino | Arduino |
Best for: - Pico W: Python users, education, low power - ESP32: Complex projects, Bluetooth, multiple sensors - ESP8266: Simple projects, budget builds
🔄 Updating Firmware Over-the-Air (OTA)¶
MicroPython OTA¶
Not supported natively. Use WebREPL for wireless updates.
Arduino OTA¶
- Flash firmware with OTA enabled (default)
- Tools → Port → Network ports → Select your device
- Upload new firmware wirelessly
📚 Next Steps¶
🎓 Learning Resources¶
✅ Your Raspberry Pi Pico W is now ready for OceanRemote automation!