If I connect a relay to Raspberry PI (Ground to Ground, VCC to 5v, and switch pin to one GPIO), when I write 1 on that pin, the relay switches on and off.
But, if I connect the relay Ground and VCC to USB power wires (5v), I can't control it from Raspberry GPIOs. An external switch, also connected to the USB wires, triggers switching in the relay.
Does anybody have an explanation for this behaviour ?
TLDR; power and control signals are working only if they have the same source (Raspberry or USB powered devices)