Page 1 of 1

RiPi and 3v switch

Posted: Fri Dec 23, 2016 7:33 pm
by derfx4
Hello,

Yes I am newer to all of this so I apologize should any of this be too basic, but I want to clarify before I begin to tackle a project.

I have a gas fireplace that has a switch on the wall to turn on and off. This switch has nothing by 2 DC wires going to a control box to enable the automatic pilot light and spark. I have confirmed both by the manual and volt meter, this DC box is using a 3v source @ ~200ma

What I want to do is use a RiPi w/ HAP-Node and setup as a iOS HomeKit Bridge to add the "fireplace" as a HomeKit accessory to be able to turn the fireplace on/off.

I got the scripting understood, but want to validate the following.

For the wiring, I would need the following (correct?):
1) RiPi
2) 3v Relay
3) Wire PIN 1 of RiPi to Relay VCC
4) Wire PIN 6 of RiPi to Relay Ground
5) Wire 2 "Switch" wires from Fireplace to Relay

Does this logically make sense? Would I need to add anything else based on what was provided (Using RiPi to wire to 3v 200ma switch?)

Appreciate anyones assistance.

Thanks!

Re: RiPi and 3v switch

Posted: Sat Dec 24, 2016 9:28 am
by Burngate
Yes, it makes sense, using a relay to isolate the Pi from the fireplace.
But a couple of things about your relay.

You're connecting the relay between pins 1 & 6. Pin 6 is ground, and pin 1 is 3v3, so the relay will always be on.
Or do you mean you have a relay board such as http://www.ebay.co.uk/itm/3V-3-3V-Relay ... 3641.l6368
That sort of device requires VCC and GND wired as you suggest, and a third connection for control, connected to the GPIO of your choice.

Be aware that relays can take significant current when on, through their coil, and therefore through VCC for one of those boards.
The lower the voltage, the higher the current. The Songle relay on that board http://www.datasheetspdf.com/datasheet/ ... -SL-C.html needs 120mA
I wouldn't try drawing that much current from the 3v3 rail of the Pi without doing more research, particularly as that rail is the main one for the SoC, and even a minor glitch on it could cause havoc.

Perhaps a 5v version would be a better choice? The 5v rail on the Pi has more current capability, and is rather more isolated from the SoC.
While I can't make any recommendation as to brand, many people have had success with 5v ones from Sainsmart.
The one thing to note is that the control terminal can be pulled higher than 3v3 unless you take care. Make sure the supply to the coil is isolated from the supply to the optoisolator on the input.

Re: RiPi and 3v switch

Posted: Sat Dec 24, 2016 9:41 am
by achrn
For ease, you would be better getting a ready-made add-on board intended for the Pi that includes a (at least one) relay.

Driving the coil of a relay almost certainly takes more power than GPIO can deliver - a typical small relay will want maybe 100mA at 5V, and the pins on the Pi will deliver up to 16mA at 3.3V. Also, switching coils on and off upsets delicate electronics such as the Pi's GPIO stages. A ready-made add-on board with a relay will deal with all this.

If you want to learn, however, and build it yourself what you will need is to arrange for the Pi to switch an external transistor, and the external transistor switches the relay. You'll want a resistor between the Pi and the transistor, and a diode across the relay coil (to avoid the problems of switching in coils). Google should find you pages about how to choose the components and hook them up.

Re: RiPi and 3v switch

Posted: Sat Dec 24, 2016 10:16 am
by james-at-lo-tech
If you are happy with soldering then my GPIO board could do what you need with just the ULN2803 (and headers) populated; the DS1820 temperature sensor might also be useful in turning off the appliance once the room gets above a certain point (assuming opening the switch turns it off).

Re: RiPi and 3v switch

Posted: Sat Dec 24, 2016 2:53 pm
by derfx4
Thanks all. Lot to research here. Going to review all of this and see what I come up with.