There are a few places. Can you just use the coffeetrac ino?
Yes I can. But doesn’t pcbv2.ino have better roll filtering?
File Autosteer_switch-master.zip unzip and open I arduino.
In file “PID.ino”
write on botom file, or copy-paste:
//=========================================
#if (Output_Driver == 4) //PWM 50% if pwmDrive ~ 0 , PWM 0% if pwmDrive -255 …
void motorDrive(void)
{// Used with Danffos valve 50% pwm off valve
pwmDanffos = (pwmDrive/2)+128;
if(pwmDanffos > 195) pwmDanffos = 195; // max 0,75 U , PWM 75%
if (pwmDanffos < 1 ) pwmDanffos = 48; // min 0,25 U ,PWM 25%
analogWrite(PWM1_PIN, pwmDanffos);
}
#endif
//==========================================
In file “Autosteer swetch” on top file write “4” :
#define Output_Driver 4
same file, need add “pwmDanffos = 0 “ :
//pwm variables
int pwmDrive = 0, drive = 0, pwmDisplay = 0 ,pwmDanffos = 0;
float pValue = 0, iValue = 0, dValue = 0;
Need test and PWM duty cycle should have range between 25% to 75%.
looks fine and I think I understand the settings. Except where the numbers -255 and 255 come from?
And please spell the company name Danfoss correct
PID.ino
PID calculation:
*//Proportional
pValue = steerSettings.Kp * steerAngleError *steerSettings.Ko;
/* //Derivative
dError = steerAngleError - lastLastError;
dValue = Kd * (dError) * Ko;
//save history of errors
lastLastError = lastError;
lastError = steerAngleError;
*/
drive = pValue;// + dValue;
pwmDrive = (constrain(drive, -255, 255));
//add throttle factor so no delay from motor resistance.
if (pwmDrive < 0 ) pwmDrive -= steerSettings.minPWMValue;
else if (pwmDrive > 0 ) pwmDrive += steerSettings.minPWMValue;
if (pwmDrive > 255) pwmDrive = 255;
if (pwmDrive < -255) pwmDrive = -255;
*
8 byte PWM resolution on arduino nano(255) , for driver direction DIR pin, and PWM ,DIR pin LOW left side -255 max write to PWM 255 , right side DIR pin HIGH 255 max write to PWM 255 for max duty cycle.
For Danfoss valve not need DIR pin for change direction.
If max left from PID calculation “pwmDrive” = -255
from code pwmDanffos = (pwmDrive/2)+128;
(-255/2) + 128 = ~ 0 min duty cycle
if max right PID calculation “pwmDrive” = 255
(255/2) + 128 = ~ 255 max PWM duty cycle
If pwmDrive from PID calculation 0 , no stering error PWM 128 , valve close
sorry about my english
PWM to Voltage Converter Module 0%-100% to 0-10V
I don’t understand the code at all, but thanks anyway
I wouldn’t recommend using switch.ino with hydraulic steering. Maybe some day, someone will put that code in the PCBv2.ino
For the Danfoss valve, the mentioned converter is not needed and can only handle 100 mA and danfoss uses up to 700 mA. So we must use a motorcontroller as “pwm converter”.
On the signal pin (U s) It needs between 25 and 75 % of supply voltage, so in our case we would probably have 12 v on supply pin U dc), which demands a feed of something between 3v and 9v to the input/signal pin on the danfoss head to control the valve.
On yours link says:
Signal current at rated voltage 0.25 mA to 0.70 mA
700mA are 7000 x > 0,70mA
You are absolutely right, I also did write 0,70 mA in my first post and changed it to 0,7 A today.
My fault was to read page 8 too quick saw 0,3 A in the scheme and then went back here.
I rechange the first post to mA
Coffeetrac arduino program for Danfoss valve 0,75 to 0,25 PWM for IBT-2 driver motor, and steering Wweel ENCODER :
Its been there since the summer.
So I had to do the test, used the coffeetrac button ino i downloaded last summer, and edited it to nr. 4 Danfoss.
And Yes it works right out of the box(no other change to ino than 4 instead of 2) And I have around 6 V straight ahead.
Although the used pins changes: instead of D9 I had to use D4 as PWM2 for my IBT_2. I use pcbv1
D5 is still used to activate/enable L_en and R_en on IBT_2
BUT I still can´t find out where and how the offset is done, so I am still at the same lack of understanding as i write in posts around 15 and 17 above
Offset???
In “PID.ino”
code : " pwmOut = pwmDrive+ 128; // add Center Pos. "
change 128 to 127 or 126, or 129 , 130 … output change to 6.1 or 6.2 etc… or 5.9V , 5,8V
In PID.ino existing 2 line of code : pwmOut = pwmDrive+ 128;
change both and compile.
-
Valve use DC voltage for control not PWM.
-
For offset by DC DC voltage regulator 5-6A ,connect power supply from voltage regulator to valve. Danfoss valve current consumption at rated voltage 12V are 0.33A. On voltage regulator thru changing voltage you tune offset on front tires .
-
by PWM to DC voltage converter (post above) , connect with voltage regulator above(power supply) , or better separate voltage regulator but smaller , constant voltage, not drift. Connect from arduino PWM and GND to PWM to DC converter.
-
No need change nothing in software for tune offset in driving tires , hardware setting offset with screwdriver.
-
Turn off auto steering from signal from clutch , brake ……………………….
On this video coffeetrac use analog voltage for driving valve.
Now I see the connection: PID.ino opens automatically together with autosteer_button.ino and you can find it by pressing the “arrow down sign” at top right side of arduino program screen.
So when compiling all the files mentioned in the top line are “put together” before uploading to nano.
Thank you for your patience grabik
I like the brake or clutch idea, as a “footswitch” mentioned in line 5 above.
Just to be sure…
When using coffeetrac button.ino with defined output driver = 4 Danfoss Valve PVE A/H/M + IBT_2 Driver, IBT2 wiring scheme would look like this?
Why not use D9 instead of D5 since its already there on the same connector?
I don’t know. I’ll wire it as it is defined in coffeetrac button.ino. Just want to be sure that the wiring is correctly made once and for all since I’m not able to test it with Danfoss myself.
So I’d really appreciate it if someone more knowledgeable would tell me if that wiring is correct in that picture.