0

Controlling relays with YBox2
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Controlling relays with YBox2

by chris on Mon Jun 16, 2008 7:03 am

Hi,

I've just built a YBox2 and it works fine. I like to use it to control relays. For my little project I need to be able to control minimum 6 relays.
I am not really an electronics-whiz, but I know the basics and can solder kits etc ... (I am more in to software).
Can some-one help me or point me in the correct direction on how I should start such a project ? Or where I can find info on how to built something like that ?
I want to control minimum 6 groups of lights (via relays); use the browser to start/stop and preferable a button directly wired to the Ybox to start/stop.

thx,

Chris

Belgium - Europe

chris
 
Posts: 7
Joined: Sat Jun 14, 2008 3:04 pm

by darco on Mon Jun 16, 2008 9:25 pm

The first thing I want to point out is that you absolutely should NOT operate the relays directly from the propeller I/O pins. You MUST use some sort of buffer (Like a darlington array), or you will dramatically shorten the lifespan of the propeller chip.

I would recommend getting three 9-pin headers, and one 10-pin header. Solder them into the slots on either side of the propeller chip on the ybox2 board. This way you have easy access to all of the I/O pins and can easily hook up to the unused I/O pins for controlling your relays.

What I have done is taken some 0.1" perfboard and some wire-wrap swiss machine sockets to make a pluggable prototyping board. This makes it super easy to remove the board to do adjustments, or to replace the protoboard entirely if the need arrises.

To do this, you need three 9-pin wire-wrap swiss machine sockets and one 10-pin wire-wrap swiss machine socket. You solder them on the protoboard in such a way that you can plug the board directly into the above mentioned headers on the ybox2. Then you can mount a darlington transistor array on the board and wire it up however you want without soldering anything else to your shiny new ybox2. I've done this myself, and this is what it looks like:

Image

As for the software, that would be really easy to do. So easy, in fact, I should probably make it an example widget. :)
darco
 
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA

by oPossum on Mon Jun 16, 2008 9:52 pm

oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

by chris on Tue Jun 17, 2008 7:27 am

Darco, Opossum,

thx for your help. This is what I had in mind.What pins should I use on the propellor-chip ? (or better, which shouldn't I use ?) Looking at diagram-sheet, I think JP2 with pins 2 -8 (P17 - P23) are free for use ?

I am planning two versions; one with relays that should directly switch 240V and one that I like to connect to my Home-domotics system (I have a so-called binary interface which has 6 potential-free contacts, which can act like push-buttons). Any idea what I should use for the latter ?

thanks again,

Chris

chris
 
Posts: 7
Joined: Sat Jun 14, 2008 3:04 pm

by darco on Tue Jun 17, 2008 12:42 pm

Here are a few more pictures to illustrate the clip-on board idea:

Image

Image

Image

Image

Image

In case you were curious, I use this board to control a bunch of RGB LED bars I got from Spark Fun:

Image
darco
 
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA

by darco on Tue Jun 17, 2008 1:44 pm

Oh yeah, forgot about the free pins... P17 thru P27 are free.

Obligatory warning: Working with mains voltages can be extraordinarily dangerous. Be very careful when you hook it up. Remember that electrocution isn't the only hazard when working with these voltages, fire is also a hazard. Just a general reminder.
darco
 
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA

by chris on Wed Jun 18, 2008 5:23 am

Darco,

pictures are self-explanatory; I assume you used an extra 12Vsupply to drive the RGB-leds ? If I see & understand it correctly, then the Darlington Array is not powered by the extra 12V ? So instead of 12V, I assume that I can use lower/higher voltages to drive a relay ?
What is the use (& exact value) of the extra resistor on your print ?

thx,


Chris

chris
 
Posts: 7
Joined: Sat Jun 14, 2008 3:04 pm

by darco on Wed Jun 18, 2008 1:53 pm

You are correct that the power connector is for a separate 12volt supply. The darlington array just provides a way to manage a sink. A darlington is really only "powered" by the voltage on the input pin, which controls whether the output pin will sink a voltage or not.

There are really only three connections on a single darlington: input, output, and sink. There is a positive connection on darlington arrays, but it is conceptually unrelated.

Think of a darlington as an inverter. A positive voltage on the input pin will cause the output to sink. A negative or floating voltage on the input pin will cause the output to float.

This works because I have the 12v ground and the 3.3v ground tied together. So instead of managing the 12+ volt rail, I'm managing how I sink it.

You probably don't need a separate power supply for driving the relays, all you will need is a buffer (the darlington). Just make sure that the relay you are using can be switched with 3.3volts.

For the relay switch, you would connect the solenoid directly to the 3.3v rail and the darlington output. Then when the input pin on the darlington goes high, the circuit will be closed and the relay will switch.

I hope that helps.


BTW: Ignore the resistor. It was just a pull-up for a one-wire bus, and is unrelated.
darco
 
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA

by chris on Thu Jun 19, 2008 6:36 am

Darco,

very clear to me ! I'll get the necessary hardware and 'll start tinkering ...

thx again for your help !

Chris

chris
 
Posts: 7
Joined: Sat Jun 14, 2008 3:04 pm

by chris on Mon Jun 30, 2008 7:25 am

Darco,

I had some trouble in finding reed-relays that will work on 3.3V; they're all 5V, but should work on 3.3 V. So I have two questions:
- where on the print should I tap the +3.3V & ground (or where shouldn't tap it from ?)
- suppose the 3.3V doesn't do the job on my reed-relays, would it be possible to use the +5V (ac/dc power) before the voltage-regulator I use on my Ybox2 ?

thx,


Chris

chris
 
Posts: 7
Joined: Sat Jun 14, 2008 3:04 pm

by darco on Mon Jun 30, 2008 12:25 pm

Pretty much any pin that I've exposed to a header which is marked with a "+" or a VDD is safe to use. You could also use either pin from J1 for your +3.3v source.

Here is a pic with some labels on the headers next to the prop for your convenience:

Image

You can sink higher voltages (5-10 volts easily, likely much more) very easily using a darlington. Just tie the grounds together. If you need to do this, I would avoid adding another regulator and just tap into the unregulated positive supply voltage (which you can easily sink with the darlington). Most relays can handle 9v-12v on the input coil.
darco
 
Posts: 118
Joined: Wed Jun 04, 2008 7:54 pm
Location: Campbell, CA

Please be positive and constructive with your questions and comments.