I'm completely new to raspberry pi so I'm sorry if this is a stupid question.
I have a raspberry pi and I connected two relays to it.
One of the relays works fine, the other doesn't, and it even looks like any pin I connect to the second relay stops working completely after I connect the relay.
I tested it with LEDs.. I made the LED turn on and off, but then when I replaced the LED with the relay, the pin stops working, even if I replace the relay back with the LED.
What am I doing wrong?

Here's a picture of the relay: enter image description here


  • As outlined by joan's answer those GPIO pins are most likely blown - either by the current drawn to drive the relay or the overvoltage surge when switching of the relay. Sorry to say but somethings about electronic are to be learned the hard way - too bad it's a $30 device and not just some simple IC. Find a simple ciruit with switching transistor and flyback diode to prevent your future RPi in this question: raspberrypi.stackexchange.com/questions/23115/…
    – Ghanima
    Commented Jan 2, 2015 at 17:50
  • Add after edit of question: Ok, so transistor and flyback diode are present in this MCU-compatible module. Question is now, why did the GPIO pins break nonetheless? Ground and VCC (5V that is) have been properly connected with the RPi?
    – Ghanima
    Commented Jan 2, 2015 at 18:59
  • What circuit are you using? Does the relay switch if you set it high (or low?) (5V) Does the RPi GPIO output 5V high? If both conditions are met it should work Commented Jan 2, 2015 at 21:20

1 Answer 1


You should never connect a electromechanical relay directly to a Pi gpio. You will kill the gpio and possibly the Pi. When the electromagnetic field collapses a large voltage will be fed into the gpios. A gpio probably wouldn't be able to supply the needed current for the relay contacts either.

The Pi needs protection, either use a relay board which includes the circuitry (transistors, diodes, etc.) to protect the Pi, or build your own relay board with discrete components.

  • Hi Joan, thank you for your answer. This is the relay that I'm currently using: aliexpress.com/item/… It's not good enough?
    – Ephi Gabay
    Commented Jan 2, 2015 at 18:04
  • Actually that's a relay board designed for use by microprocessors. So you should be able to operate it reasonably safely. Could you edit your post and add an image of the relay? Preferably from the top so the components and markings can be read.
    – joan
    Commented Jan 2, 2015 at 18:11
  • I added the photo to the original post. Thank you :)
    – Ephi Gabay
    Commented Jan 2, 2015 at 18:24
  • Is it branded as Keyes? I can't see the markings on the pins? Are they ground, VCC, and IN?
    – joan
    Commented Jan 2, 2015 at 18:53

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.