Cant center the steering servo

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #3518
    Nishitoku
    Participant

    Hi guys,

    is there a good method to calibrate the steering servo with the servo limits in the code?
    I updated my Fendt939 with the Massey code after the latest update(Dip lights).
    i didnt ever modify the steering values. they worked out of the box for an original SIKU steering servo.
    but after the update the servo behaves strange.
    it moves only 10° to one side and starts spinning around steering to the other.
    I resetted everything. went to the old librarys, the new libs, modified the tractor code amd the libs…
    nothing works but only got worse.
    After changing all the parameters back and forth for a few days i am a bit exhausted, and out of ideas 🙂

    how to calibrate a servo with method, using the parameters provided?

    greetings from germany

    #3522
    RC Tractor Guy
    Keymaster

    That is strange, I don’t know why it would have affected the Massey code like that.

    I haven’t taught of a good way to calibrate the servos yet, I usually set them to 00 and FF then start moving one side in i.e. try 10 then 20 the 30 and so on until I hit that limit and then do the same for the other side i.e. EF then DF etc.

    #3523
    Nishitoku
    Participant

    I tried this, but the steering value seems to be off centered.
    when the range is 0 – 255 i assume 127 is the middle.
    when i go 90 to the left and 90 to the right i come up with 37 to 217.
    all of the servos i tried move about 20° in both directions which is too little and the servos are over the limit on 1 side, too.

    i suspect the map function or something else doesnt center the values right.

    aditionally i connected a LED directly to pin 10 and the brightness doesnt change much. there are a lot of random brightness spikes, though.

    What troubles me is, that it worked perfectly. Its a riddle 🙂

    I saw that the function SetServoLimits() is called in the body AND in the cab code but that should do no harm.

    I build a test system with 2 mini pro arduinos, receiver module and all light and servo functions to track the issue. the behavior is the same as on the modell, so it is not the hardware.

    Must be somewhere in the code and i cant see it.

    #3525
    Nishitoku
    Participant

    i now put serial.print all over the code to find out what that map function does.
    its wiered.

    _Steering_Servo_Min: 90
    _Steering_Servo_Max: 110
    _Steering_Val_Map: 99
    New_Steering_Val: 125

    _Steering_Servo_Min: 90
    _Steering_Servo_Max: 110
    _Steering_Val_Map: 109
    New_Steering_Val: 254

    the values are correct inside the boundries defined.

    the servos are spinning like crazy, though….

    #3528
    RC Tractor Guy
    Keymaster

    This is hardly a problem of power, are you using a fully charged battery? Just wondering if there is a drop in power every time the servo tries to move which is causing the servo controller or Arduino to reset.

    #3544
    Nishitoku
    Participant

    Update on this:
    Still trying to get my modells going again after all these weeks.
    Purged everything from my harddisk and performed a clean install. No effect.
    Tried several power sources. No effect.
    Since the values are all ok, i thought about looking into the PWM signal to the servo itself and got myself an oszilloscope.
    I can see, that the signal itself is shifted, so that the value 127 isnt the middle, but about 20° on the servo.
    It must be something with the servo.h.
    I hope i get this sorted out someday. All my projects are on halt. Steering is somehow essential 🙂

    Greetings from Germany!

    #3545
    modelleicher
    Participant

    Hi,

    Probably nothing you don’t know that I can tell you.. But I try anyways.

    The Servo values are between 0 and 180 typically. So the min and max values have to be below that. The center is always between the min and the max value.
    So if the min value is 90° and the max value is 110° the center is 100°. If the steering is off-center it seems likely that the min and max values are off center at first.

    The printed values you listet above make perfect sense.
    If the minimum is 90° and the max. is 110° and you have an Input of 125 (slightly below 127, the half-way point) you get an output of 99 (slightly below 100, the center for the servo)

    So the code seems to be doing what it is supposed to be doing. At an Input of 127 you don’t get 90° (half way there in the pwm signal) if the min and max values aren’t offset from those 90° the same amount in either direction. (like min. 80 and max. 100 = 90° at center)

    So far so good, but I guess you already knew all of that.

    What Servos are you using? Not all servos can travel the whole 180° the Arduino library supports. Some do only 90°.
    Also, not all servos are.. “fail save”. For example the cheap 4.3g tiny servos from china don’t have an end-stop. If you give them values below 12° and above 160° roughly they start just turning endlessly.. So it could also be that you have a problem with your servos.

    By the way if you still don’t know what the map function does:
    x = (y, min, max, minA, maxA);
    x = (512, 0, 1023, 0, 127);
    –> x = 64;
    So the first value (y) is the start value. The min and max are the boundarys that start value operates in. The minA and maxA values are the boundarys the output value operates in. The output value is then calculated accordingly (relative to the boundarys)
    You can also do something like this:
    x = (255, 0, 1023, 1023, 0);
    –> x = 768;
    to reverse the value.

    Greetings also from germany

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.