help connecting Arduino UNO to n-ch MOSFET via Optocoupler

Terraviper-5:

Grumpy_Mike:
You do draw your schematics in a very odd way.

Yeah, its about time I read some tutorial on how to make schematics.

Anyways, I have read around a little bit, found out that multiple smaller caps are better than one big.

Also, if I leave the circuit online 24/7, the caps will be charged all the time even if they are only used for small fraction of that time. Will because of that their life expectancy be smaller? Should I add another FET that will block the entire power supply when its not needed? (sorry if the question sounds stupid, Im later planning on building a h-bridge and am accumulating knowledge for later also)

That can be the case when the cap is being used to bypass noise to ground for sensitive loads, but your solenoid does not give a hoot about what little extra noise that smaller cap might be bypassing to ground. The big cap is just to have a little extra initial current available to drive the solenoid load on, in case the power supply is not a 'stiff' one. In simple passive loads like a solenoid you don't even require a regulated power supply, just filtered with enough current capacity to handle the solenoid load. But yes move the cap(s) to be across the PS +/-.

Lefty