Using a MOSFET To Control a Governor Pressure

I am building a controller for a transmission and to control it I need to PWM the solenoid to control the pressure but with what I have it just turns it on or off. If the duty cycle is 0 its off and if I move it to 1-100% the solenoid is on. I am trying to use the YYNMOS-4 board found on amazon. I could not get that to work so I also tried the IRF520 MOSFET Driver Module and all I could get it to do was be on all the time the little LED lights on both boards work like they are supposed brighten when I increase the duty cycle but the 12v output does not PWM.

The code is a little long but what matters to the problem is lines 70-

  1. I have also tried drone bot workshops example code he uses for the IRF520 board and same thing.

Trans_controller.ino (6.0 KB)

Your frizzy picture is about useless, try posting a schematic as how you have wired it including power and ground. You show a pot but no power. A Uno but no power. A motor not connected. A lightning bolt??? and no technical links to the hardware devices. I assume this is for a vehicle of some type, you also should study a bit about automotive electrical requirements etc.

Come on - at the top of the post it tells us "It’s been a while since we’ve seen darmfield12 — their last post was 11 months ago.".

So you know the deal here, the new forum allows large code to be posted, Fritzing is only useful when you do it properly and most importantly, we need the Web reference for your IRF520 module as the IRF520 is not a logic-level FET and may or may not be suitable for use depending on what circuitry is on the board. :roll_eyes:

The (governor pressure) solenoid valve regulates line pressure to produce governor pressure. The average current supplied to the solenoid valve controls governor pressure. One amp current
produces zero psi governor pressure. Zero amps sets the maximum governor
pressure. Current is regulated by modulation of the pulse width of a 512 hz driver
frequency (512 cycles per second). I Have tried just an 12v LED bulb instead of the solenoid to see if that worked and it acts just like the solenoid.

IRF540 Module
YYNMOS-4 Board

What solenoid and pressure valve are you using.
For PWM to work on a valve, the valve has to be designed to work on PWM and within a specific frequency range.

Can you please post links to your hardware and a picture of your project please?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

The information from the service Manual of what the transmission came in from factory.
The Transmission is a 47RE and it's the Governor solenoid.
The solenoid valve regulates line pressure to produce governor pressure. The average current supplied to the solenoid valve controls governor pressure. One amp current produces zero psi governor pressure. Zero amps sets the maximum governor pressure. Current is regulated by modulation of the pulse width of a 512 hz driver frequency (512 cycles per second) .

The [transmission control relay] supplies electrical power to the solenoid valve. Operating voltage is 12 volts (DC) and is provided through the relays fused B+ contact.

The solenoid is polarity sensitive. The PCM energizes the solenoid by grounding it through the power ground terminal on the powertrain control module.

PWM freq on 3,9,10 and 11 is 490Hz, that may be close enough (vs "512").

PE - Have you tried running this outside your sketch, just PWM'ing it?

I have no but I have ran that sketch with an 12v LED and it does the same thing as the solenoid and then I have ran many PWM examples from youtube videos online and all the LED does is stay on with the IRF540 board or with the YYNMOS-4 it turns on when the Potiemeter comes off 0 and goes off when it goes back to 0 does not vary the brightness at all.

  MOSFET RGB LED Strip Demonstration
  Demonstrates use of MOSFETs to drive RGB LED Strip
  Uses three potentiometers for input
  DroneBot Workshop 2019
// Output pins to MOSFETs
int redPin = 3;
int greenPin = 5;
int bluePin = 6;
// Define Potentiometer Inputs
int redControl = A0;
int greenControl = A1;
int blueControl = A2;
// Variables for Values
int redVal;
int greenVal;
int blueVal;
void setup()
  // Setup MOSFET pins as outputs
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  // Setup Serial Monitor
void loop() {
  // Read values from potentiometers
  redVal = analogRead(redControl);
  greenVal = analogRead(greenControl);
  blueVal = analogRead(blueControl);
  // Map values to range of 0-255
  redVal = map(redVal, 0, 1023, 0, 255);
  greenVal = map(greenVal, 0, 1023, 0, 255);
  blueVal = map(blueVal, 0, 1023, 0, 255);
  // Write PWM to pins
  analogWrite(redPin, redVal);
  analogWrite(greenPin, greenVal);
  analogWrite(bluePin, blueVal);
  // Write Color values to Serial Monitor
  Serial.print("Red: ");
  Serial.print(" - Green: ");
  Serial.print(" - Blue: ");
  // Add a slight delay
const byte PWMout = 3;
const byte PWMval [] = {10,50,100,200};
const int hold = 2000;

void setup() 
  Serial.print("ok \r\n\r\n");
  pinMode(PWMout, OUTPUT);

void loop() 
  for(int idx = 0; idx < 4; idx ++)
  for(int idx = 2; idx >= 0; idx --)

  digitalWrite(PWMout, LOW);

If you make the frequency to high the relay will not be able to open and close its contacts at that rate.

If you make the frequency to low the relay will make noise.

First off dealing with MOSFETs and secondly how would you like me to change the frequency?

No Joy with my sketch then?

Well kinda I changed to pin 3 after what you have in your sketch and it looked somewhat like a graph so I tried this is what I came up with The first picture is after the mosfet board and the second is before like out of the arduino. Is there a way to clean that up or is that just a cheap mosfet board?

"Kind of like a graph"?
Your mobile can do videos?
The trigger on your "scope" should be Rising (lo-to-hi transition) - as shown, it's Falling.

With regard to this FET board (which is probably overkill) - with everything disconnected, I would like to know what the resistance from Gate to GND is.

Can you please post a image(s) of you project, so we can see your component layout?

Can you also remove this link, that PCB is optocoupled, you do not need it, also it will possibly contribute to noise when connected to a noisy engine environment.

When you use the scope, place the scope probe and gnd across the solenoid terminals.

I would suggest you forget your existing code for the moment and write code JUST for the solenoid circuit, with a potentiometer to control duty cycle.

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

99.5Kohms if I do exactly what you have in your picture

99k -- that's why it's staying on longer than the PWM duty cycle. The gate is staying charged. You see it trailing off there, "bleeding off".
Can you solder in a resistor between those two points (4.7 kohms)?

Yes I will try that in the next day or so and get back with you. Thanks for the help so far.

Also I assume a flyback diode is a good idea. Are these good and the line goes to the positive side correct.

1N4001 Diode DO-41 Standard 1A 50V Rectifier Diode Electronic Silicon Diode