Need relays module / shields for Fez Panda 2

@ godefroi - would your design work with to control motors using a 12V bipolar DC signal? I’ll start another thread to continue this conversation… topic = “FEZ control of DCC electronics”


I built a 16-“relay” module using shift registers and optotriacs. I use them to switch 24VAC power to solenoids in my sprinkler controller, but you could just as easily switch something else, if it’s low enough current. Optotriacs are nice in that they’re cheap, and they don’t wear out[/quote]
Hi, I tried to build one of those boards… but did not succeed…this is what i need, can you give me the schematic? wiring and connections to fez panda II ?

Sure, it’s pretty simple. Your first step is to be sure that you can drive your shift registers well. For this step, I just wired up the shift registers (I use 74HC595 shift registers) with LEDs. You can see a video of this here: 16-bit shift register usage, FEZ Panda II - YouTube

Once you’re solid on that step, you just start driving optotriacs instead of LEDs (the optotriac IS an LED, just packaged inside a plastic case right next to a phototriac). The optotriac is wired up exactly like a relay. It has two wires on the triac side, and two wires on the LED side. The LED side is the “coil”, and the triac side is the “contacts”. Remember your current-limiting resistor for the LED.

I based the design on the schematic below, but I don’t use the transistors, because the shift registers can put out enough current for the LEDs in the optotriacs. I connect the shift registers to the Panda II with a few normal GPIOs (though one could drive them with SPI faster, I believe).

hi godefroi, thank you for your reply… i make an indecent proposal to you :smiley: : can you make a schematic with all wiring system starting from fez pins to the output (like a bulb) ?
This because i’ve already tried in past to do a board like you describe (see image in a my reply in this post), but without success…
Can you make this please? ::slight_smile:

Thank you again

It’s really very simple. Something like this. Note that I don’t guarantee that this will work. This is what I did, or as close as I can remember without having looked at it for several months. Make sure you know the forward current on your optotriacs, if you use those, or use transistors to drive relays, if you’re using relays. Make sure you’re not exceeding maximum power output in the shift register (only one of my solenoids is ever on at a time, so I don’t have to worry).

If you want more, just daisy-chain more shift registers together. Information on how to do this is widely available. You can daisy-chain a lot of them together. Maybe an infinite number.

@ godefroi - Got time to give a quick lesson on optotriacs? That sounds like an interesting alternative to relays that eliminates the noise. I’m not quite sure how to read the datasheet though. Which numbers should I be looking at to determine the maximum output voltage & current that I can switch? Here’s the datasheet on the S202SE1 you’re using. There’s a wide range of values and I’m not sure which I need to look at. I’m using a relay to switch a 24V solenoid water sprinkler valve using a relay now. Would this optotriac work for it also?



@ ianlee74 - I’m not actually using that optotriac, I’m using a PR26MF12NSZF. The S202SE1 is actually just a part with the right symbol that was in my Eagle library :slight_smile:

An optotriac is just an optocoupler with a triac output stage. That is to say, it’s exactly as if you had hooked up the output of an optocoupler to a triac. A triac is essentially a transistor that can switch current in both directions. It’s like an AC transistor.

Optotriacs are also known as “solid state relays” (sometimes) and they come in quite high current versions. The ones I’m using are 120VAC 600mA, and they come in “zero crossing” and “non-zero crossing” versions. Mine are “non-zero crossing” That refers to whether they will turn themselves off only at the zero crossing. If you use a zero-crossing type to switch DC, you can’t turn it off unless you cut the power on the output side.

When you use an SSR you need to be aware of the “phase difference between voltage and current” when you turn the thing off, if you’re driving inductive loads (solenoids are the canonical example of inductive loads, as are motors). The Sharp datasheet gives some information on this, and recommends a snubber circuit. This gives the current from the inductor somewhere to go if you turn it off while the coil is energized.

I asked several questions related to SSRs on, and the answers are often quite informative:

(Note in that question that Olin Lathrop, who seems to REALLY know his stuff, states that a snubber isn’t a big concern for an optotriac. I’m not using one for my sprinkler solenoids, and I haven’t destroyed an optotriac yet.)

@ godefroi - Thanks for all the great info but damn you for pointing me onto another great forum to spend more time on :wink: I think I’m going to have to read those posts a few more times before I really can absorb everything that was discussed. I’m going to order some optotriacs to experiment now… Thanks again.

If you’ve never experienced any of the stackexchange sites, you really ought to. StackOverflow especially is a giant treasure-trove of programming knowledge. It’s not a forum really, it’s strictly Q and A, and pretty much any Q you have, there’s someone with an A ready to go.

I’ve used StackOverflow but never thought to look for an electronics site there. Good stuff!

Just looking up some PR26MF12NSZF prices. I’m a little surprised. They’re not significantly cheaper than the relays I’m using :frowning:

Yeah, I think I paid a little over $1 each for them, can you really get a relay of any sort for that?

Additionally, you probably need a transistor to drive your relays, and the optotriac saves you that, and there’s no such thing as contact wear or back EMF on an optotriac…

I bought a tube of them a few years ago. I think they’ve gone up a little since then but there are still several that can be had at around $1. I was hoping that being non-mechanical the opto would be closer to $.50. Still not bad though considering the benefits.

Yea, I’m using a transistor to drive the relay. But if you ended up having to include a snubber circuit that would take away a lot of the appeal.

They can be had for less, if you don’t need 600mA through them. DigiKey has a category for them: “Optoisolators - Triac, SCR Output”