Currently just testing with a simple button press and toggle relay state.
I followed the top diagram and in scenario "A"...
nothing happens when I press the button (serial output is correct however..so the button itself is working..etc)
when I do scenario "B".. (ie; connect Arduino GND to the GND pin).. I -do- get a light and a 'click' by relay #1 (which is the only 1 I am testing with)..
HOWEVER... in scenario "B".. my solenoid is doing nothing? (I dont have any hose/lines or liquid connected to it).. but I would expect it to make some sort of noise is toggle/powered to allow the fluid to travel through???
Also.. should I be able to detect +12v on the screw terminals where my relay is connected?
Of course you won't see any voltage on the relay contact connections. They are uncommitted switch outputs. You are supposed to connect them to an external power source.
"thats ONLY if I have the Arduino GND connected... which not how any of the diagrams say it should be?"
If there is no ground return path for the arduino control signal in the diagram, then I'd say the diagram is faulty. There has to be a return current flow path for the arduino signal.
zoomkat:
If there is no ground return path for the arduino control signal in the diagram, then I'd say the diagram is faulty. There has to be a return current flow path for the arduino signal.
Not necessarily, depending on how the optocouplers are wired. Generally those relay boards have the common connection for all the optocouplers connected to Vcc of the arduino, and the input pin is pulled LOW to active the relay.
Here is a typical schematic I found in another post:
Now there is not really any reason the optocouplers could not be wired with a common ground, and a HIGH input activate the relay, but that seems to be uncommon, and there would be no need for the Vcc-JDVcc jumper, since the optocoupler input needs no power source.
"Not necessarily, depending on how the optocouplers are wired. Generally those relay boards have the common connection for all the optocouplers connected to Vcc of the arduino, and the input pin is pulled LOW to active the relay."
If the output of the optocoupler led goes to an arduino pin that is set low to ground, then that is a ground flow path. There is going to be a ground somewhere.
david_2018:
Now there is not really any reason the optocouplers could not be wired with a common ground, and a HIGH input activate the relay, but that seems to be uncommon, and there would be no need for the Vcc-JDVcc jumper, since the optocoupler input needs no power source.
This is consistent with the advice that switches used as input be connected to ground so that the supply voltage need not be taken out to wherever the switch is, with some potential risk of being shorted to ground. At worst if the input line shorts to ground it spuriously appears as if the switch is closed.
It is also consistent with the use of "open-collector" logic.
zoomkat:
"Not necessarily, depending on how the optocouplers are wired. Generally those relay boards have the common connection for all the optocouplers connected to Vcc of the arduino, and the input pin is pulled LOW to active the relay."
If the output of the optocoupler led goes to an arduino pin that is set low to ground, then that is a ground flow path. There is going to be a ground somewhere.
You just have to be careful to not confuse people. When you stated
If there is no ground return path for the arduino control signal in the diagram, then I'd say the diagram is faulty. There has to be a return current flow path for the arduino signal.
a lot of people are going to take that to mean that the GND pin of the arduino needs to be connected to the relay board. There is NO "ground return path for the arduino control signal", the arduino control signal is the return path for VCC.
these relay modules are comprised of 3 separate parts. #1) the contacts. these are totally isolated from the low voltage logic. The contacts can often handle line voltage AC power.
The reason for the relay is to get this isolation from the mains power. They act like a switch only. no power is sourced from them.
#2) the coil. The coil needs power, often around 100mA for each coil. Also the coil will dump a back voltage spike on the power and spike that power supply. The coil voltage is ALWAYS recommended to be a separate power source than your Arduino, especially for these multi-relay boards. and yes, these boards do have a back-diode to address the spike.
#3) logic. there is a semi-isolated circuit that often shares ground or power or both with the coils and your micro and yes, it needs a separate logic signal to your micro-controller.
Since the digital pin of your micro is only completing a circuit to light an LED inside of the opto-coupler, the current needed is calculated exactly like an LED and a dropping resistor may be needed.
so, the question is if you are to source the power for the opto, then a ground is required. and yes, that ground is connected to the power for the coils. There is not a true isolation between boards.
so, to source power, your digital pin output is HIGH and ground completes the circuit.
if your want to sink power for the LED, then you need to supply power to the relay module board.
This is often selectable with a jumper on the relay module. Provide power from the micro OR you can use the relay module board Vcc from it's separate power supply.
Using the module Vcc you are bringing the opto to ground to complete the circuit and you will need to have the grounds connected between your Arduino and the relay board to complete the circuit.
As you can see, if your relay module is 12v and you need to control an LED in the opto, and you are using the 12v module for Vcc, you will need to add a resistor.
It all boils down to creating and completing circuit to light an LED.
I'm following some of it.. but then I read an argument against what I just read?.. (not trying to cause trouble, just trying to understand, and see what I am doing wrong............if anything now?)
As requested: (left as big image on purpose).. sorry the crappy image though (tried to brighten it up on photoshop)