Motoren pfeifen, drehen aber nicht

Hallo Zusammen,

Als ich von dem Ardumower gehört habe, war ich sofort Feuer und Flamme und bin sofort mit der Planung angefangen. Durch die aktuellen Lieferengpässe habe ich mich entschlossen, die Platine nachzubauen und konnte so auch das Gehäuse schmaler bauen. Ich habe jetzt einen Radstand von 28,5cm, Antrieb hinten und eine Lenkrolle vorn im Abstand von 45cm zur Hinterachse. Damit benötigt er zum Drehen etwas Drehmoment da er so schmal und lang ist. Das ist auch schon mein Problem. Ich hatte Azurit getestet und die Einstellungen soweit gemacht, dass er gut lief und auch drehte. Gern wollte ich aber in Bahnen fahren und habe Aruritber geflasht. Soweit funktioniert alles, keine Fehler. Versuche ich im Modus Lanes zu starten, fängt er an zu drehen (Kalibrieren?), kommt aber nicht bis zum Ende der Drehung. Er bleibt pfeifend(PWM) stehen. Wenn ich ihn anheben, drehen die Räder langsam aber kraftlos. Ich bin auf der Suche nach einer Einstellung wie MinOdoPWM für alle Bewegungen, sodass er bei langsamer Geschwindigkeit nicht stehen bleibt. Besser noch eine Regelung der Drehzahl mit Hilfe der Odometrie. Die vorhandenen Parameter p und i habe ich schon ohne Erfolg verändert. Würde es Sinn machen, im <Driver> dem Speed eine Untergrenze über zu bügeln? Hat jemand einen Tip für mich, warum die Motoren nicht (immer) anlaufen?

Verbaut sind Golf3 Scheibenwischermotoren und BTS7960 Treiber - also eigentlich Leistung im Überfluss. Die Kombi läuft auch sehr kraftvoll bei genügend PWM.

Danke

Jens


IMG_20210718_144342_BURST012.jpg
 
Do you use IMU ? If mower roll maybe the Compas is activate try to deactivate it into setting IMU.

What about the ticks/rev ?

Into setting IMU set to 100%

Capture d’écran 2021-07-27 130228.png

Into motor setting set this to max possible.
Capture d’écran 2021-07-27 130317.png
 
Hi Bernard,
thank you for the quick answer. Yes, I want to use IMU and try the MPU9250 board. Therfor I've donloaded the AzuritBer-AZURITBER-MPU9250 version. I modified some settings in the mower.cpp and robot.cpp to get the BTS7960 motor drivers working.
I also tried some speed settings, but I might to shy with that.
here my settings:

motorSpeedMaxRpm = 38; // was 24 motor could run at 41 RPM
motorSpeedMaxPwm = 255;
motorLeftPID.Kp = 3.0; //was 1
motorLeftPID.Ki = 0.4;
motorLeftPID.Kd = 0.0;
motorTickPerSecond = 300; (pre setting - I've pressed the Calib Tick/Second at start-up)
UseAccelLeft = 1;
UseBrakeLeft = 1;
UseAccelRight = 1;
UseBrakeRight = 1;
SpeedOdoMin = 140; //70
SpeedOdoMax = 220; //140
odoLeftRightCorrection = true;
imuUse = 1;
CompassUse = 1;
stopMotorDuringCalib = 0;
imuDirPID.Kp = 4.4;
imuDirPID.Ki = 3.3;
imuDirPID.Kd = 0.0;
imuRollPID.Kp = 0.8;
imuRollPID.Ki = 21;
imuRollPID.Kd = 0;
compassRollSpeedCoeff = 60; //was 40
odometryUse = 1;
odometryTicksPerRevolution = 1200; encoder makes 600 ticks, by using rising and falling impulses for the interupt I get 1200 ticks/REV (to much?)
odometryTicksPerCm = 17.37; // Umfang=Raddurchmesser x Pi =22cm x3,14 =69,08mm => 1200/69,08cm = 17.37 encoder ticks per cm
odometryWheelBaseCm = 28.5;

I already increased compassRollSpeedCoeff to 60 without effect (or to small effect?). I'll try to go higher with this parameter. During my trials I turned off the compass and set different values for a lot of those parameters - no change (maybe to shy). Do you see any other points that could be corrected? Or do you know about other "hidden parameter" somewhere else? I'm also pretty uncomftable with playing with the PID Parameter, it's hard to find good settings. Do you have experience with that? On my next try I'll focus on compassRollSpeedCoeff.
Actually, I do not know the needed PWM rate to have a propper start of the motors - is it possible just to set PWM manually?

Thank you for your help!
Jens
 
Ok so i suppose you have programming knowledge.

You can find 3 PID setting:
On motor (they are only use in Manual drive mode)
On IMU (only use to drive straight and keep the heading) Very IMPORTANT
On perimeter (to adjust the tracking react time).
To change PID slider limit go into PFOD.cpp and adjust for IMU for example

sendPIDSlider("g05", F("Dir"), robot->imuDirPID, 0.1, 20); from 0 to 20
to
sendPIDSlider("g05", F("Dir"), robot->imuDirPID, 0.1,30, 20); from 20 to 30

Now into AZURITBER

Odometry is use on small movement (roll left 20 degres for example or reverse for 30 cm .),so each time mower find the wire odometry is use and need to be correctly adjust (The TEST ODO is here for that). Very IMPORTANT that all test are OK.

Imu is use to drive straight, so if PID is OK the mower go straight and found heading rapidly when you move the mower with you foot for example.

Now the motor speed :
You set motorSpeedMaxPwm = 255; and it's not OK because in the code to drive straight the IMU PID result is add to one wheel and subtract to the other, but if mower already run at PWM=255 you can't add the PID result.

SpeedOdoMin = 140; //70 again it's not OK and a big trouble because it's the minimum PWM that you set to have a wheel rotate in normal grass condition and 140 value indicate that your motor have no torque at low speed.

Deactivate the compass stop the roll to find yaw process , so first do your test without compass.

"hidden parameter"
Normaly no hidden parameter ,motor control in normal mowing mode are in the robot.cpp

On each new state the
void Robot::OdoRampCompute() { //execute only one time when a new state execution
in call once to set all the speed accel / break distance etc....

and after the
void Robot::motorControlOdo() {
is call each 15 millis to manage motor


But if your motor run at 40 RPM at PWM=255 and only for example 5 RPM at PWM=140 it can't work (not enough torque at low speed)

Actually, I do not know the needed PWM rate to have a propper start of the motors - is it possible just to set PWM manually?

Using arduremote simply set the motorMaxRPM to max posssible and motorMaxPWM to 100 and try to drive forward in manual mode :
If mower don't move : motor have not enough torque
If mower run into normal grass at PWM=60 it's Good
 
Hi Bernard,
Thank you very much for your expaination! Now I can Check the Motors to See If they are propper to use and have an better understanding of the PID controls. I'll let you know my results.
Thanks
Jens
 
Today I had the Chance to try the PWM settings. You are right, the motors have low torque at low speed. To start In need PWM 120. From there it was possible to increase the the speed up to PWM 255 continously.
Hm, I'm Not verry happy about this result. I would guess that the minPWM has to be about 140. Do you see a chance to map the currently used speeds to 140....255? I can Imagine that I have to go deep into the programming (or to change the motors). Do you see a Chance to get IT Up and running? Do you think Changes in Robot OdoRampCompute and motorControlOdo could be done to solve my issue?
thanks
Jens
 
Changes in Robot OdoRampCompute and motorControlOdo could be done to solve my issue?

Unfortunatly certainly no

But:
Into Pfod.cpp line 183 change the limit slider max value to 250
Code:
sendSlider("a30", F("Speed Odo Minimum"), robot->SpeedOdoMin, "", 1, 250, 0);
And test with SpeedOdoMin = 160


Into robot.cpp from line 2811 to 4030 it's the initial setting of each state movement
Remove all the /2 or /1.5 in motorLeftSpeedRpmSet = motorSpeedMaxRpm / 2; to have speedmax into all movement.

Set motorSpeedMaxPwm to 245

But it's possible with this kind of setting and low torque motor that nothing is smooth.
 
Hello Bernad,

I am very happy about our conversation, thank you for your answers.
In the meantime I was able to do some promising tests.
The idea was to intervene where the speed is finally implemented. In the driver.ccp.
Here's what I tried:

// BTS7960 motor driver
/*Methode 1
R_EN und L_EN auf 5V
L-PWM Signal schaltet Motor vorwärts
R-PWM Signal schaltet Motor rückwärts

wir haben nur ein PWM Signal, daher Methode 2:
Das PWM-Signal auf R_EN und L_EN - dazu beide Eingänge brücken
Pin L-PWM auf 5v schaltet Motor vorwärts
Pin R-PWM auf 5V schaltet Motor rückwärts

Beide Methoden mit den gegebenen Ausgängen nicht möglich
also ist etwas zusätzliche Hardware nötig um den Eingang R_PWM mit
einem invertierten Signal von L-PWM versorgen (über zusätzlichen Inverter z.B. 74HCT244D).
R-PWM mit pinDir ansteuern
Das PWM-Signal (PinPWM) auf R_EN und L_EN legen
Die Motoren haben einen kleinen Drehmoment bei geringem PWM und laufen erst ab ca PWM120 an.
Darum wird der PWM-Bereich von 50 bis MAX auf Werte zwischen 140 und MAX gemappt.
Unterhalb von 50 dürfte kein Motor genügend Drehmoment haben und es würde nur pfeifen.
*/
// PinPWM PinDir
// H H Forward
// H L Reverse
void setBTS7960(int pinDir, int pinPWM, int speed){

int motorNeedToMovePWM = 130;
if (speed > 0)
digitalWrite(pinDir, HIGH) ;
else
digitalWrite(pinDir, LOW) ;
speed = abs(speed);

//Console.print("speed: ");
//Console.print(speed);
//Console.print(" map to -> ");
if (speed > 0){

if (speed >= 90) speed = map(speed,90,255,motorNeedToMovePWM,255);
else speed=motorNeedToMovePWM; // alles unter 90 auf NeedToMove-Drehzahl (wo sich der Mäher gerade noch bewegt)
}
PinMan.analogWrite(pinPWM, speed);
Console.println(speed);
}


My results are pretty good so far. The mower runs cord straight and makes all the small movements completely, so that he drives in the second lane with the wheel exactly on the old lane - super. The movement is still OK. I'm just unsure if I'm messing up any timing with it. What do you think?


Here some Console prints:

speed: 91 map to -> 130
speed: 88 map to -> 130
speed: 93 map to -> 132
speed: 90 map to -> 130
speed: 94 map to -> 133
speed: 91 map to -> 130
speed: 97 map to -> 135
speed: 94 map to -> 133
speed: 98 map to -> 136
speed: 95 map to -> 133
speed: 99 map to -> 136
speed: 96 map to -> 134
speed: 101 map to -> 138
speed: 97 map to -> 135
speed: 102 map to -> 139
speed: 98 map to -> 136
speed: 104 map to -> 140
speed: 100 map to -> 137
speed: 105 map to -> 141
speed: 101 map to -> 138
speed: 115 map to -> 148
speed: 111 map to -> 145
speed: 116 map to -> 149
speed: 112 map to -> 146
speed: 116 map to -> 149
speed: 112 map to -> 146
speed: 117 map to -> 150

Thanks
Jens
 
Cool and good idea ;).
Not sure the warning when changing from forward to reverse without returning to PWM=0 is still working ?
But i don't understand because this kind of behaviour is already in the motorcontrolODO, so maybe a bug in my soft.

Code:
if (motorLeftSpeedRpmSet > 0) { //forward left wheel --------------------------------------------------------------------------
    if ((UseAccelLeft) && (millis() - stateStartTime < accelDurationLeft)) { //Accel mode for duration
      //Sinus accel
      angleCorresp = map(millis() - stateStartTime, 0, accelDurationLeft, 0, 89);
      leftSpeed = PwmLeftSpeed * sin(radians(angleCorresp)); //convert degree to radians
    }
    if (UseBrakeLeft && (odometryLeft > stateEndOdometryLeft - (OdoStartBrakeLeft))) { //Braking mode by odometry
      //Sinus brake
      angleCorresp = map(abs(stateEndOdometryLeft - odometryLeft), OdoStartBrakeLeft, 0, 89, 10);
      leftSpeed = PwmLeftSpeed * sin(radians(angleCorresp));
    }
    if (leftSpeed > SpeedOdoMaxLeft) leftSpeed = SpeedOdoMaxLeft;
    if (leftSpeed < SpeedOdoMin) leftSpeed = SpeedOdoMin; //Minimum speed to be sure the mower is always moving before stop
  }

the last 2 line are here to control the speed on min and max size :
if (leftSpeed > SpeedOdoMaxLeft) leftSpeed = SpeedOdoMaxLeft;
if (leftSpeed < SpeedOdoMin) leftSpeed = SpeedOdoMin; //Minimum speed to be sure the mower is always moving before stop

Have you tested with
SpeedOdoMin = 140
and
SpeedOdoMax=255

into setting motor ?


Can you translate your remark in the code into english because i don't understand them ;) ?

How id you connect the BTS7960 to DUE to have the 2 direction ?
 
Hi Bernad,
yes, I tried

SpeedOdoMin = 140;
SpeedOdoMax = 220;

I've also seen the code you mentioned and tryed therefore to increase the SpeedOdoMin up to 140 but the result was not the same. Actually I do not get the code completely - so many variables ... :) please forgive me when I'm wrong.
By lifting the lower end to 140 you'll have slow movement, but the speed does increase from there in the wrong proportion. So I tried to make no changes to the original range (about 90 to 255 PWM). The original 90 PWM turnes your motor slowly - my motor whistles only. The low torque moter needs 140 PWM for small movement so I need a range from 140 to 255 PWM. By mapping the original range into the "low torque range" all accelerations, breaks and slow movements are still in a range that moves the mower.
I hope I can do some tests this weekend and can come up with more proofed results.

here the BTS7960 translation:

// BTS7960 motor driver
/*Method 1
R_EN and L_EN set to 5V
L-PWM signal switches motor forward
R-PWM signal switches motor backwards

we have only one PWM signal, therefore method 2:
PWM signal to R_EN and L_EN - to do this, bridge both inputs.
Pin L-PWM on 5v switches motor forward (R-PWM 0V)
Pin R-PWM on 5V switches motor backwards (L-PWM 0V)

Both methods are not possible with the given outputs
so some additional hardware is needed to connect input R_PWM with
an inverted signal from L-PWM (via additional inverter e.g. 74HCT14D). (sorry, 74HCT244D was a typo)
Control R-PWM with pinDir
Apply the PWM signal (PinPWM) to R_EN and L_EN
The motors have a small torque at low PWM and start only from approx. PWM120.
Therefore the PWM range from 50 to MAX is mapped to values between 140 and MAX.
Below 50 no motor should have enough torque and it would only whistle.

I don't wanted to change any digital Pins on the DUE so I decided to use a Schmitt trigger module 74HCT14 on the hardware side. It works without any external parts at 5V and gives you an perfect inverted signal. So with one DUE-signal you'll get both signals for the direction on pin L-PWM and R-PWM. I dont't want to confues you, but the pins are named in that way but used only for direction setting. The enable pins are used for PWM since we have only one PWM chanel. At the moment where the direction changes the PWM is 0 anyway, so I don't have to worry about any timing. Works well.


The rest is pretty much the same as on the L9958 motor driver (declaration in drivers.h and settings in mower.ccp)
// motor drivers
void setBTS7960(int pinDir, int pinPWM, int speed);

case ACT_MOTOR_MOW: setL9958(pinMotorMowDir, pinMotorMowPWM, value); break;
case ACT_MOTOR_LEFT: setBTS7960(pinMotorLeftDir, pinMotorLeftPWM, value); break;
case ACT_MOTOR_RIGHT:
if (value >= 0) setBTS7960(pinMotorRightDir, pinMotorRightPWM, value * (1 + (double)motorRightOffsetFwd / 100));
else setBTS7960(pinMotorRightDir, pinMotorRightPWM, value * (1 - (double)motorRightOffsetRev / 100));

The mower motor is a regular DC motor and I wanted the full original range so I've chosen the L9958 motor driver. The mower motor is not installed yet - I'll have to run my trials with that also :)

To sense the current I use a 3K resistor connected from pin IS of the BTS7960 to ground (in parallel a 10K with 1myF for smothing). The BTS7960 drives a small current proportional to the load current. Is = I Load / 8500. To calculate the motorSenseRightScale I've chosen a working point of 5A. With that I can calculate the voltage over the resistor: U=3000 R * 5A /8500 = 1,76V (@5A) to get the Factor calculate 5A *1000 /1,76V = 2840 mA/V (this is the value for AZURIT) devided by 1023 you'll get 2.776.for AZURITBER. That works also pretty well.

What kind of hardware do you use - any differences to the original ardumower?

Thanks
Jens
 
Oben