Hi.
I have the same system here, but it’s based on another mosfet (actually, dual H-Bridge) for controlling 2 FAN’s of my electronic box based on temperature. I think you can use the same code…just use another type of temperature sensor since you might be insert into water tube.
In my case, temperture sensor is i2c based.
Output 1 and 2 are for the channel 1, output 3 and 4 are for channel 2.
Output polarity is variable. You can control output polarity (therefore the direction of motor) using IN1 and IN2 pins (for channel 1) and turn it ‘on’ using EN pin (the one that came with jumper).
Since I won’t reverse my motor, I have hard-wired IN1 to +5v and with PWM signal to EN pin I can control the speed of motor.
so just to confirm the wiring diagram.
Battery 12v and grd to input
pump 12v+ to output 1 and 12v- to output2
5v to in1 pin
GPIO19 (PWM signal) to ENA do I need to remove the jumper?
** update I did remove the jumper and was able to control the speed.
OK, I have this all rigged up now I think. how do I know what frequency to set?
frequency: 10000 Hz
The problem I was having was 0.33 wasn’t enough to power the pump and I was just getting a high pitch sound. I increased this to Low = 0.6 Medium 0.7 High = 1
The next problem I have is the L298n heatsink getting extremely, hot but I think that is because my pump is 100w pulling about 8.3 amps.