Hydraforce Solenoid control

Hello,
I use a V2 card with an MD13S cytron to control a hydraulic block with TM 63402 hydraforce valves for a low (100 to 400 Hz) or high (over 5000 Hz) PWM frequency.

// TCCR2B = TCCR2B & B11111000 | B00000001; // set the timer divider 2 to 1 for a PWM frequency of 31372.55 Hz
// TCCR2B = TCCR2B & B11111000 | B00000101; // set the timer divider 2 to 128 for a PWM frequency of 245.10 Hz
// TCCR2B = TCCR2B & B11111000 | B00000110; // set the timer divider 2 of 256 for a PWM frequency of 122.55 Hz

I added one of these lines in AutoSteer PCB2.ino
another way to lower the PWM frequency to 175 Hz?
Thank you for your help

Hello, what the best frequency for Hydraforce valves?

for now my installation is not finished and I have not tested anything in real condition but it seems that 245.10 is not too bad

Is it better lower or higher?

the result seems better in low frequencies

Hallo, ich habe verschiedene Frequenzen, von 122-5k-20kHz
getestet. Mir wäre kein entscheidender Unterschied aufgefallen.
Der Unterschied zw. Ibt2 und pololu ist größer.

Bitte der unterschied zw. ibt2 und pololu mit hydraulikventil beschreiben. Ist ibt2 für hydraulikventil besser oder??

Prinzipiell geht beides. Vorteil finde ich ist, das ich nur einen Nano und den pololu habe, keinen spannungswandler und kein ads. Es gibt auch mehr und feiner Einstellungsmöglichkeiten als beim iBT2.

Does this also work with the v4 ino file? Where should the right line be inserted?

Autosteer_UDP.ino.txt (22.0 KB)
here is my file if it can help you

1 Like

Tried with 122.55 Hz, but couldn’t see any difference to default frequency.
AOGv3.0.9 and Coffeetrac Button.ino.

I did not see a big difference in lowering the frequency but more in increasing it probably depends on the type of solenoid

For Arduino Uno, Nano, YourDuino RoboRED, Mini Driver, Lilly Pad and any other board using ATmega 8, 168 or 328
//---------------------------------------------- Set PWM frequency for D5 & D6 -------------------------------
//NOTE: Changing this timer 0 affects millis() and delay!
//TCCR0B = TCCR0B & B11111000 | B00000001; // set timer 0 divisor to 1 for PWM frequency of 62500.00 Hz
//TCCR0B = TCCR0B & B11111000 | B00000010; // set timer 0 divisor to 8 for PWM frequency of 7812.50 Hz
TCCR0B = TCCR0B & B11111000 | B00000011; // set timer 0 divisor to 64 for PWM frequency of 976.56 Hz (The DEFAULT)
//TCCR0B = TCCR0B & B11111000 | B00000100; // set timer 0 divisor to 256 for PWM frequency of 244.14 Hz
//TCCR0B = TCCR0B & B11111000 | B00000101; // set timer 0 divisor to 1024 for PWM frequency of 61.04 Hz

//---------------------------------------------- Set PWM frequency for D9 & D10 ------------------------------

//TCCR1B = TCCR1B & B11111000 | B00000001; // set timer 1 divisor to 1 for PWM frequency of 31372.55 Hz
//TCCR1B = TCCR1B & B11111000 | B00000010; // set timer 1 divisor to 8 for PWM frequency of 3921.16 Hz
TCCR1B = TCCR1B & B11111000 | B00000011; // set timer 1 divisor to 64 for PWM frequency of 490.20 Hz (The DEFAULT)
//TCCR1B = TCCR1B & B11111000 | B00000100; // set timer 1 divisor to 256 for PWM frequency of 122.55 Hz
//TCCR1B = TCCR1B & B11111000 | B00000101; // set timer 1 divisor to 1024 for PWM frequency of 30.64 Hz

//---------------------------------------------- Set PWM frequency for D3 & D11 ------------------------------

//TCCR2B = TCCR2B & B11111000 | B00000001; // set timer 2 divisor to 1 for PWM frequency of 31372.55 Hz
//TCCR2B = TCCR2B & B11111000 | B00000010; // set timer 2 divisor to 8 for PWM frequency of 3921.16 Hz
//TCCR2B = TCCR2B & B11111000 | B00000011; // set timer 2 divisor to 32 for PWM frequency of 980.39 Hz
TCCR2B = TCCR2B & B11111000 | B00000100; // set timer 2 divisor to 64 for PWM frequency of 490.20 Hz (The DEFAULT)
//TCCR2B = TCCR2B & B11111000 | B00000101; // set timer 2 divisor to 128 for PWM frequency of 245.10 Hz
//TCCR2B = TCCR2B & B11111000 | B00000110; // set timer 2 divisor to 256 for PWM frequency of 122.55 Hz
//TCCR2B = TCCR2B & B11111000 | B00000111; // set timer 2 divisor to 1024 for PWM frequency of 30.64 Hz

PWM-frequency may slightly influence how easily solenoid will make the movement. In lower frequency solenoid is vibrating all the time, so it can move more easily.