I am able to switch them by connecting straight to a high pin and ground on the arduino, but I'm worried that this may not be the correct way to do it.
Should I be worried about kickback from the switching process ? Should I be using a diode and transistor at all and if so how would I wire it up ?
I'm a bit of a noob, so excuse what may be a silly question.
You should wire them up just like in the PDF file you reference. It's not a good idea to hook up a relay directly to an Arduino output pin. The signal relay will have kickback just like any other relay.
--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected
I could be mistaken, but from the data sheet these relays may be of the latching type. From the datasheet:
bistable 1 coil, bistable 2 coils
bistable is a key word meaning once the relay coil is activated it stays in that position even if coil voltage is removed and only having current flow in the opposite direction will the relay 'reset' (this for the 1 coil version). For the 2 coil version one coil will 'set' the relay and the other coil must be activated to 'reset' the coil. Activating both coils at the same time in the 2 coil model is 'undefined' and should not be an allowed operation.
So you may have to rethink how you will use and wire up this type of relay for any project you decide to try them on. First you need to figure out what you ordered, single coil or double coil version.
Here is a circuit I came up with for using a simple single coil latching relay to allow one to turn off power of project under software control:
I have had no problem using this kind of low power latching relay without a 'flywheel diode' across the coil even after several years. Such a diode wouldn't work as current must be able to flow in either direction for a single coil latching relay.
The PDF that you referenced is for a whole series of relays some of which are monostable and some of which are bistable. They also come in a wide variety of coil voltages and some require more current than others even at the same voltage. We need to know exactly which relay you have.
Should I be worried about kickback from the switching process ?
Yes you should, whenever a relay is used.
Should I be using a diode
Yes
and transistor at all
probably
and if so how would I wire it up ?
Like the drawing in the first link in your original post. You can use almost any NPN transistor for your relays, the 2N3904 and the 2N2222 are the most common.
thanks fot the diagram but what I dont understand is how to apply forward current and then reverse current to do the switching with my arduino.
I just want to make sure I understand the diagram you posted, is
6 - arduino pin
8 - ground
thanks for all your help.
Pin 6 can be any arduino output pin. The application for the drawing is to control a manual power up with a programmed automatic power off function. When the user presses the manual power switch, voltage is routed to the processor and the first steps in the program are to bring pin 6 high which will 'seal' the power on across the switch with the relay's contact. When the program want's to power off, it just brings the pin 6 low, the capacitor stores the voltage needed for reverse current to 'unlatch' the coil.
Another way to control the latching relay for your applications (if you can spare two pins instead of one) is to just wire the two coil terminals to two seperate output pins, so that pins = 0,1 will set the relay, 1,0 will reset the relay, and 0,0 and 1,1 will not change the relay (stays at last commanded position) but will result in zero current draw.
retrolefty:
Another way to control the latching relay for your applications (if you can spare two pins instead of one) is to just wire the two coil terminals to two seperate output pins, so that pins = 0,1 will set the relay, 1,0 will reset the relay, and 0,0 and 1,1 will not change the relay (stays at last commanded position) but will result in zero current draw.
Lefty
Won't that cause the coil to destroy the input protection diodes when you switch the current off? I'm not sure the output stages can keep the reverse voltage within 0.5V of the supply when taking 20mA in reverse... If not you might require 4 schottky diodes to protect the chip - after all this is an H-bridge driving an inductive load.
retrolefty:
Another way to control the latching relay for your applications (if you can spare two pins instead of one) is to just wire the two coil terminals to two seperate output pins, so that pins = 0,1 will set the relay, 1,0 will reset the relay, and 0,0 and 1,1 will not change the relay (stays at last commanded position) but will result in zero current draw.
Lefty
Won't that cause the coil to destroy the input protection diodes when you switch the current off? I'm not sure the output stages can keep the reverse voltage within 0.5V of the supply when taking 20mA in reverse... If not you might require 4 schottky diodes to protect the chip - after all this is an H-bridge driving an inductive load.
Your correct that there is no protection against inductive voltage kickback (other then the internal clamping diodes) when using latching relays directly driven by arduino output pins without adding additional external voltage clamping components. However I've been playing for over two years with an E-bay purchase of a dozen small DIP single coil DPDT latching relays (around 13ma coil draw) and have yet to have a problem develop, so the internal clamping diodes are holding up so far, but no doubt being stressed above their ratings.
I am not suggesting to anyone (but myself) that it's OK to use latching relays like I have, but leave it to the users to decide if they want to try them or not. I've found that these latching relays can be very useful for some applications and have found the AVR chips are pretty rugged and forgiving with these small relays. To be honest I have only used these on DIP packaged 328p boards rather then on my mega boards, as then my risk is just a few bucks for a replacement chip, and as I've said in over 2 years I have yet to cause a chip failure using at first Picaxe chips and then on to arduino boards.