0

I'm looking at 2 projects, one is using relay to a garage door opener. The other is using reed switches to monitor door openings and closings.

The relay goes to the GPIO, the reed switches go to a breadboard add on that covers the entire GPIO. Is there a way to do both?

thanks

edit: More details

I would like to add 1 relay for garage door, and three reed switches for other monitors. How could I wire that to the GPIO?

more more

http://www.amazon.com/Normal-Recessed-Magnetic-Contacts-Switch/dp/B0056K5ZC2/ref=sr_1_4?s=electronics&ie=UTF8&qid=1422215465&sr=1-4&keywords=reed

http://www.amazon.com/SunFounder-Channel-Shield-Arduino-Raspberry/dp/B00E0NTPP4/ref=sr_1_4?s=electronics&ie=UTF8&qid=1422214275&sr=1-4&keywords=relay

3
  • Hello and welcome! The answer is highly likely "yes". The simple solution (direct connection of the relays and switches to GPIO) depends on the number of things to connect - less than number of available GPIO, you're fine. If it is more port expansion will be necessary. Obviously for any substantial answers it would be good to add those details to the question.
    – Ghanima
    Commented Jan 25, 2015 at 19:40
  • It would also help if we could see a photo of the specific parts or at the very least a link to the part online. Commented Jan 25, 2015 at 19:48
  • you guys are fast...sorry for the poorly detailed question.
    – wlraider70
    Commented Jan 25, 2015 at 19:52

1 Answer 1

1

It would be simpler if you didn't have this breadboard add on that presumably covers the expansion header. What is that for?

To control the relay you'd connect a Pi 5V pin to VCC, a Pi ground pin to GND, and two gpios of your choice to IN1 and IN2. Set the gpios as outputs. Setting a gpio high should operate the relay. It should work from the Pi as it claims to work with an MSP430 which is also a 3V3 device.

For the reed switches connect one end to ground and the other end to gpios of your choice. Set the gpios as inputs with their internal pull-ups to 3V3 enabled. The gpios will normally read back as 1 but will read back as 0 when the corresponding reed switch is closed.

It might be safer to connect all the gpios via 300 ohm resistors. I.e. between each gpio and IN1/2 and between each gpio and its corresponding reed switch. This will provide a level of protection if you misconfigure the gpio settings.

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.