4
\$\begingroup\$

To start

I have only a cursory knowledge of electronics... I "know" what all the basic components do, but I have not figured out how to use that knowledge to design anything (much less evaluate someone else's designs). I will be solely reliant on YOUR upvotes to give me the right answer.

Background

The Raspberry Pi is a tiny/low-power general-purpose computer (ARM) which has a set of "GPIO" pins which allow it to interface with other components. It has a 5v power pin, a ground pin, and several pins which can be set to "high" or "low" (where "high" = 3.3v) that can be used to trigger other events.

I know I saw it, but I can't recall now where (and can't seem to find it), but the max current draw for the 3.3v is fairly low... in the low-hundred mA.

The primary "chip" (processor, GPU, etc) is something from Broadcom.... and they refuse to give specs if you haven't signed an NDA.... so, WHAT may damage the computer is a pretty big question, but people have reported that "a little" current going "back up" the GPIO output pins has been enough to fry the board. I assume (but see the aforementioned "to start"), but don't REALLY know, that this means the resulting circuit may need to be opto-isolated?

Background (part 2)

Everyone in the world seems to want to use these things to control real-world objects since they're general-purpose Linux machines (and can, thus, be programmed in your-favorite-language). The problem is that all of the relay boards in this space are, currently, designed for the Arduino's 5v output.

Question I have seen a design or two for how to build a circuit that can use the 3.3v to use the 5v to trigger a relay, but there doesn't seem to be any consensus in the community for how to do so SAFELY. Given that I'm not qualified to evaluate the supplied circuits, can someone please explain to me how to use a 3.3v trigger to SAFELY use a 5v line to operate a relay?

Bonus Points: There have been people claiming success at using the various SainSmart 5v relay boards (designed for Arduino) on the 3.3v lines... is this safe? Will it ACTUALLY work?

\$\endgroup\$
  • 2
    \$\begingroup\$ Have you taken a look at the Gertboard? It's available pre-built and schematics are available if you prefer to roll your own. It doesn't include relays but has a ULN2803A to drive an external ones, and I suspect it'll be easy to find info on how to connect the Gertboard to a relay and do the software side of things. \$\endgroup\$ – PeterJ Feb 8 '13 at 7:57
  • 1
    \$\begingroup\$ We know your input towards the relay: 3.3V DC signal from RPi. But we need to know your output. What device will the relay be driving? What is the voltage and current requirement of that device? \$\endgroup\$ – shimofuri Feb 8 '13 at 8:47
  • \$\begingroup\$ The total current draw of the entire system is a few hundred mA, what you can draw from ONE PIN of the CPU is likely to be less than 10mA. The general question "how to do I drive a relay from a 3.3v chip?" has been answered numerous times here. Reading up on the Gertboard will also give you the answer. \$\endgroup\$ – John U Feb 8 '13 at 9:10
  • \$\begingroup\$ And a bonus one to start you off: electronics.stackexchange.com/questions/56093/… \$\endgroup\$ – John U Feb 8 '13 at 9:20
4
\$\begingroup\$

First, checkout this answer on the RasPi SE. https://raspberrypi.stackexchange.com/questions/1633/how-can-one-control-ac-power-220v-with-a-raspberry-pi. Avoid using Solid State relays for controlling appliances with motors (cooling fans, winches, ski-lifts, escalators, washer Spin-Cycle, etc), unless the manufacturer says it's ok. Look online for more info on how to mitigate inductive loads with solid-state relays.

I wouldn't use the PasPi pins to directly drive anything over 4mA particularly relays. Use a transistor with kick-back protection (see below).

There is also a RasPi friendly SCR daughter board that allows you to trigger 110Volts. At our local hacklab, we used one of those to trigger a Pop Machine to dispense drinks via RasPi. Works fine and everyone is so far safe.

If you're bent on triggering a mechanical relay, you can use a Power MOSFET like this one FDC6303N to trigger your relay. This FET has built-in protection diode for the inductor kick-back. just watch that your relay voltage and amperage is below the tolerance of the FET. You could use a ULN2000 series Bi-Polar transistor as well (as suggesed. I personally like FETs). There are non-surface mount versions of these as well.

Some Safety notes:

  • You can use a watch-dog chip to turn off the relay if the RasPi is hung or gone crazy. this means that every few seconds your RasPi will have say to the Watchdog: "I'm still sane" by doing something (send a digital message or flick a pin up/down).

  • I would use a somewhat-weak (50-100K) resistor to pull the controlling pin of your RasPi in the direction that turns the Relay Off (in-case your system goes to an unknown state and/or the pin floats).

  • Make sure the 110-220V stuff (if on the same board) are physically far and separated.

There are examples on the RASPI site for working with the GPIO pins.

Finally, what you're trying to do could obviously be hazardous. This post will by no-means whatsoever guarantee safety and operation. I'm just sharing what I've learned in hopes that with the help of this community, you get what you want. Verify this info on your own, and make your decision at the end.

\$\endgroup\$
0
\$\begingroup\$

If these are the opto-isolated boards with a connector having separate power supply inputs for the two sides of the isolator, then you could probably bring it within the pi's specs by using a 3.3v supply on that side.

The question is then if this would be sufficient to turn on the optocouplers; if not, changing the series resistor or shorting out the status LED that is in series would probably actuate it.

If you can get the part number of the optocouplers you can look up their specs.

\$\endgroup\$

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.