Help with 12V PWM control for valve

I'm looking to control a 12V PWM valve using the Arduino, however, I'm having trouble controlling it properly. The valve has 3 wires - +12v, ground, and control signal (PWM). The PWM input for the valve has to be between 190 and 210 Hz. With a 12V supply, duty cycles of 10% and 90% open and close the valve.

A 200 Hz PWM output will come from pin D9 on the Arduino to control the gate of a PSMN022 MOSFET. I've scoped the output at the gate, and the proper 200Hz PWM with 10% or 90% duty cycle is measured correctly. However, I'm not seeing the output +12V PWM signal on the drain side. What am I doing wrong?

Note: The 100k resistor on gate side prevents the +12v to go back into the Arduino if Pin D9 is set to input by mistake.

First things:

What valve? That’s the first piece of information we need.

However, I'm not seeing the output +12V PWM signal on the drain side. What am I doing wrong?

What are you seeing?

What are you seeing with just the 1K resistor?

Are all of the grounds connected together?

...Your schematic looks fine (although there is usually a resistor in series with the gate) so if it's wired properly and it's not working with just the resistor, I'd have to assume the MOSFET is defective...

A 200 Hz PWM output will come from pin D9 on the Arduino to control the gate of a PSMN022 MOSFET. I've scoped the output at the gate, and the proper 200Hz PWM with 10% or 90% duty cycle is measured correctly. However, I'm not seeing the output +12V PWM signal on the drain side. What am I doing wrong?

Common GND ?

d9 ? (how ?)

Post your code.

pwm is 480 or 980 hz

dtbingle:
Note: The 100k resistor on gate side prevents the +12v to go back into the Arduino if Pin D9 is set to input by mistake.

Removing the valve from the equation for now. Grounds must be connected as others have said.

This resistor is not preventing anything from going to the arduino. It is a pulldown resistor so the gate doesn't float.

You would see 12V at the drain when mosfet when the mosfet is off only. Should see close to zero when mosfet is on.

Just noticed this statement:

Note: The 100k resistor on gate side prevents the +12v to go back into the Arduino if Pin D9 is set to input by mistake.

Erm, no, that's not what it does or could do. It keeps the device switched off while the Arduino is
in reset or powering up. The gate is electrically isolated.

DIFF AMP MODE

scope ch-1 on +12V
ch-2 on INVERT
ch-2 on Drain
SELECT on ADD

MarkT:
First things:

What valve? That's the first piece of information we need.

An exhaust valve.

DVDdoug:
What are you seeing?

What are you seeing with just the 1K resistor?

The blue is at the gate, yellow is at the drain. This is with JUST 1k. Similar with 100k in as well. So something is pulling the PWM output from Arduino way down and not letting it function correctly. If I take the Arduino PWM output out of the circuit and measure alone, the PWM functions correctly (0 to 4.5v). Thinking the MOSFET might be gone?

DVDdoug:
Are all of the grounds connected together?

All grounds ARE connected. Powered from a 12V supply with the 12V regulated to 9V for the Arduino Vin, but full +12V to the valve's power/ground. .....Unless the regulator's output ground is isolated from the input side? In that case I believe I'd need a jumper from Arduino ground to +12v supply ground.

DVDdoug:
...Your schematic looks fine (although there is usually a resistor in series with the gate) so if it's wired properly and it's not working with just the resistor, I'd have to assume the MOSFET is defective...

Okay cool. I'll drop the 100k, add like a 220 ohm series resistor. From above, either ground or MOSFET it seems

raschemmel:
Common GND ?

See above

raschemmel:
d9 ? (how ?)

Post your code.

pwm is 480 or 980 hz

You can modify the actual micro register counters to change PWM frequency. Fortunately, there's a PWM frequency library to help do so easily. The PWM output on pin D9 was scoped and verified to be functioning correctly and measures to be 200 Hz.

Relevant code (a PWM frequency library was used to set freq properly):

  //initialize all timers except for 0, to save time keeping functions
  InitTimersSafe(); 

  frequency = 200;

  //sets the frequency for the specified pin
  bool success = SetPinFrequencySafe(valveOutPin, frequency);
  
  //if the pin frequency was set successfully, turn valve pin on
  if(success) {
    pinMode(valveOutPin, OUTPUT);
  }

  pwmWrite(valveOutPin, VALVE_CLOSED);

Also, my mistake, I see what you guys mean about the 100k resistor. Pulled it from another thread/similar setup and took it for face value and didn't think about it too much.

Did you try DIFF AMP MODE ?

raschemmel:
Did you try DIFF AMP MODE ?

Not sure what you're after here, but light blue is at +12v, green is +12v channel - drain node, and yellow is at drain node.

Maybe you need to use a P Channel MOSFET to take the PWM input high.

Can you supply us with a link to a datasheet for the valve, please?

That is the information that MarkT was trying to extract from you in reply #1.

MarkT:
First things:

What valve? That's the first piece of information we need.

I don't think he was expecting a reply like the one you gave:

dtbingle:
An exhaust valve.

Try following the instructions given fo DIFF AMP MODE.

What " I'm after " is a differential measurement of the valve.

Your scope channel descriptions don't make any sense. What is a +12V channel node ? ( on schematic)

Show us your PWM on the gate on ch-1 and the mosfet drain on ch-2

JohnLincoln:
Maybe you need to use a P Channel MOSFET to take the PWM input high.

Can you supply us with a link to a datasheet for the valve, please?

That is the information that MarkT was trying to extract from you in reply #1.

I don't think he was expecting a reply like the one you gave:

I don't have a full datasheet, but here's the info I have to go off of. You may have to copy image address and open in new tab to read.

There's another snippet, but not worth posting. It states that the valve goes to the open position and stays there when the PWM input signal is missing.

Also, I'm using a DDS-120 scope...no differential probes.

What is meant by +12v node is the +12v rail from the power supply. In the scope picture, the yellow signal is at the drain, light blue is at +12v supply rail. Green is just CH1 (+12v) - CH2 (Drain).

When the Arduino PWM output is connected to the gate, the signal looks like the light blue signal in post #7. However, when the Arduino output is REMOVED from the gate (ie. not connected to the MOSFET circuit), the PWM signal varies from 0v to 4.5v and works correctly.

Think for a second.
If I gave you instructions for ?DIFF AMP MODE , isn’t obvious that thise instructions sre HOW TO OBTAIN A DIFFERENTIAL MEASUREMENT WITHOUT A DIFF PROBE ? ( USING ANY SCOPE NO MATTER HOW CHEAP)
or did you not know that was possible ?
If you had a Diff Probe , would you need Diff Amp mode ?

raschemmel:
Show us your PWM on the gate on ch-1 and the mosfet drain on ch-2

This is what I want to see too, should give us a good idea of what's happening.

Check that the mosfet has no shorts ( gate -source) . I have seen mosfets fail with the gates shorted to source ( or drain) . This would look like the arduino is not putting out power when in actuality it is a dead short to ground (and will damage the arduino).

raschemmel:
DIFF AMP MODE

scope ch-1 on +12V
ch-2 on INVERT
ch-2 on Drain
SELECT on ADD

raschemmel:
Think for a second.
If I gave you instructions for ?DIFF AMP MODE , isn't obvious that thise instructions sre HOW TO OBTAIN A DIFFERENTIAL MEASUREMENT WITHOUT A DIFF PROBE ? ( USING ANY SCOPE NO MATTER HOW CHEAP)
or did you not know that was possible ?
If you had a Diff Probe , would you need Diff Amp mode ?

Ch-1 on +12v, ch-2 inverted and connected to drain, output signal = Ch-1 + Ch-2

Isn't that the same as Ch-1 on +12v, ch-2 NOT inverted and connected to drain, output signal = Ch-1 - Ch-2?

alka:
This is what I want to see too, should give us a good idea of what's happening.

Check that the mosfet has no shorts ( gate -source) . I have seen mosfets fail with the gates shorted to source ( or drain) . This would look like the arduino is not putting out power when in actuality it is a dead short to ground (and will damage the arduino).

This is posted back in post #7. Light blue is at the gate, yellow is output at drain. As you said, it looks like Arduino is not putting out power, which leads me towards a bad MOSFET.

Got a hold of new MOSFET and it works.

Isn't that the same as Ch-1 on +12v, ch-2 NOT inverted and connected to drain, output signal = Ch-1 - Ch-2?

YES IT IS. (but there was no signal so I wasn't sure if you had it connected correctly)

Got a hold of new MOSFET and it works.

Ok. Let's see a Differential measurement of the valve coil.

Here are two output states (10% and 90% duty):

Weird thing is, you can hear the valve try to spin briefly once then that's it. I think it's reached it's max limit position. However, I believe the controller in the valve thinks it's in the closed state when starting, even though it's in the opened state and tries to cycle past the limits. How would I manually control the actuator? Thoughts are leaning towards flipping polarity on +12v/ground direct to controller so that error 'open' state is actually closed, but other thoughts say bad things would happen.

MarkT:
What valve? That's the first piece of information we need.

OP, please answer this question with more detail; "exhaust valve" doesn't cut it. We could guess that you're referring to an engine "exhaust" and if that's the case then you're going to feel silly when you find out it probably needs to be under pressure to operate.