Troubleshooting Random Relay Triggers on ESP32 Setup

Hey everyone, I recently set up an ESP32 board to handle a variety of tasks, including temperature measurement, ultrasonic sensing, and controlling four relays with three buttons. While the sensors are working perfectly, I’m encountering an issue where the relays occasionally trigger randomly, even when the buttons aren’t touched. This is quite puzzling, and I’m hoping the community can help me figure out what’s going wrong.

Here’s a quick overview of my setup:

  • ESP32 Board: Configured to handle GPIO pins for relays and buttons.
  • Relays: Connected to 5V power supply.
  • Sensors: Temperature and ultrasonic sensors are functioning as expected.
  • Buttons: Using pull-down resistors in the configuration.

I’ve tried several troubleshooting steps:

  1. Power Supply Check: Ensured all components are powered correctly. Relays are on 5V, sensors on 5V, and the ESP32 on 3.3V.
  2. GPIO Connections: Double-checked all connections to ensure there are no loose wires or short circuits.
  3. Code Review: Went through the code to ensure there are no unintended triggers or bugs in the logic.
  4. Pull-Up Resistors: Initially used software pull-down, but later added physical pull-up resistors to see if that helps.

Despite these efforts, the issue persists. I suspect it might be related to electrical noise or grounding issues, but I’m not entirely sure. Has anyone else experienced similar problems with ESP32 relays? Any suggestions on how to isolate or resolve this issue would be greatly appreciated!

Looking forward to hearing from you all!