Now go simulate safely, and keep the magic smoke where it belongs—inside the components.
You forgot to connect the Ground (GND) pin of the relay module to the Microcontroller GND. Fix: In reality, lack of GND causes random switching. In simulation, the logic levels float. Ensure the GND net is shared across all components. --- 4 Channel Relay Module Library For Proteus
Before diving into the library, let's understand the hardware. Now go simulate safely, and keep the magic