The problem: I'm trying to control a 5V mechanical (ice cube)relay with the arduino (and accompanying 2N2222a transistor circuit) to turn on a single siren-like light. The light turns on when hooked up to the relay, but does not respond to the arduino when the light should shut on/off at a certain time interval. Can the arduino interface with this type of relay to begin with?? If so, any ideas on how to control this relay with the arduino?
Can you give us the -actual- model number of the relay; while the datasheet you gave is helpful, it is set up for all models of that relay (of which there are several possible combinations), and so, we need the actual model number of the relay you are using.
When you say the light turns on when hooked up to the relay - what do you mean? Are you switching/controlling the relay in some other manner in this test? Is the light hooked up to a particular set of contacts? Explain clearly what you mean...
Thanks cr0sh - the manufacturer model number is KUP-11D15-5, it's a DPDT 10A 5VDC relay. It has 8 pins.
The live wire of the light is hooked up to pin 4 and 7 of the relay (or power to Normally Open). The relay's ground connects to Pin A and the 5VDC from the arduino is hooked up to Pin B to activate the relay coil.
The light's turn on when the 5VDC coil is activated. I'm trying to make the relay change states with the circuit posted above, but it's not quite happening yet. Could it be the transistor? Should I re-wire the circuit? Or is this relay just not compatible to use with an arduino?
What happens when you put an LED in place of the relay (removing the relay and snubber diode - you'll want a resistor between the LED and V+, too)?
I have a feeling that the relay coil might be pulling too much current from the Arduino's regulator - have you tried hooking up a separate battery pack or regulator to the relay?
If you have everything as hooked up in the schematic and based on what you told me about the relay and its contacts/hookup, it sounds like you have everything set up ok; but there may be an issue with the amount of current being pulled by the coil (the Arduino's regulator may not be able to supply it), so you would need another source of power for the coil (hooking up another 7805 would work OK).
The transistor could be an issue too; you will probably need to do both - use a larger power transistor (like the schematic suggests, a TIP102), plus a separate power source for the relay.
Yes, a 2N2222 transistor is margnal at the 238ma coil current required. You will have to reduce the transistor's base series resistor down to around 200 ohms to even have a chance for the transistor to pull in the relay.
This kind of relay makes an audible click when it activates. Don't hook up the load until you get the relay to click when you want it to.
Try just hooking the relay to +5 and ground and see if you can make it switch.
That would show you if cr0sh is right.
If that works, then I'd try putting the transistor back in, but drive the base from the +5 supply (through the resistor) to see if you can get the relay to switch when you apply +5 to the resistor on the base. If that doesn't work, the transistor is wired wrong, or blown up. Is the snubber diode really wired the right direction?
Then hook it to the Arduino pin and see if you can get it to switch.
Is the snubber diode really wired the right direction?
You want it turned so that it "won't" conduct electricity... except to short out the reverse voltage arising when the field collapses into the coil... i.e. electricity that you didn't even know was an issue if you are new to snubbers. If diode has a ring around it at one end, that goes to the side of the relay coil that the +ve voltage will go to. (The other end of the diode goes to the other side of the coil.