Autosteer_USB_4.3_-_SLIMFARMER_-_MODDED

Is your relay connected to pwm2?

pinMode(2, OUTPUT); // initialize the auto guidance on pin2

You used cytron I believe. In this case simply connect the relay on pwm 2 without any modification of the ino

Connect the relay to the arduino on pin 2 or to the cytron?

I understand now. Thank you very much. Does the code for the pressure transducer sensor look like it would work?

The problem I have now is my relay board is reverse logic. It takes 5 volts to turn it off and gnd to turn it on. Meaning when autosteer is on the relay is off. When autosteer is off the relay is on. That is backwards and wont work very well for me. I could switch to using the normally closed side of the relay but that means it needs to be on when ever autosteer is off and I am not a fan of that.

I think I will buy a high level trigger relay on amazon and use that instead of the low level trigger relay that I currently have.

https://www.amazon.ca/Relay-Module-Optocoupler-Channel-Trigger/dp/B07WXJ9GTP/ref=sr_1_3_sspa?dchild=1&keywords=relay+high+level&qid=1597623215&refinements=p_85%3A5690392011&rnid=5690384011&rps=1&sr=8-3-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzVzQ2Wk43QUxVN0hRJmVuY3J5cHRlZElkPUEwMTY2NTgwM0lMM1JNOE1PTEFUUyZlbmNyeXB0ZWRBZElkPUEwMjA4MTE1MTZSSkFaUzBaQzVKMiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=

Hi
check at this post,
maybe you have just to “invert the relays” in aog.
https://discourse.agopengps.com/t/nh-cr9060-aog-in-parallel-with-the-original-hydraulic-system/1844/13?u=pat

1 Like

Actually yeah maybe I can just change the 1 to 0 and 0 to 1 on the “digitalWrite(PWM2_RPWM, 1);” lines. I will try that first.

I have a little trouble with this concept of low activation for a guide relay, high activation seems safer to me because in the event of a power cut the autoguiding is deactivated which is less risky than seeing the valve Autoguiding unexpectedly activated with power failure.

When power cuts off, there’s also no GND from the arduino, means the relay will also shutoff…
But i have to say, high active relays are better for this solution!

Instead of relays, you can use a mosfet switch that I already mentioned here on the forum. The control is low, fits without any rework and no problems with burned out contacts, and the noise is less than that caused by sparking contacts and causing problems.

When the relay fails i’ll change to a mosfet. However for now I re coded it to use pin 2 like it was before. That way I don’t need to change any hardware for now.

I have a lot of discing to do and really don’t feel like steering haha. I’ll make it all proper on a rainy day.

I could of used pwm2 and just changed the 1 to a 0 and a 0 to a 1 but this way I dont have to open my box again :slight_smile:

 if (watchdogTimer < 10)
      { 
       //Disable H Bridge for IBT2, hyd aux, etc for cytron
        if (aogSettings.CytronDriver) 
        {
          if (aogSettings.isRelayActiveHigh) 
          {
            digitalWrite(PWM2_RPWM, 0);
            digitalWrite(2,HIGH);   // modified by Slimfarmer on 8-17-2020  Deactivate auto guidance relay   <-----------------------------MODIFIED
          }
          else  
          {
            digitalWrite(PWM2_RPWM, 1);
            digitalWrite(2,LOW);   // modified by Slimfarmer on 8-17-2020  Activate auto guidance relay   <-----------------------------MODIFIED
          }
        }
        else digitalWrite(DIR1_RL_ENABLE, 1);     
        
        steerAngleError = steerAngleActual - steerAngleSetPoint;   //calculate the steering error
        //if (abs(steerAngleError)< steerSettings.lowPWM) steerAngleError = 0;
        
        calcSteeringPID();  //do the pid
        motorDrive();       //out to motors the pwm value
      }
    else
      {
        //we've lost the comm to AgOpenGPS, or just stop request
        //Disable H Bridge for IBT2, hyd aux, etc for cytron
        if (aogSettings.CytronDriver) 
        {
          if (aogSettings.isRelayActiveHigh) 
          {
            digitalWrite(PWM2_RPWM, 1);
            digitalWrite(2,LOW);   // modified by Slimfarmer on 8-17-2020  Activate auto guidance relay   <-----------------------------MODIFIED
          }
          else  
          {
            digitalWrite(PWM2_RPWM, 0);
            digitalWrite(2,HIGH);   // modified by Slimfarmer on 8-17-2020  Deactivate auto guidance relay   <-----------------------------MODIFIED
          }
        }
        else digitalWrite(DIR1_RL_ENABLE, 0); //IBT2
                
        pwmDrive = 0; //turn off steering motor
        motorDrive(); //out to motors the pwm value
        pulseCount=0;
     }           
  	} //end of timed loop

Please edit your code with triple BACKTICKS on a separate line before and after the code or copy these ``` it will make it format for easier viewing and coping.


salut TERVUREN, tu n’aurais pas le même shema pour roulette ou volant électrique ?

tu peux telecharger le support_files de github
→ repertoire “doc”
→ fichier " steer.png"

salut, merci bien, sauf que la carte ne ressemble pas à l’ardusimple?

Les deux images sont des cartes lié a l’autoguidage

l’ardusimple est la carte GPS par définition n’as pas de lien avec cette carte

il existe des versions ou l’ardusimple est avec la carte d’autoguidage mais c’est pour regrouper les cartes ensemble car il partage rien

ok merci, je suis une tare, excusez moi de mon ignorance, va falloir que je mette tout bout à bout

le forum est la pour ça,
bon courage