FAQ
TL;DR: For ~10 sensors, ESP32’s up to 34 GPIOs fit easily; “integrates Wi‑Fi and Bluetooth” for a one‑board UI + sensors build. [ESP32 Series Datasheet]
Why it matters: This FAQ helps makers decide how to wire and communicate between an ESP32 sensor hub and a Raspberry Pi Pico W touchscreen UI, with clear connection options and pitfalls.
Quick Facts
- ESP32: up to 34 GPIOs, dual‑core up to 240 MHz, integrated Wi‑Fi/BT—strong single‑board option for sensors + UI. [*ESP32 Series Datasheet*]
- RP2040 (Pico W): dual‑core 133 MHz MCU with 2 × SPI controllers and flexible pin‑mux—great for SPI TFTs. [*RP2040 Datasheet*]
- 2.8‑inch Pico TFT: 320×240 SPI display; resistive touch adds extra pins; 3.3 V logic. [*2.8 Touchscreen Display for Raspberry Pi Pico*]
- Arduino Core for Pico W lacks AP+STA mode; plan STA‑only or move AP duties to ESP32. [Elektroda, khoam, post #20246878]
- Sharing SPI for TFT + inter‑board link needs separate CS lines and careful bus arbitration. [Elektroda, khoam, post #20246301]
Can a Raspberry Pi Pico W with a touchscreen control an ESP32?
Yes. Use Wi‑Fi (MQTT or HTTP) or a wired link like UART. The ESP32 can run sensors, while the Pico W drives the touchscreen UI. This split keeps UI timing smooth and sensor logic isolated. Start with MQTT for readable commands and states. [Elektroda, mitagimi75, post #21495491]
Should I put everything on one ESP32 instead of using Pico W + ESP32?
If you want the simplest BOM and wiring, yes. One ESP32 can handle the SPI TFT and the sensors. As one expert said, “Preferably on one ESP32 ;)”. Use this when enclosure space and cable count matter. [Elektroda, khoam, post #20245375]
Will one ESP32 have enough pins for 10 reed and PIR sensors and an SPI touchscreen?
Yes. ESP32 provides up to 34 GPIOs depending on module. Ten sensors typically need ten inputs. An SPI TFT uses a handful of pins plus CS/DC/RESET. You still have headroom for status LEDs or relays. Plan pin mapping up front and avoid strapping pins. [ESP32 Series Datasheet]
Which display library should I use for the Pico/ESP32 SPI touchscreen?
Use TFT_eSPI. It supports SPI TFTs common on Pico and ESP32. Configure the correct driver and pins in the library’s setup file. This keeps code portable between boards if you later consolidate on ESP32. [Elektroda, khoam, post #20245828]
What’s the simplest way to link Pico W UI to ESP32 if the display already uses SPI?
Use SPI for inter‑board comms and share the Pico’s SPI with the display. Give the ESP32 its own CS line. Schedule transfers to avoid display refresh collisions. This minimizes code complexity compared with network stacks. [Elektroda, khoam, post #20246301]
Can I connect Pico W to ESP32 over Wi‑Fi without a home router?
Yes. Put the ESP32 in AP+STA mode and have the Pico W connect directly to the ESP32 AP. Keep the ESP32 visible on your home Wi‑Fi for updates. Add robust reconnection logic in both firmwares. [Elektroda, khoam, post #20246422]
Does the Arduino Core for Pico W support AP+STA mode?
No. The Arduino Core for Pico W does not provide AP+STA mode. Plan a topology where ESP32 handles AP duties and Pico W connects as a station. This avoids feature gaps during development. [Elektroda, khoam, post #20246878]
What protocol is easiest between Pico W and ESP32: SPI, UART, or Wi‑Fi?
SPI is the simplest in software if boards sit close together. UART is also easy and reliable for short distances. Wi‑Fi adds flexibility and range, but it increases complexity and error handling. Start with SPI for quick bring‑up. [Elektroda, khoam, post #20246301]
How many SPI buses does the Pico W (RP2040) provide for sharing with a TFT?
Two hardware SPI controllers are available, and pins are flexibly assignable. You can dedicate one SPI to the TFT and the other to inter‑board comms. This can reduce bus contention and timing issues. [RP2040 Datasheet]
What Wi‑Fi pitfalls should I expect when the UI controls the ESP32?
Expect intermittent drops, stale sockets, and lost acks. Add timeouts, retries, and state machines to reconnect cleanly. Log failures for diagnosis. Edge case: handle rejoin after either device resets mid‑transaction. “This kind of connection requires careful fault diagnostics.” [Elektroda, khoam, post #20246422]
Is that ‘for Raspberry Pi Pico’ TFT actually usable with ESP32?
Yes. The “Raspberry Pi Pico” label is marketing; it is an SPI display. Drive it from ESP32 with TFT_eSPI by selecting the correct controller and pins. Performance depends on SPI speed and DMA settings. [Elektroda, khoam, post #20245828]
If my ESP32 wiring is messy, is splitting UI (Pico W) and sensors (ESP32) sensible?
Yes. Use ESP32 as the sensor brain and Pico W as the touchscreen front‑end. Connect via SPI for low latency or Wi‑Fi for placement flexibility. This keeps cables short near sensors and UI code isolated. [Elektroda, mitagimi75, post #21495491]
How do I share one SPI bus between the TFT and an ESP32 link cleanly?
- Give each device a unique CS line and set idle states.
- Use transactions: assert CS, transfer, deassert CS; never overlap with display refresh.
- Centralize access with a driver or mutex to avoid collisions and glitches. [Elektroda, khoam, post #20246301]
When should I choose two Pico W boards instead of an ESP32?
Choose two Pico W if your UI code benefits from RP2040’s peripherals and you don’t need advanced Wi‑Fi modes. Otherwise, ESP32 typically offers stronger wireless features and enough GPIO to consolidate. Keep module count minimal to reduce failure points. [Elektroda, mitagimi75, post #21495491]