Switching 12v using mosfet

Hi, I know there are a few posts about this topic but I still cant seem to get my project to work and I don't understand why. I am trying to switch solenoids using a bank of mosfets.

It is this set up but mine has 4 on the board. If I have 12v on the load side and then use 12v on the pwm it switches however if I put the 5v of the arduino on it, it wont switch. There is an LED in series with the opto isolator on mine and that comes on with both voltages so I would have thought that either voltage would switch the opto. The LED is dimmer with the 5v on it but its on.

Not in the schematic you show.
Do you have a link to the module you are actually using?

it has the LR7843 and the PC817 same as the initial link I put in

Try connecting the Arduino 5V output (not from an I/O pin) to the PWM1 input and GND and see if it switches.

There is an LED on the PCB.
It is not in series with the opto, but connected to the drain of the MOSFET.

The title on the webpage should have given you concern as to what you were actually buying. They also show two completely different images of a 4 channel board.
They also note that you may receive an old version of the board

By looking at the image of the one board, it looks like the LED is in parallel with the input not in series. So I'm not sure what the ebay seller has actually sent you.

I use a lot of those modules and they work great, but caution do not let the load voltage get much below 8V or it will cook; or if you are lucky it will just not work. Is your 12V actually 12V? The gate is driven basically with the gate voltage being the power voltage divided by 2 and - about 0.7 for the transistor of the opto coupler.This puts about 4V on the gate with a 12V supply. Do you have it connected as shown in your schematic?

it is off of a car battery so will be 12-15v. I have measured 4.5v on the opto but nothing else is happening, if I put 12v on the input it then works. I haven't tried using the actual output of the Arduino only the 5v on it so I will try that, I didn't realise there was a difference between them.

ok well it just started working off of the output and the 5v on the arduino, I suspect a dodgey connection in my bread board or ebay board decides when it wants to work

FYI the input is isolated from the output and is polarity sensitive so connecting the 5V backwards it will not work. If the grounds for the load and 5V are connected connecting backwards can damage something. Also you will need some load on it, many times a meter is not enough. Remember the load side needs to be at least 8 volts.

there is a solenoid on the load of the 12v. What do you mean by connecting both grounds backwards?