Motor-Treiber: Unterschied zwischen den Versionen
(→MC33926 (empfohlen)) |
|||
| Zeile 1: | Zeile 1: | ||
= Zusammenfassung = | = Zusammenfassung = | ||
| − | Das Ardumower- Design verwendet zwei verschiedene Typen | + | Das Ardumower- Design verwendet zwei verschiedene Typen von Motoren. Alle Motoren können im Shop [https://www.marotronics.de/index.php?k=7 shop] [[File: shopping.png|link=https://www.marotronics.de/index.php?k=7]]) erworben werden: |
| − | * Zwei Getriebemotoren als Antriebe (Radmotoren) mit Encoder(für Weg | + | * Zwei Getriebemotoren als Antriebe (Radmotoren) mit Encoder(für Weg- und Geschwindigkeitssteuerung) |
* einen Motor (mit hoher Drehzahl) zum Mähen (Mähmotor) | * einen Motor (mit hoher Drehzahl) zum Mähen (Mähmotor) | ||
| Zeile 7: | Zeile 7: | ||
= Spannungen = | = Spannungen = | ||
| − | Obwohl es 12V- und 24V- Motoren gibt, verwendet der Ardumower, wie alle modernen Systeme, 24V Motoren | + | Obwohl es 12V- und 24V- Motoren gibt, verwendet der Ardumower, wie alle modernen Systeme, 24V Motoren. |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
= Radmotoren = | = Radmotoren = | ||
| Zeile 34: | Zeile 23: | ||
* Eine Drehzahl bis zu 31 U/min erlaubt es, den Roboter mit einer ausreichenden Geschwindigkeit von bis zu (Meter/sec = 31rpm/60 * PI * 0.25m = 0.4m/sec) bei Verwendung von Rädern mit 250 mm Durchmesser, zu bewegen. | * Eine Drehzahl bis zu 31 U/min erlaubt es, den Roboter mit einer ausreichenden Geschwindigkeit von bis zu (Meter/sec = 31rpm/60 * PI * 0.25m = 0.4m/sec) bei Verwendung von Rädern mit 250 mm Durchmesser, zu bewegen. | ||
* ein hohes Drehmoment (2.45 Nm) garantiert, dass der Roboter kleinere Hügel bis zu 14 Grad erklimmen kann (mit 2 Motoren, 250 mm Rädern, 31 U/min = 0.4m/s, Beschleunigung = 0.2 ( 1/2 der Nominalgeschwindigkeit) [http://www.robotshop.com/blog/en/drive-motor-sizing-tool-9698 see calculator] | * ein hohes Drehmoment (2.45 Nm) garantiert, dass der Roboter kleinere Hügel bis zu 14 Grad erklimmen kann (mit 2 Motoren, 250 mm Rädern, 31 U/min = 0.4m/s, Beschleunigung = 0.2 ( 1/2 der Nominalgeschwindigkeit) [http://www.robotshop.com/blog/en/drive-motor-sizing-tool-9698 see calculator] | ||
| − | * Der eingebaute Encoder kann die Drehzahl messen, den Weg | + | * Der eingebaute Encoder kann die Drehzahl messen, die Geschwindigkeit und den Weg feststellen. |
* 24V (Laststrom ca. 1A) | * 24V (Laststrom ca. 1A) | ||
| − | = Motortreiber | + | = Motortreiber (MC33926) = |
| − | + | ||
| − | + | Eigenschaften: bis zu 3A, mit integriertem Stromsensor und Thermoschutz | |
| − | + | [[File:warning.png]]''' Protektorboard: Bei 24V Systemen kommt es zu Spannungsspitzen, die den Motortreiber schnell zerstören können. Daher wurde das Protektorboard entwickelt um dies zu verhindern. Es werden 2 Stück benötigt. Einen für die Antriebsräder und einen für den Mähmotor. Schaden kann das Protektorboard auf keinen Fall.''' | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | File: | + | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | Protektorboard: Bei 24V Systemen kommt es zu Spannungsspitzen, die den Motortreiber schnell zerstören können. Daher wurde das Protektorboard entwickelt um dies zu verhindern | + | |
<gallery> | <gallery> | ||
| Zeile 82: | Zeile 41: | ||
</gallery> | </gallery> | ||
| − | + | Motor wiring (left motor): | |
| − | + | black ==== MC33926 M1OUT1 | |
| − | + | red ==== MC33926 M1OUT2 | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | Odometry wiring (left motor): | |
| − | + | brown ---- PCB VCC | |
| − | + | green ---- PCB GND | |
| − | + | blue ---- PCB OdometryLeft (3) | |
| − | + | purple ---- PCB OdometryLeft (4) | |
| − | + | For right motor, use MC33926 M2OUT(1,2) and PCB OdometryRight accordingly. | |
| − | + | IMPORTANT: PCB v0.5/1.2 are missing pull-ups! You need to add them yourself: | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | odometry(3) --- 4.7k --- 5v | |
| − | + | odometry(4) --- 4.7k --- 5v | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
= Mähmotor und Treiber = | = Mähmotor und Treiber = | ||
| Zeile 175: | Zeile 71: | ||
* 24V, Laststrom ~1.0A (L=2.8mH, R=1.9ohm) | * 24V, Laststrom ~1.0A (L=2.8mH, R=1.9ohm) | ||
| − | + | Es wird ein MC33926 Motortreiber in Parallelschaltung zur Ansteuerung des Mähmotors verwendet. | |
| − | + | ||
| − | + | ||
[[File:warning.png]]'''Sicherheitshinweis: Entferne zur Sicherheit stets die Messer bei diesen ersten Tests!''' | [[File:warning.png]]'''Sicherheitshinweis: Entferne zur Sicherheit stets die Messer bei diesen ersten Tests!''' | ||
| − | |||
| − | |||
| − | |||
| − | = | + | Motor wiring (mower motor): |
| + | black ==== MC33926 M1OUT1 | ||
| + | red ==== MC33926 M1OUT2 | ||
| − | |||
| − | + | == Motor controller (PID) == | |
| − | + | The speed of the motors is controlled by a software PID controller. You can monitor the quality of the motor speed control via pfodApp (Plot->Motor control): | |
| − | + | ||
| − | = | + | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
<gallery> | <gallery> | ||
| − | File: | + | File:Speedcontrol.png | Motor speed settings |
| + | File: Odometry_motor_pid_controller.png | ||
</gallery> | </gallery> | ||
| − | = | + | = Programming = |
| − | + | ||
| − | + | == Motor variables == | |
| − | + | // --------- wheel motor state ---------------------------- | |
| + | // wheel motor speed ( <0 backward, >0 forward); range -motorSpeedMaxRpm..motorSpeedMaxRpm | ||
| + | // [Default value] | ||
| + | float motorAccel ; // motor wheel acceleration - only functional when odometry is not in use | ||
| + | // (warning: do not set too high) [1000] | ||
| + | int motorSpeedMaxRpm ; // motor wheel max RPM [25] | ||
| + | int motorSpeedMaxPwm ; // motor wheel max Pwm (8-bit PWM=255, 10-bit PWM=1023) [255] | ||
| + | float motorPowerMax ; // motor wheel max power (Watt) | ||
| + | PID motorLeftPID; // motor left wheel PID controller [Kp=1.5 , Kd=0.29, Ki=0.25] | ||
| + | PID motorRightPID; // motor right wheel PID controller | ||
| + | float motorSenseRightScale ; // motor right sense scale (mA=(ADC-zero)/scale) | ||
| + | float motorSenseLeftScale ; // motor left sense scale (mA=(ADC-zero)/scale) | ||
| + | int motorRollTimeMax ; // max. roll time (ms) | ||
| + | int motorRollTimeMin ; // min. roll time (ms) | ||
| + | int motorReverseTime ; // max. reverse time (ms) | ||
| + | long motorForwTimeMax; // max. forward time (ms) / timeout | ||
| + | float motorBiDirSpeedRatio1 ;// bidir mow pattern speed ratio 1 | ||
| + | float motorBiDirSpeedRatio2 ;// bidir mow pattern speed ratio 2 | ||
| + | bool motorRightSwapDir ; // inverse right motor direction? | ||
| + | bool motorLeftSwapDir ; // inverse left motor direction? | ||
| + | int motorLeftSpeedRpmSet ; // set speed | ||
| + | int motorRightSpeedRpmSet ; | ||
| + | float motorLeftPWMCurr ; // current speed | ||
| + | float motorRightPWMCurr ; | ||
| + | int motorRightSenseADC ; | ||
| + | int motorLeftSenseADC ; | ||
| + | float motorLeftSenseCurrent ; | ||
| + | float motorRightSenseCurrent ; | ||
| + | float motorLeftSense ; // motor power (range 0..MAX_MOTOR_POWER) | ||
| + | float motorRightSense ; | ||
| + | int motorPowerIgnoreTime; | ||
| + | int motorZeroSettleTime; // how long (ms) to wait for motor to settle at zero speed | ||
| + | int motorLeftSenseCounter ; // motor current counter | ||
| + | int motorRightSenseCounter ; | ||
| + | unsigned long nextTimeMotorSense ; | ||
| + | unsigned long lastSetMotorSpeedTime; | ||
| + | unsigned long motorLeftZeroTimeout; | ||
| + | unsigned long motorRightZeroTimeout; | ||
| + | boolean rotateLeft; | ||
| + | unsigned long nextTimeRotationChange; | ||
| − | + | == Motor Methods == | |
| − | + | First the basic function that control the pwm to each motors: | |
| − | + | void setMotorPWM(int pwmLeft, int pwmRight, boolean useAccel); | |
| − | + | ||
| − | + | A general methods to test motors | |
| + | void testMotors(); | ||
| − | + | Then, there are several MotorControl methods according to mower state : | |
| − | + | ||
| − | + | ||
| − | + | if current state is 'STATE_PERI_TRACK' then | |
| − | + | void motorControlPerimeter(); | |
| − | + | ||
| − | |||
| − | |||
| − | |||
| − | + | void motorControlImuRoll(); | |
| − | + | void motorControlImuDir(); | |
| − | + | ||
| − | + | for all other case : | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | void motorControl(); | |
| − | + | // This method calculate pwm to set in order to respect rpm setpoint according current rpm and Kp, Ki, Kd parameter | |
Version vom 30. Mai 2016, 00:21 Uhr
Inhaltsverzeichnis
Zusammenfassung
Das Ardumower- Design verwendet zwei verschiedene Typen von Motoren. Alle Motoren können im Shop shop
) erworben werden:
- Zwei Getriebemotoren als Antriebe (Radmotoren) mit Encoder(für Weg- und Geschwindigkeitssteuerung)
- einen Motor (mit hoher Drehzahl) zum Mähen (Mähmotor)
Zur Steuerung der Motoren sind Motortreiber erforderlich.
Spannungen
Obwohl es 12V- und 24V- Motoren gibt, verwendet der Ardumower, wie alle modernen Systeme, 24V Motoren.
Radmotoren
Die beiden Getriebemotoren werden unabhängig voneinander gesteuert ('Differentialantrieb') :
- Fahren vorwärts/rückwärts
- Lenken links/rechts
Die Eigenschaften der Ardumower - Radmotoren:
- Eine Drehzahl bis zu 31 U/min erlaubt es, den Roboter mit einer ausreichenden Geschwindigkeit von bis zu (Meter/sec = 31rpm/60 * PI * 0.25m = 0.4m/sec) bei Verwendung von Rädern mit 250 mm Durchmesser, zu bewegen.
- ein hohes Drehmoment (2.45 Nm) garantiert, dass der Roboter kleinere Hügel bis zu 14 Grad erklimmen kann (mit 2 Motoren, 250 mm Rädern, 31 U/min = 0.4m/s, Beschleunigung = 0.2 ( 1/2 der Nominalgeschwindigkeit) see calculator
- Der eingebaute Encoder kann die Drehzahl messen, die Geschwindigkeit und den Weg feststellen.
- 24V (Laststrom ca. 1A)
Motortreiber (MC33926)
Eigenschaften: bis zu 3A, mit integriertem Stromsensor und Thermoschutz
Protektorboard: Bei 24V Systemen kommt es zu Spannungsspitzen, die den Motortreiber schnell zerstören können. Daher wurde das Protektorboard entwickelt um dies zu verhindern. Es werden 2 Stück benötigt. Einen für die Antriebsräder und einen für den Mähmotor. Schaden kann das Protektorboard auf keinen Fall.
Motor wiring (left motor):
black ==== MC33926 M1OUT1 red ==== MC33926 M1OUT2
Odometry wiring (left motor):
brown ---- PCB VCC green ---- PCB GND blue ---- PCB OdometryLeft (3) purple ---- PCB OdometryLeft (4)
For right motor, use MC33926 M2OUT(1,2) and PCB OdometryRight accordingly.
IMPORTANT: PCB v0.5/1.2 are missing pull-ups! You need to add them yourself:
odometry(3) --- 4.7k --- 5v odometry(4) --- 4.7k --- 5v
Mähmotor und Treiber
Eigenschaften des Ardumower-Mähmotors:
- schnell genug um den Rasen zu schneiden (3150 U/min)
- genügend Drehmoment (140 mNm / 46 W)
- leises Mähen (man hört ihn kaum)
- 24V, Laststrom ~1.0A (L=2.8mH, R=1.9ohm)
Es wird ein MC33926 Motortreiber in Parallelschaltung zur Ansteuerung des Mähmotors verwendet.
Sicherheitshinweis: Entferne zur Sicherheit stets die Messer bei diesen ersten Tests!
Motor wiring (mower motor):
black ==== MC33926 M1OUT1 red ==== MC33926 M1OUT2
Motor controller (PID)
The speed of the motors is controlled by a software PID controller. You can monitor the quality of the motor speed control via pfodApp (Plot->Motor control):
Programming
Motor variables
// --------- wheel motor state ----------------------------
// wheel motor speed ( <0 backward, >0 forward); range -motorSpeedMaxRpm..motorSpeedMaxRpm
// [Default value]
float motorAccel ; // motor wheel acceleration - only functional when odometry is not in use
// (warning: do not set too high) [1000]
int motorSpeedMaxRpm ; // motor wheel max RPM [25]
int motorSpeedMaxPwm ; // motor wheel max Pwm (8-bit PWM=255, 10-bit PWM=1023) [255]
float motorPowerMax ; // motor wheel max power (Watt)
PID motorLeftPID; // motor left wheel PID controller [Kp=1.5 , Kd=0.29, Ki=0.25]
PID motorRightPID; // motor right wheel PID controller
float motorSenseRightScale ; // motor right sense scale (mA=(ADC-zero)/scale)
float motorSenseLeftScale ; // motor left sense scale (mA=(ADC-zero)/scale)
int motorRollTimeMax ; // max. roll time (ms)
int motorRollTimeMin ; // min. roll time (ms)
int motorReverseTime ; // max. reverse time (ms)
long motorForwTimeMax; // max. forward time (ms) / timeout
float motorBiDirSpeedRatio1 ;// bidir mow pattern speed ratio 1
float motorBiDirSpeedRatio2 ;// bidir mow pattern speed ratio 2
bool motorRightSwapDir ; // inverse right motor direction?
bool motorLeftSwapDir ; // inverse left motor direction?
int motorLeftSpeedRpmSet ; // set speed
int motorRightSpeedRpmSet ;
float motorLeftPWMCurr ; // current speed
float motorRightPWMCurr ;
int motorRightSenseADC ;
int motorLeftSenseADC ;
float motorLeftSenseCurrent ;
float motorRightSenseCurrent ;
float motorLeftSense ; // motor power (range 0..MAX_MOTOR_POWER)
float motorRightSense ;
int motorPowerIgnoreTime;
int motorZeroSettleTime; // how long (ms) to wait for motor to settle at zero speed
int motorLeftSenseCounter ; // motor current counter
int motorRightSenseCounter ;
unsigned long nextTimeMotorSense ;
unsigned long lastSetMotorSpeedTime;
unsigned long motorLeftZeroTimeout;
unsigned long motorRightZeroTimeout;
boolean rotateLeft;
unsigned long nextTimeRotationChange;
Motor Methods
First the basic function that control the pwm to each motors:
void setMotorPWM(int pwmLeft, int pwmRight, boolean useAccel);
A general methods to test motors
void testMotors();
Then, there are several MotorControl methods according to mower state :
if current state is 'STATE_PERI_TRACK' then
void motorControlPerimeter();
void motorControlImuRoll();
void motorControlImuDir();
for all other case :
void motorControl(); // This method calculate pwm to set in order to respect rpm setpoint according current rpm and Kp, Ki, Kd parameter