logo elektroda
logo elektroda
X
logo elektroda

ESP32 control using Raspberry Pi Pico with touchscreen display - sensor management

Michal8883 1497 14
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20244497
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    Hello I have an ESP32 which will do the brain of about 10 simple sensors connected by cable. And next to it will be a touchscreen display connected to the Pi PicoW. Now the question is if it is possible to use the pi picoW with the touchscreen to control the esp ie turn the sensors on or off or check if they are active? Is it better to do everything on the same board two pi picoW instead of esp32 and pi picoW.
  • ADVERTISEMENT
  • #2 20245375
    Anonymous
    Level 1  
  • #3 20245378
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    Will I have enough pins for 10 sensors and a touchscreen?
  • #4 20245381
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #6 20245828
    Anonymous
    Level 1  
  • #7 20246135
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    Esp= A tangle of cables and this pi pico elegantly connects just right, for this I wanted to use a set of pico + screen esp brain operation
  • #8 20246301
    Anonymous
    Level 1  
  • #9 20246369
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    And it would be possible over wifi
  • ADVERTISEMENT
  • #10 20246422
    Anonymous
    Level 1  
  • #11 20246713
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    Either combine the two pico's together and give up the esp or it is not worth giving up the esp.
  • #12 20246878
    Anonymous
    Level 1  
  • #13 20246896
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    No comparison esp better and crushes pi pico.
  • #14 20254109
    Michal8883
    Level 5  
    Posts: 135
    Rate: 11
    And what would be the best combination of esp and pico or pico and pico
  • ADVERTISEMENT
  • #15 21495491
    mitagimi75
    Level 3  
    Posts: 5
    You can use a Raspberry Pi Pico W with a touchscreen to control the ESP32, e.g. via Wi-Fi (MQTT, HTTP) or UART. The ESP32 is great for sensors and the Pico W can act as a user interface. If your project is simple, you can use two Pico W, but the ESP32 offers more processing power and better support for wireless communication.

Topic summary

✨ The discussion addresses controlling an ESP32 managing about 10 simple sensors (reed switches and PIR sensors) via a Raspberry Pi Pico W connected to a touchscreen display. The touchscreen options considered include a 2.8" or 3.5" display designed for the Raspberry Pi Pico, typically interfaced over SPI using libraries like TFT_espi. It is feasible to use the Pico W with the touchscreen to control the ESP32 sensors, either through wired SPI communication—though SPI bus sharing between the Pico and ESP32 can be complex—or via Wi-Fi using protocols such as MQTT or HTTP. Setting the ESP32 in AP+STA mode allows the Pico W to connect directly without an external router, but this requires robust error handling in both devices' firmware. The ESP32 offers superior processing power and wireless support compared to the Pico W, which has limitations such as lack of AP+STA mode support in Arduino Core SDK. The choice between using a single ESP32 or combining ESP32 and Pico W depends on pin availability, SDK convenience, and project complexity. For simpler projects, two Pico W boards could suffice, but the ESP32 generally outperforms the Pico W in sensor management and wireless capabilities.
Generated by the language model.

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?

  1. Give each device a unique CS line and set idle states.
  2. Use transactions: assert CS, transfer, deassert CS; never overlap with display refresh.
  3. 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]
Generated by the language model.
ADVERTISEMENT