1

I'm looking to do something that SHOULD be pretty simple, but electricity is a strange beast to me. If I can get this wired up correctly, I can do the scripting just fine.

Basically I want to push a button and turn on/off an appliance. The appliance should be getting power from an external source and the RPi should serve only to supply or deny power to it.

I understand the software side of this problem, but I can't envision the physical setup. How do I give my Pi control over these voltages without frying everything?

  • 1
    Think in terms of inputs and outputs, break down the system. 1. Button is an input to the rpi, which is binary (0 - 0v or 1 - 3v3). 2. Software (script) will get an event (or you can call it interrupt from the hardware perspective). 3. It will execute a certain part of the code upon getting an event (just like a button in a simpleUI terms). 4. the part of that event code will be switching on (or off) an output again a binary (0 - 0v or 1 - 3v3). Here comes the tricky part. :) That output drives a transistor which could be used to operate a relay or fire a triac which are nothing but a switch. – dhruvvyas90 Sep 14 '15 at 19:00
1

To control external appliances it is probably simplest to buy a relay designed for that task.

The relay can safely switch mains voltages under computer control. The GPIOs may be used to command the contacts to open or close.

See http://www.ebay.co.uk/itm/252051910091 for an example of the sort of relay to buy. This is not an endorsement.

  • 1
    Okay, so if I understand, this device will let me plug 8 devices into a bay of switches and control them via software. That seems pretty much ideal so long as I still have enough pins left over to wire up the buttons. I am concerned with the power inputs however. Will I need to wire up 8 separate 120V power sources to this thing if I want to power 8 appliances? – user7567 Sep 14 '15 at 19:39
  • Excuse me, that was a stupid question. The devices would be plugged into the wall outlets. A better question would be "How do I hook up the appliance to the relay? Would I need to cut wires to get them to the relay or is there a better way?" I apologize, but I have never worked with a relay board before. – user7567 Sep 14 '15 at 19:51
  • The power would have to flow through the relay contacts. I don't know the best way of doing this neatly and safely. You might want to look at something like a "power switch tail", e.g. powerswitchtail.com/Pages/default.aspx – joan Sep 14 '15 at 20:29
  • Okay, it looks like I would need to hire an electrician to wire this up. The end project would be set up in a commercial setting and I am not familiar enough with the building code to do this myself. This seems like a much more hazardous project than I expected. :/ – user7567 Sep 14 '15 at 20:50
  • @user7567 In a commercial setting I doubt you have any choice but to hire an electrician (insurance reasons alone). They will be able to advise the best approach. – joan Sep 14 '15 at 21:21
1

Assuming your "appliance" is on mains power (e.g. 110V/220V, etc.) you obviously cannot run the current through the controller. What you need is an isolated relay, where the appliance current path is completely separate from the control path.

These are extremely common, so you just need to find one sized properly for your use case - one with a switching voltage of 110VAC, and coil voltage of 3.3V, for example. There are a litany of varieties with different properties and form factors, and you really need to get someone with electronics experience to weigh in on the specifics of what your application requires.

In a commercial setting you likely need to use the services of an electrician for compliance and potentially union reasons. In many cases you would simply build the relay into a basic electrical outlet with standard plugs, with the relay in between them, which ends up looking something like this:

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.