.ino for PCB+MD13S+Danfoss valve

Thanks for the tip. Can you confirm that the wiring in my photo is correct when using coffeetrac button.ino as it is?

I can t confirm. Would have to check real life, which pwm goes to m- and m+
I use my ibt_2 with 2 spool valve, so I don’t know.

But wiring between PCB and IBT2 is correct?

Yes your schematic/diagram is working.
You have pwm1 to left.(which means you get danfoss Us out of M+)

BUT: Ino says(in the Pinmapping = = 0 part): #define PWM1_PIN 5 //PD5 Motor=PWM //PWM Valve= Coil 1 right // Danfoss= Control, and that is how my IBT_2 is connected to pcb. And that is why I have D3 to Right PWM when using Pinmapping = = 1.

I did a new test where i changed/swapped 5 and 9 in the define lines.(then still use my flat ribbon connection to IBT_2)
I have D3 to RPWM.
D4 to LPWM
D9 to L and R_EN
In the picture you see black wire (i used same colours as you did in your schematic) goes from M+ to right multimeter as Udc
And red goes from M- to left multi as Us
Max change i Us is from 4,77v at max right in the AOG drive bar, to 7,32 at max left.
I would also recommend as Grabik shows above, the DC DC voltage converter (for easy straight ahead adjustment together with the IBT_2
Or skip the IBT_2 and go the PWM to DC converter way, but perhaps Grabik has a wiring diagram for that?
Oh forgot to mention it is a reduced size version of PCBv1 which made it possible for me to edit pcb in free Eagle. But still same schematic.
Same ino as PCBv2, or Coffeetrac can be used,(but remember different pinmapping in those two)

20200127_103735

1 Like

Thanks for the thorough testing. I’m pretty confused, but I trust what you said at that first sentence. :smiley:

I finally got to test the hardware and the results look promising. The Volt range in US is 25-75% of UDC.
IMG_0644 IMG_0645

Great, and wow that is a nice build you have in that box. Is back plate acting as cooler for ibt_2?

Edit dec 2020: in post 66 Kaupoi also got it working with 4.3.10

Thanks. Had similar box and parts in use last summer with hydraforce valve. Never had any issues with it. Valve solenoid works with low amps so no extra heat sink needed.

I have my pcb v2 and Danfoss system working with cytron md13s. Brian was right, put the pwm signal from pwm1 and the ground. If the dir is not connected it puts the signal to MA output. With 5v to dir, it switches to MB. I want to put 5v to pwm2 to energize an ssr relay to send 12v to Udc on valve. I just connected direct for testing. I haven’t been able to get code to work with v4.1, 4.1.12, or 4.3.10, so I’m still using coffeetrac button. Its works fine but I can’t adjust anything from AOG. I tried using an ino that was on github, cant remember who’s, but I cant seem to get a pwm signal or 5v from dir and pwm2 out of any of them.
Also when I use v4.1 or v4.1.12, the screen spins when I turn roll from mma 1d. I sat the rate to 8 from GPS but I haven’t been able to figure out how to set it for gga and vgt only from the co99 f9p. I’m hoping that is what my problem is.
Short astory long, one ibt2 quit working. Another didn’t work out of the box, and the cytron works well and the steering was a lot more stable, it seems with v4.1 and v4.1.12.
If anyone has any help, for any of these problems, I would appreciate it.

Got .ino working in v4.4.12 with danfoss valve. Also got rtk base up and running.
Proportional is at 100, output is at 180 or so, min pwm is at 26. Angle per degree is 24.
Steering is pretty decent but seems to be busy all the time.
The gains are a lot higher than they were with coffeetrac and ibt.
Should I change pwm frequency, or is there something else I’m missing ?

Have been trying to modify 4.3.10 ino to work with danfoss valve. I cant seem to get pwm1 to give voltage. Dir works on switch, but nothing out of pwm1. Could sure use some help

Did you use this part of ino made by JhnP?

JohnP

28 Apr

I am using an IBT2 to control the steering on an 8330 with Danfoss. I have 12v on the Udc pin, and the pwm signals from the arduino sets the Us. 6V steers straight ahead, 9V to the left and 3V to the right. I have some pics JD 8230 hydraulic steering . Its not a clean setup but it has been working nice on my one field test cultivating. @theGtknerd i noticed while i was originally setting up that with 1 hz on gps it was all over the place, but now at 10hz its smooth. Any chance that could be an issue for you? I have been using v3.9 with the coffeetrac button ino. I think that with the code written like i have it below that it seems to be working fine on my bench test setup but no actual field experience yet. I am a total arduino beginner so if anything in this coding seems wrong please let me know.

Autosteer PID

void motorDrive(void)
{
// Used with Cytron MD30C Driver
// Steering Motor
// Dir + PWM Signal
if (aogSettings.CytronDriver)
{
pwmDisplay = pwmDrive;

  //fast set the direction accordingly (this is pin DIR1_RL_ENABLE, port D, 4)
  if (pwmDrive >= 0) bitSet(PORTD, 4);  //set the correct direction
  else   
  {
    bitClear(PORTD, 4); 
    pwmDrive = -1 * pwmDrive;  
  }

  //write out the 0 to 255 value 
  analogWrite(PWM1_LPWM, pwmDrive);
}

else
{ // Danfoss: PWM 25% On = Left Position max (below Valve=Center)
// Danfoss: PWM 50% On = Center Position
// Danfoss: PWM 75% On = Right Position max (above Valve=Center)
// Used with IBT 2 Driver for Danfoss
// Dir1 connected to BOTH enables
// PWM Left + PWM Right Signal

pwmDrive = pwmDrive / 4;
pwmDrive = pwmDrive + 128; // add Center Pos.

pwmDisplay = pwmDrive;
analogWrite(PWM1_LPWM, pwmDrive),  // apply varying voltage to the Usignal valve pin
digitalWrite(PWM2_RPWM, HIGH);     // apply 100% DC current to Udc

}
}

I also experimented with one (but stolen from @grabik ) , where I would let AOG setting be for Cytron, and want PWM out on PWM1
12V Power for Danfoss valve should be regulated and not through motordriver
I tried to edit autosteer_USB_4.3.10 PID.ino and it does compile but I don´t know if it works.

I put al new stuff between Start Danfoss and End Danfoss
And commented out what I don´t think is needed by //lvdfoss

Edit dec 2020: in post 66 Kaupoi made it work with 4.3.10


void calcSteeringPID(void) 
 {  
  //Proportional only
  pValue = steerSettings.Kp * steerAngleError;
    
  //pwmDrive = (constrain(pValue, -255, 255));
  pwmDrive = (int)pValue;

  //steerSettings.lowPWM
  
  errorAbs = abs(steerAngleError);
  int newMax = 0; 
   
  if (errorAbs < LOW_HIGH_DEGREES)
  {
    newMax = (errorAbs * highLowPerDeg) + steerSettings.lowPWM;
  }
  else newMax = steerSettings.highPWM;
    
  //add min throttle factor so no delay from motor resistance.
  if (pwmDrive < 0 ) pwmDrive -= steerSettings.minPWM;
  else if (pwmDrive > 0 ) pwmDrive += steerSettings.minPWM;

  //limit the pwm drive
  if (pwmDrive > newMax) pwmDrive = newMax;
  if (pwmDrive < -newMax) pwmDrive = -newMax;

  if (aogSettings.MotorDriveDirection) pwmDrive *= -1;
 }

//#########################################################################################

void motorDrive(void) 
  {
    // Used with Cytron MD30C Driver
    // Steering Motor
    // Dir + PWM Signal
    if (aogSettings.CytronDriver)
    {     
      pwmDisplay = pwmDrive;
 //Start Danfoss=========================================
//#if (Output_Driver == 4) //PWM 50% if pwmDrive ~ 0 , PWM 0% if pwmDrive -255 …
//void motorDrive(void)
// Used with Danfoss valve 50% pwm off valve

 pwmDanfoss = (pwmDrive/2)+128;
if(pwmDanfoss > 195) pwmDanfoss = 195; // max 0,75 U , PWM 75%
if (pwmDanfoss < 1 ) pwmDanfoss = 48; // min 0,25 U ,PWM 25%

analogWrite(PWM1_LPWM, pwmDanfoss);
}
//#endif

//End Danfoss==========================================
      
  
//lvdfoss      //fast set the direction accordingly (this is pin DIR1_RL_ENABLE, port D, 4)
//lvdfoss      if (pwmDrive >= 0) bitSet(PORTD, 4);  //set the correct direction
 //lvdfoss     else   
//lvdfoss      {
//lvdfoss        bitClear(PORTD, 4); 
//lvdfoss        pwmDrive = -1 * pwmDrive;  
 //lvdfoss     }
  
//lvdfoss      //write out the 0 to 255 value 
//lvdfoss      analogWrite(PWM1_LPWM, pwmDrive);
 //lvdfoss   }

The PID.ino continues normal from here.

I’m also using ino from @grabik. I did uncomment
pwmDrive = (constrain(pValue, -255, 255))
And commented pwmDrive = (int)pValue
Also changed out pwmDrive > newMax to 255
And several other changes
I does verify but I get no pwm out

By that you mean that output from Dir changes every time you toggle the autosteer switch?

I don’t have a cytron but this is what I’m using with ibt2. There are no changes from what I posted earlier Autosteer_USB_4.3.10_8330 - Google Drive

1 Like

Yes, I have it connected so the Us goes to mB on cytron. Just another safety so there is no power to danfoss except with switch engaged

You answer yes, so it is not the problem with “must enable steerswitch once” even when manual/no steer switch is chosen in AGOpen setup.
Do you have a double Cytron? I believe the Dir pin change between mA and mB on the MD13s
So sometimes it is the PWMvalue PWM1_Lpwm that goes to mB and sometimes there is nothing, because not both mA and mB can output at same time.

Correct. I have connection from mB to Us, nothing on mA. When steer switch is engaged, cytron receives 5v from dir switching it from mA to Mb for output. This way there is no voltage to Us until steer switch. Also i have a opto relay with 12v from board, connected to Udc of valve. pwm2 is connected to relay, so relay energizes at steer switch true and sends 12 to Udc of danfoss. This way there are 2 safeties. I can get dir and pwm2 to work, but I continue to fail to get pwm1 to send any voltage.
The problem is that I have never written arduino code, so its probably something simple that I’m overlooking. Also was wondering if I should wait for Brian to release his new version, and start fresh with it, lest for some reason this ino not work with the new version.

Finally! A working INO file for AOG v4.3.10 and Danfoss!
Thank you very much. :+1:

20201223_203757

1 Like