Hey i just bought a velleman relay card controller and i am just checking to see if I have understood it right as i am working with mains power and do not want to die.
the arduino should be able to control the circuit with the digital pins going high/low right? they can handle 9V/15mA.
the arduino should be able to control the circuit with the digital pins going high/low right? they can handle 9V/15mA.
No, the Arduino pins are +5vdc logic level only. That board is expecting open collector transistor outputs to drive the boards input pins. That will require some kind of external switching transistor stage to be compatible with a Arduino I/O pin.
You don't need anything as hefty as a tip102, almost any npn transistor such as a 2n2222 should work with your vellemen board. Connect the collector of the transistor shown in the playground link to the input pin of the vellman (and connect the grounds of course) and you should be good to go. You dont need to the diode because you are not switching curren through the relay coils, you are only turning on the transistors on the velleman board
According to the velleman documentation, the relays need 9 volts. This means that you can't use the arduino 5v line for the velleman +vdc input. For that you will need an external DC 9 volt power supply.
If you arduino is powered from an external DC supply then you may be able to use that, the voltage on the Vin pin will be around .7 volts lower than the voltage on the external power pin.
The negative side of the supply connects to GND, the positive side connect to the velleman +VDC pin. There is no connection to the Arduino 5v pin.
Your connection to the AC mains should be to the phase and neutral (aka return), its wired just like an ac mains switch.
5v means 5v!
The Arduino voltage regulator takes your supply voltage (9v in this case I guess) and lowers it to 5v. You will want to send the unregulated supply voltage, I would call it the right most pin on the power header (sometimes labeled Vin, Vs, or Vcc), and send it to your relay module for powering the relays.
BTW:
I wouldn't ever label AC as +Vcc or Gnd. Generally AC wiring is Hot (black), Neutral (white), and Ground (green or bare). Make sure you don't become ground while working with it!
One more thing...
I don't know if it's really necessary in this case, but while driving motors and LEDs through a 2n2222 like your schematic shows, I've noticed that if the Arduino pin is floating (neither written low or high), then a fair amount of current can flow through the transistor. This can be fixed by adding a 10k pull-down resistor to the transistor base (i.e. connecting base to ground), that way a little random voltage won't turn on the transistor.
As I understand it, once you've initialized your digital out (i.e. digitalWrite(pin,LOW) ), the Arduino MCU has internal pull-down resistors to take care of all this. You probably wouldn't want the relays turning on when power was first applied (before the Arduino has a chance to boot and initialize the output pins).
So far i have managed to connect and get everything working fine. Unfortunately the relays seem to have stopped clicking. Does this mean they are broken?
I've done something like that, using a cheap relay board bought on Ebay, and a network shield, to make a networkable power switch based on arduino. Additionnaly, ther's an interface for Heyu linux home automation software.