I have a relay attached to a Raspberry Pi B+ GPIO via two wires, one wire is attached to physical pin 6, a ground pin, the other is attached to physical pin 15 (GPIO. 3, BCM 22, wPi 3).

I have a 2 python scripts which set physical pin 15 to high and low respectively and can verify that the state of the pin changes by running "gpio readall" in a separate terminal - but the relay doesn't change...

I know the relay works as when I move the wire from physical pin 15 to physical pin 1 (the 3.3v pin) the relay switches - I just can't seem to get the GPIO pin to cause the same behaviour, any ideas?

Thanks in advance for any suggestions

  • 3
    which relay are you using?
    – stevieb
    Sep 16, 2016 at 15:21
  • 2
    I hope you mean relay board. Trying to drive a relay directly from the Pi may destroy a GPIO and/or the Pi.
    – joan
    Sep 16, 2016 at 15:29
  • Ah... well the relay I am using is this one...... Could you elaborate on why that could cause an issue?
    – Unencoded
    Sep 16, 2016 at 15:55
  • See: arduino.stackexchange.com/questions/17022/… (similar reasoning applies to Pi GPIO pins)
    – goobering
    Sep 16, 2016 at 16:37
  • On my relay i need to attach 3 wires: VCC, GND and GPIO (which you use to flip the state).
    – Matteo
    Sep 16, 2016 at 16:38

1 Answer 1


Pin 1 is NOT 3.3V, it's 5V! 3.3V is not enough to drive a 5V relay coil. Even if it were, when the voltage driving the relay coil gets turned off, the relay coil will generate a reverse voltage (it's called inductive kickback) as the relay coil's magnetic field collapses. This kickback will rise to whatever voltage is necessary to keep the field from collapsing (sometimes 1000s of Volts!). If you're lucky, the relay might have a reversed diode across the coil, but that's highly doubtful.

  • Before posting answers you should check your facts - Pin 1 is 3.3V. This is not an answer to the question.
    – Milliways
    Sep 19, 2016 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.