Announcement

Collapse
No announcement yet.

How to Get 2 Relay SPDT Outputs and 3 Dry Contact Inputs On Raspberry Pi

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to Get 2 Relay SPDT Outputs and 3 Dry Contact Inputs On Raspberry Pi

    I want to use this plugin and a Raspberry Pi 3+ to control at least 2 Relay SPDT Outputs and 3 Dry Contact Inputs. How can this be done? Is there a shield that I can purchase? Should I instead wire them directly to the native 40 PIN GPIO? If so, how do I get 2 Relay SPDT Outputs and 3 Dry Contact Inputs onto the 40 PIN GPIO?

    Thanks for any help!
    ---------------------------------------------------
    Jean-Marie G. Vaneskahian
    jean@vaneskahian.com
    ---------------------------------------------------

    #2
    You can wire this up yourself or use various Pi Hats. There are many examples of how to roll your own on the Interweb. As for a prebuilt hat the PiFace Digital 2 comes to mind. spud has the Spud RaspberryIO Software Plug-in for HS3.

    You could also us an Arduino with Greig Dempster Arduino Software Plug-in for HS3.

    Comment


      #3
      I do just that using the RPi 3 GPIO pins for the dry contacts, and a relay hat for the SPDT relays (3) using this:

      https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

      The relays respond to GPIO out pins, so it's really easy to setup using Spud's RaspberryIO plugin. My Raspi is handling garage doors and sensors on a remote Pi connected via Wifi, and it's been flawless since I installed it.

      Comment


        #4
        dzee, I saw that board and it made sense since it will handle the Relay Outputs using the GPIO pins, but how do you take the dry contact inputs on any of the remaining pins? I am sure it it not hard, but do you have schematic of what you have done? What GPIO pins did you use for your dry contact input?
        ---------------------------------------------------
        Jean-Marie G. Vaneskahian
        jean@vaneskahian.com
        ---------------------------------------------------

        Comment


          #5
          Jean, you sure you don’t want to do this via the Elk?
          HomeSeer 2, HomeSeer 3, Allonis myServer, Amazon Alexa Dots, ELK M1G, ISY 994i, HomeKit, BlueIris, and 6 "4k" Cameras using NVR, and integration between all of these systems. Home Automation since 1980.

          Comment


            #6
            Yes, I would FAR prefer to do this via the ELK, but this is for controlling outdoor items where I do not have all the needed wiring. I need 2 SPDT relay outputs (I have plenty of those on my ELK) and 3 simply dry contact inputs (again, tons of those on the ELK), but to do that I need 12 wires.. I currently have a CAT 5e run to the outdoor location and power is very close by so I figured I would simply supply the power and do the logic at the location and use the CAT 5e to give the Pi network connectivity.

            Had I run 18/2 and a few more CAT 5e to that outdoor location from the wiring closet I could have done everything from the ELK (which is exactly what I would have wanted).

            So now I need to learn how to make the Pi do what I do on the ELK
            ---------------------------------------------------
            Jean-Marie G. Vaneskahian
            jean@vaneskahian.com
            ---------------------------------------------------

            Comment


              #7
              Hi Jeanv, The relay board only handles the outs (relays) and the RaspPi handles the dry contacts directly by setting whichever GPIO pins you like (that aren't already spoken for by the relay board) as Input in Spud's plugin. See screenshot below.

              I have magnetic reed switches connected as dry contacts, and haven't had a problem with bounce. You'll notice that the relay board I posted earlier has pins to add another hat on top of it. Note that some do not. Either way, you can connect your dry contacts right onto the GPIO pins but I used a break-out board. This just takes the pins from the RasPi and runs them out to solder pads. So, I have the RasPi, the breakout board, and finally the relay module stacked inside a weather-tight enclosure.

              Here's what this looks like once setup inside the RaspBerryIO Plugin, and an event that checks the status of a dry contact and then triggers the relay for a 1000ms pulse to run the garage door opener (or in this case "closer").


              Click image for larger version  Name:	relay.png Views:	1 Size:	428.8 KB ID:	1265933
              Click image for larger version  Name:	relay-event.png Views:	2 Size:	89.7 KB ID:	1265934

              Comment


                #8
                Another way is to use the Pimoroni Automation HAT for Raspberry Pi. It has three SPDT relays, three output that can handle 24V loads, three pinouts that can handle 24V inputs and 3 analog inputs that can handle 24V inputs. Just use it without the Automation HAT drivers and don't use the I2C pins for I/O.

                You won't be able to use the analog inputs with RaspberryPi IO but I hope that someday RaspberryPi IO will be able to handle the board including its LEDs and A2D.

                I'm ordering one and will be looking to update the native drivers so it can drive the LEDs.
                HomeSeer Version: HS3 Standard Edition 3.0.0.548
                Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
                Number of Devices: 484 | Number of Events: 776

                Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
                3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
                4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
                3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

                Z-Net version: 1.0.23 for Inclusion Nodes
                SmartStick+: 6.04 (ZDK 6.81.3) on Server

                Comment


                  #9
                  dzee, thanks so much! I just ordered the relay board you told me about from Amazon and some female to male pin wires. I am confused about a few things:
                  1. You talk about a break out board... like a breadboard? Why? (Can you not just connect directly to the GPIO pins that the relay board exposes that the relay board itself does NOT use? (From what I read, it uses GPIO PINs# 37 (BCM 26), 38 (BCM 20), 40 (BCM 21) so I should be free to use the other GPIO pins, right?)
                  2. I see in the screenshot you posted a reference to a "resistor" field... I do not understand this field. You say you are connected a simple reed switch to the pins and that is it, what resistor are they talking about here?

                  Thanks for any guidance!
                  ---------------------------------------------------
                  Jean-Marie G. Vaneskahian
                  jean@vaneskahian.com
                  ---------------------------------------------------

                  Comment


                    #10
                    dzee, I think I just found the answer online.. This must be the Raspberry Pi's internal pull-up or pull-down resistors that you can enable for digital inputs so the Pi can detect when a switch is closed (it changes the pin state from High to Low or Low to High). So there is no need for any external resistor correct? Also, is there a preference as which GPIO pins to use for the inputs?
                    ---------------------------------------------------
                    Jean-Marie G. Vaneskahian
                    jean@vaneskahian.com
                    ---------------------------------------------------

                    Comment


                      #11
                      Jeanv, Yes, you got it. I used the breakout board so that I could just solder it down, and if I ever need to pull the RasPi for service, I can keep all the wires attached to the break-out board and relay board, and not have to worry about connecting the wires back to the right pin. Of course, you can do that with the relay board too, since it has pins on top to add another hat. I have another relay board that is identical except it does not have the through pins to add another hat on top of it.

                      Regarding the resistors, yes, those are the RaspPi's internal resistors that can be set from the RaspberryIO software. No need for an external resistor. I have fairly short runs between the dry contacts and the device. With regard to GPIO pins, the relay has defaults and jumpers to select alternates, but after you choose those, use whatever is left and assign them to inputs in the plug-in.

                      I've not had a single problem with the reliability of this setup since it went in this spring, and its reaction time is nearly instantaneous so I couldn't be happier. Especially since it's also communicating over Wifi.

                      Comment


                        #12
                        dzee, thanks again! I have 3 Ubiquiti dedicated APs thought the house, but I did not consider connecting the Pi to WIFi (I had planned to use the 1 CAT 5e I have run to the location.

                        Some final questions:
                        1. Have you not had any connectivity issues at all over wifi?
                        2. Does the remote Pi reconnect automatically if you reboot the HomeSeer PC or connectivity is temporarily lost?
                        3. Does the remote Pi reconnect automatically if you reboot the remote Pi with no problems to the HomeSeer PC?
                        4. Do the relays ever change state randomly or after a reboot? (same applies to the digital inputs)

                        I already purchased the board, I have a few Pi 3's and am about to purchase Spud's RaspberryIO so I am just asking so I know what I am getting into...

                        This will be controlling the main water valve the comes into my home. The valve will have to be installed in the front yard in my flower bed (I wish the builder has put it in the garage behind a panel). The valve has micro switches at the end points of the Open and Close and they provide feedback of the valve status. I built a little box to demo it before I automate it.

                        ---------------------------------------------------
                        Jean-Marie G. Vaneskahian
                        jean@vaneskahian.com
                        ---------------------------------------------------

                        Comment


                          #13
                          Originally posted by jeanv View Post
                          This will be controlling the main water valve the comes into my home.
                          What is the total cost of building this solution? HomeSeer sells a z-wave water shutoff kit for about $250. I would like automatic water shutoff so I want to compare the two solutions.

                          Comment


                            #14
                            I bought the valve for $50 on Amazon here:

                            Motorized Ball Valve- 1" Stainless Steel Electrical Ball Valve with Full Port, 9-24V DC and 5 Wire Setup, can be used with Indicator Lights, [Indicate Open or Closed Position] by U.S. Solid https://www.amazon.com/dp/B06XCN8V6W..._0vjeCb7N075T3

                            A raspberry pi and the relays.. this to me is a better approach than zwave primarily since I cannot co-locate the valve and the controller. I soldered 50 feet of burial grade cat 5E cable to the valve.


                            Sent from my iPhone using Tapatalk
                            ---------------------------------------------------
                            Jean-Marie G. Vaneskahian
                            jean@vaneskahian.com
                            ---------------------------------------------------

                            Comment


                              #15
                              dzee, do you have the model of the breakout board you soldered your input to?
                              ---------------------------------------------------
                              Jean-Marie G. Vaneskahian
                              jean@vaneskahian.com
                              ---------------------------------------------------

                              Comment

                              Working...
                              X