100ma Optocoupler?

@ShaZei, you seriously need to go away and learn some basic electronics before trying to build any circuits. I think that you're just wasting your time until you do that.

Wawa:
Both diagrams are wrong.

The opto way:
+12 to load.
Other side of the load to collector
Emitter to supply negative.
Opto emitter to base.
470ohm resistor from +12 to opto collector.

The direct way:
+12 to load.
Other side of the load to collector
Emitter to supply negative and Arduino ground.
470ohm resistor between Arduino output pin and base.
Leo..

Like this? I guess it make sense, otherwise I was limited by the transistor. So, the reason of putting a transistor that high is to make sure the current going back to ground is about the same thing as the source (1A) ?

OldSteve:
@ShaZei, you seriously need to go away and learn some basic electronics before trying to build any circuits. I think that you're just wasting your time until you do that.

:frowning: I didn't thinks I was doing that badly, I lack knowledge with the transistors and datasheets but everything else seemed to works fine so far. Well, I did burn my first arduino while trying to measure the amperage once but I thinks it was because I didn't choose the correct ground, or maybe the miliampers were too high.

I don't know, Iv read an electronic book but they don't explain much about transistors or DC current.

And afterall, this was supposed to be the "small electronic project" that I was doing to learn more about it.

Woohoo, it works!

I was have been stuck during at least an hour wondering why the power wasn't going through until I realized that the base of the transistor was powered by the arduino so the ground couldn't be from my external power supply.

I removed the external powersupply, used the 12V Vin and Ground instead, then I also added an inverted diode from Emitter to Collector since this is what you suggested I believe. I have read that it can prevent kickback from motors.

Wasn't too sure if it was necessary, so I added both as preventive measures.

Then it didn't look like it was working but I noticed the transistor was slowly increasing the voltage until the valve got enough to power on.

It looks like I might finally be able to hook up the water hoses and verify if there is anything heating up, afterward, I guess I will be able to go on vacation without worrying about the plants :stuck_out_tongue:

I will still have to test the whole thing during at least a week just to make sure it is stable enough even if I verify every little component one by one.

Alright thanks again. I would have appreciated the reason behind the resistor, I guess it might be what I have said (the ground cannot be higher than the source) I always thought ground could handle anything.

It crazy how the circuit changed and become simpler as it progressed lol. I was initially using a relay, then optocoupler, then you guys pointed out I could do the same with a transistor, aaww damn, I had not thought about using the other side of the transistor. I had taken for granted that usually you only use the emitter side of the transistors for powering your device but that's mostly when using them as amplifier. In this case, we just needed something to let the current reach the ground.

Thanks again, sorry if you felt I was bad. Still learned a lot :stuck_out_tongue: