I bought some relays, just to see what could be done - perhaps sometimes an alternative to a H-bridge.. or perhaps make a light-show or something, they are very cheap, so I thought "hey, let's see".
Ah, relays are fun I’ve only played with them a little bit, so my understanding is hazy, but the way I understand it, what you’ve got is a double pole, double throw relay. That means that when there’s no current across pins 1 - 16, then pin 4 is connected to pin 6 and pin 13 is connected to pin 11 (it’s labelled as 1 but following the pattern, I think it must be 11).
When you apply current across pins 1 - 16, then it’s just like physically flipping two switches at the same time – pin 4 gets connected to pin 8 and pin 13 gets connected to pin 9. Unlike a transistor, the relay doesn’t care what voltage you’ve got on each of those switched pins – it’s just physically opening or closing circuits.
What I don’t know is whether or not it matters what direction the current goes across pins 1-16. Since it’s just an electromagnet inside, I think maybe it doesn’t? You can just tie pin 1 to ground and pin 16 to an I/O pin that you set high, or the other way around (pin 16 to ground and pin 1 to I/O pin) should work too. But you should probably just try it and see, because I don’t know what I’m talking about
One thing I DO know is that a relay CAN be used to reverse motor direction – the circuit diagram that I used to build my Feivel robot does just that, when the bumper switch is activated. Check out my picture of a relay on my Feivel page to see how it was wired up to reverse the connections when the switch is triggered. It’s that funky X-shaped pattern. Here’s another view that I didn’t include on the robot page.
Use a transistor to drive Use a transistor to drive the relay. It draws too much power to be driven by an I/O pin directly. I suggest using a diode across the coil to protect the transistor.
when u apply current to pin 1 and 16, it becomes on:
ping 4 connect to 8
pin 13 connect to 9
but as they told… nothing better then test it… just use a multimeter, and see if it confirms.
Better then use a transistor to atack the relay, is to use the transistor that is activated by ligth, encapsulated with a led, so you can keep the microcontroler away from high power, and don’t get a glitch to your microcontroler…
I will search for it, and when i find it, i post =P
Page 2 has the schematic. The left most pins are obviously what gets switched (A or B get the power). But what are the other 4 pins? Why do two of the pins have a rsistor between them (or is that the coil).
I want to control a small lightbulb with a microcontroller, so how would this be wired up? Do you suggest using the microcontroller to drain (pin at 0) or source (pin at 1) in order to turn on the relay? (also see note on TVS below)
Next I understand I would need a TVS diode to protect my microcontroller. I am confused because this spec sheet says:
Surge Voltage Between Coil and Contacts: 1,500V FCC Part 68 (10/160μs).
So, ok 1,500V. However the TVS diodes i find online are all rated in Watts, and I have no means to convert from V to watts because I do not know the current, or is the current constant based on what voltage/current I have been applying to the relay?
Also how would I wire up the TVS diode? How would this change depending on whether I use source (1) or drain (0) on my microcontrolelr to turn on the relay?
Here's the schematic referenced, with some added labels. The top left contact is the position the switch is in when the relay coil is not passing current. So the upper left pin and upper right pin (and lower right) are connected when the relay is at rest. If you activate the coil (the middle 2 pins) with whatever voltage is needed (you haven't mentioned which relay voltage it is), then the switch moves down to connect the lower left to the upper right and lower right pins. If this is a 5 volt relay, then it will try to draw 60 mA from your processor pin to activate itself, and possibly fry the pin. What might be best is to add a simplle transistor like a 2N2222A to acitvate the relay with 5 volts on the other side, and the base of the transistor connected to the micro pin through a 1k resistor. A 1N4148 diode around the coil, from transitor collector to the 5 volt power should allow enough bypass. Here's the schematic :
got it! funny it seems all so simple now but last night I confused myself.
I am actually going to use shift registers to control the relays as I intend to toggle 72 of them!
I have the TSC-D with 6V coil. I need 50mA per relay, so assuming each register (8 outputs) needs to support all 8 that means my shift register should support 50mA per pin and total of 400mA correct? And if I want to power all 72 relays at once my power supply needs to handle 3,600 mA or 3.6 Amps. 3.6 amps strikes me as a lot, so I think I am wrong.
I will be using these high power shift registers, and it looks like they support 150mA per pin with a total of 500mA (the avalanche current, which I assume means everything combined). Looks like this will work, but I still don’t buy that I need 3.6 amps to switch all 72 relays.
Looks like it could work. You will need a 6 volt 3.6 Amp supply to have all 72 relays on at once.
The TPIC6B595 looks like a great chip to use, won’t need the transistor from the circuiot above. The diode will still be needed for flyback of the relay coil. Using that 500 mA figure, each drain on the chip should be able to carry 62.5 mA, just enough if needing all pins on at once.
I will let you know how it turns out. I am also attempting to design my first pcb board for this. I am surprised at the fact I only need .1" of circuit to carry the 3.5 amps, cool stuff.