I'm doing quite a large project in which I'm planning to control a spa from the raspberry PI.
I've got most of the things figured out but i'm stuck at the following problem.
I've got 4 12vdc lines that I need to sense whether they are powered or not and read this into the pi by gpio.
I've found on the web that I should ideally use an optocoupler for each line so I refrain from frying the PI.
Unfortunately I wasn't able to find a clear how-to for connecting the whole, as I've only done a couple of projects I'm still a bit wary of calculating resistors and such.
From my current knowledge I should do the following:
-> The optocoupler has a forward voltage of 1.2 V at 0,02 A
-> This means the 12+ should be connected to a 560 ohm resistor and that should be connected to the anode, the cathode should be connected to the negative pin. (does the wattage of the resistor matter?)
-> The emitter should be connected to ground and the collector to the gpio pin and to the 3,3v rail with a 10k ohm resistor in between.
Is that correct?
As an extra question how much power would such a setup draw from the 3,3 pins? I think I'm getting very limited in available power there
Thanks in advance!