0

There are loads of Youtube videos on how to control a relay, but I simply want to be able to power up my Pi and let it activate a relay. Then, when I power it down, it should turn the relay off.

No buttons or interfaces, just on and off.

I've built a arcade machine and have illuminated buttons. But I want them to turn on when I power on the pi and off when I'm finished. I have bought the relay as I have LED strips lighting also and just waiting for it to arrive. Do I need code or can I just simply attach to the GPIO 5v and ground?

I'm not sure if just plugging it in and hope for the best is a good idea. It's only £30 to replace, but it's still £30 quid. Grrr!!

Hopefully someone can help .

Kind regards brent

PS. As you can tell I'm not a programmer. I like the idea, but I just need to get this problem sorted first. Then I can mess with the next Pi I buy.

Starting to get the bug...

  • Welcome to raspberrypi and posting a good question. I would be nice if you would edit your post and mention what OS you've installed. It would also be nice if you would link the mentioned Youtube videos. – MadMike Aug 19 '17 at 14:49
  • Just remember to protect the Raspberry Pi GPIO with a "flyck back" diode. Inductive load can destroy your GPIO ports. And normally the Raspberry Pi can't drive a relay, it needs a transistor circuit. example: i.stack.imgur.com/4qyrw.png – MatsK Aug 19 '17 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.