Motor driver: Unterschied zwischen den Versionen

Aus www.wiki.ardumower.de
Wechseln zu: Navigation, Suche
(Abstract)
(Protector PCB)
 
(83 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
= Abstract =
 
= Abstract =
 
Ardumower uses two different types of motors (all motors can be purchased via the [https://www.marotronics.de/index.php?k=7 shop] [[File: shopping.png|link=https://www.marotronics.de/index.php?k=7]]):
 
Ardumower uses two different types of motors (all motors can be purchased via the [https://www.marotronics.de/index.php?k=7 shop] [[File: shopping.png|link=https://www.marotronics.de/index.php?k=7]]):
* Two motors (with integrated gearing) for driving (wheel motors) with integrated encoders (for distance and speed control)
+
* Two motors (with integrated gearing) for driving (wheel motors) and with integrated encoders (for distance and speed control)
 
* One motor (with high rotation speed) for mowing (mower motor)
 
* One motor (with high rotation speed) for mowing (mower motor)
  
 
To control the motors, it requires motor drivers. In addition, the motor driver measures the motor current, and allows us to detect obstacles as motor current increases at obstacles. Ardumower uses two dual MC33926 motor drivers, so two channels for left and right motor and two dual channels (connected in parallel) for the mowing motor.
 
To control the motors, it requires motor drivers. In addition, the motor driver measures the motor current, and allows us to detect obstacles as motor current increases at obstacles. Ardumower uses two dual MC33926 motor drivers, so two channels for left and right motor and two dual channels (connected in parallel) for the mowing motor.
 +
 +
It is not safe to connect motors directly to the motor driver. Especially, when quickly turning motors from forward to reverse (or vice verse), high voltage spikes appear, and these could damage the motor drivers in the long run. Therefore, we developed driver protector boards that are connected between motor driver and motor.
 +
 +
[[File:Ardumower_motordriver_overview.png|800px]]
  
 
= Voltages =
 
= Voltages =
Although there exist 12V motors and 24V motors, as in all modern systems, the Ardumower uses 24V motors.
+
As in all modern systems, Ardumower uses 24V motors.
 +
 
 +
= Motor driver assembly (dual MC33926) =
 +
Motor driver features: up to 3A with integrated current sensor and thermal shut-down protection
  
= Wheel motors =
 
 
<gallery>
 
<gallery>
 +
File: Ardumower_motordriver_overview.png | PCB, MC33926, protector and motors
 +
File: Pcb_mc33926.jpg | PCB and MC33926
 +
File:Mc33926.jpg | MC33926 pinout
 +
File:MC33926_schematics.jpg | MC33926 schematics
 +
</gallery>
 +
 +
* [https://www.youtube.com/watch?feature=player_embedded&v=DokrJiVzX2I Video instructions: Dual MC33926]
 +
 +
For wiring of motor drivers, protector and motors, please open manual in section Protector PCB.
 +
 +
=Protector PCB=
 +
[[File:warning.png]] When quickly tunring motors from forward to backward (or vice versa), high voltage spikes appear. These high voltage spikes could damage the motor driver in the long run. To eliminate high voltage spikes, it is adviced to use a  [https://github.com/Ardumower/ardumower/blob/master/Dokumentation/Protector%20Board/WORKSHOP%20Protector-Board.pdf Protector board] between motor driver and motor. Two Protector PCBs are required, one for the gear motors, and one for the mowing motor.
 +
 +
<gallery>
 +
File: Ardumower_motordriver_overview.png | PCB, MC33926, protector and motors
 +
File:Protector_pcb2.jpg | Protector PCB
 +
File:Protector_wiring.png | Protector PCB wiring
 +
File:driver_hw_protection.png | Protector PCB schematics
 +
</gallery>
 +
 +
* [https://github.com/Ardumower/ardumower/blob/master/Dokumentation/Protector%20Board/WORKSHOP%20Protector-Board.pdf Assembly manual: Protector board (required for safe-use of motor drivers!)]
 +
 +
= Wheel motors wiring =
 +
<gallery>
 +
  File: Ardumower_motordriver_overview.png | PCB, MC33926, protector and motors
 
   File: ardumower_motor.jpg | Ardumower gear motor with encoder (8mm diameter, 5900 rpm motor, 0.055 Nm, gear ratio 1/212, output torque 2.45Nm, output rpm 31)
 
   File: ardumower_motor.jpg | Ardumower gear motor with encoder (8mm diameter, 5900 rpm motor, 0.055 Nm, gear ratio 1/212, output torque 2.45Nm, output rpm 31)
 
   File: magnetic_encoder.PNG | Motor wiring
 
   File: magnetic_encoder.PNG | Motor wiring
 
   File: wheel_motor_diagram.png | Ardumower gear motor curve (motor only)
 
   File: wheel_motor_diagram.png | Ardumower gear motor curve (motor only)
   File:decrease_motor_noise.png | Decrease motor noise
+
   File: Ardumower_gearbox.png | Gearbox specification
  File: ardumower_odometry_encoder.jpg | Encoder signal
+
 
</gallery>
 
</gallery>
 
The two left and right gear motors are controlled independently (aka 'differential driving') to:
 
The two left and right gear motors are controlled independently (aka 'differential driving') to:
Zeile 22: Zeile 52:
 
* steer the robot left/right
 
* steer the robot left/right
  
The Ardumower wheel motor features:
+
Wheel motor features:
 
* A rotation speed up to 31 rpm allows to move the robot at sufficient speed (at up to meter/sec = 31rpm/60 * PI * 0.25m  = 0.4m/sec using 250mm diameter wheels)
 
* A rotation speed up to 31 rpm allows to move the robot at sufficient speed (at up to meter/sec = 31rpm/60 * PI * 0.25m  = 0.4m/sec using 250mm diameter wheels)
* A high torque (2.45Nm) guarantees that the robot can climb small hills as well (with 2 motors, 0.125 radius wheel, 31rpm = 0.4m/s, acceleration = 0.2 ( 1/2 of nomeinal speed) up to 14 degree) [http://www.robotshop.com/blog/en/drive-motor-sizing-tool-9698 see calculator]
+
* A high torque (2.45Nm) guarantees that the robot can climb small hills as well (with 2 motors, 0.125 radius wheel, 31rpm = 0.4m/s, acceleration = 0.2 ( 1/2 of nominal speed) [http://www.robotshop.com/blog/en/drive-motor-sizing-tool-9698 see calculator]
 
* Integrated encoders, so it can measure the rotation speed and the distance
 
* Integrated encoders, so it can measure the rotation speed and the distance
 
* 24V  (load current ~1A)
 
* 24V  (load current ~1A)
  
= Motor driver (dual MC33926) =
+
The left gear motor is connected as follows to the protector board:
  
Features: up to 3A with integrated current sensor and thermal shut-down protection
+
Motor wiring (left motor):
 +
Motor (black)  ==== Protector board Motor_1_OUT(1)
 +
Motor (red)    ==== Protector board Motor_1_OUT(2)
  
[[File:warning.png]]'''[https://github.com/Ardumower/ardumower/blob/master/Dokumentation/Protector%20Board/WORKSHOP%20Protector-Board.pdf Protector board] is adviced to be used between controller and motor'''
+
For right motor, use Protector board Motor_2_OUT(1,2) accordingly.
 +
 
 +
= Wheel motors odometry wiring =
 +
 
 +
The Ardumower gear motors have integrated encoders. These encoders help us to compute speed and traveled distance. Here's how you connect the motor odometry wires to the PCB.
  
 
<gallery>
 
<gallery>
File:Mc33926.jpg | MC33926 pinout
+
  File: magnetic_encoder.PNG | Motor wiring
File:Mc33926_example.jpg | MC33926 jumpers
+
  File: ardumower_odometry_encoder.jpg | Encoder signal
File:MC33926_schematics.jpg | MC33926 schematics
+
File:Mc33926_current_limiter.jpg | MC33926 automatic current limiter
+
File:Motor_pwm_50_percent_transients.jpg | Motor start 50% PWM transients
+
File:driver_hw_protection.png | Peak/EMF protection
+
 
</gallery>
 
</gallery>
  
Motor wiring (left motor):
+
Motor odometry wiring (left motor):
  black  ==== MC33926 M1OUT1
+
  Motor (brown)  ---- PCB VCC
red    ==== MC33926 M1OUT2
+
  Motor (green) ---- PCB GND
 
+
  Motor (blue)   ---- PCB OdometryLeft (3)
Odometry wiring (left motor):
+
  Motor (purple) ---- PCB OdometryLeft (4)
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.
+
For right motor, use PCB OdometryRight accordingly.
  
IMPORTANT: PCB v0.5/1.2 are missing pull-ups! You need to add them yourself:
+
IMPORTANT: PCB v0.5/1.2 are missing pull-up resistors! You need to add them yourself at the PCB:
  
  odometry(3) --- 4.7k --- 5v
+
  PCB OdometryLeft(3) --- 4.7k --- 5v
  odometry(4) --- 4.7k --- 5v
+
  PCB OdometryLeft(4) --- 4.7k --- 5v
  
= Mower motor =
+
= Mower motor wiring =
 
<gallery>
 
<gallery>
 +
File: Ardumower_motordriver_overview.png | PCB, MC33926, protector and motors
 
File: ardumower_mower_motor.jpg | Ardumower mower motor
 
File: ardumower_mower_motor.jpg | Ardumower mower motor
 
File: Mower_motor_curve.png | Ardumower mower motor curve
 
File: Mower_motor_curve.png | Ardumower mower motor curve
Zeile 76: Zeile 105:
  
  
Motor wiring (mower motor):
+
Here's how you connect the mowing motor to the protector board:
  black  ==== MC33926 M1OUT1
+
  Motor (black) ==== Protector board Motor_1_OUT(1)
  red    ==== MC33926 M1OUT2
+
  Motor (red)   ==== Protector board Motor_1_OUT(2)
  
 +
= Motor decrease noise =
  
== Motor controller (PID) ==
+
Here's how you can decrease motor noise:
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:Speedcontrol.png | Motor speed settings
+
   File:decrease_motor_noise.png | Decrease motor noise
  File: Odometry_motor_pid_controller.png
+
 
</gallery>
 
</gallery>
  
= Programming =
+
* [https://github.com/Ardumower/ardumower/blob/master/Dokumentation/Motor%20Entstoerung/Motor%20EntstoerungREV20150531.pdf Instructions: Motor-decrease noise REV20150531]
 +
* [http://www.ardumower.de/media/kunena/attachments/1725/Motor-EntstoerungREV20150531.pdf (English comments)]
  
== Motor variables ==
 
  
    // --------- wheel motor state ----------------------------
+
= Motor controller (PID) =
    // wheel motor speed ( <0 backward, >0 forward); range -motorSpeedMaxRpm..motorSpeedMaxRpm
+
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):
    //                                  [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:
+
<gallery>
   void setMotorPWM(int pwmLeft, int pwmRight, boolean useAccel);
+
   File:Speedcontrol.png | Motor speed settings
 
+
   File: Odometry_motor_pid_controller.png
A general methods to test motors
+
</gallery>
  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
+

Aktuelle Version vom 22. Februar 2017, 09:45 Uhr

Abstract

Ardumower uses two different types of motors (all motors can be purchased via the shop Shopping.png):

  • Two motors (with integrated gearing) for driving (wheel motors) and with integrated encoders (for distance and speed control)
  • One motor (with high rotation speed) for mowing (mower motor)

To control the motors, it requires motor drivers. In addition, the motor driver measures the motor current, and allows us to detect obstacles as motor current increases at obstacles. Ardumower uses two dual MC33926 motor drivers, so two channels for left and right motor and two dual channels (connected in parallel) for the mowing motor.

It is not safe to connect motors directly to the motor driver. Especially, when quickly turning motors from forward to reverse (or vice verse), high voltage spikes appear, and these could damage the motor drivers in the long run. Therefore, we developed driver protector boards that are connected between motor driver and motor.

Ardumower motordriver overview.png

Voltages

As in all modern systems, Ardumower uses 24V motors.

Motor driver assembly (dual MC33926)

Motor driver features: up to 3A with integrated current sensor and thermal shut-down protection

For wiring of motor drivers, protector and motors, please open manual in section Protector PCB.

Protector PCB

Warning.png When quickly tunring motors from forward to backward (or vice versa), high voltage spikes appear. These high voltage spikes could damage the motor driver in the long run. To eliminate high voltage spikes, it is adviced to use a Protector board between motor driver and motor. Two Protector PCBs are required, one for the gear motors, and one for the mowing motor.

Wheel motors wiring

The two left and right gear motors are controlled independently (aka 'differential driving') to:

  • drive the robot forward/backward
  • steer the robot left/right

Wheel motor features:

  • A rotation speed up to 31 rpm allows to move the robot at sufficient speed (at up to meter/sec = 31rpm/60 * PI * 0.25m = 0.4m/sec using 250mm diameter wheels)
  • A high torque (2.45Nm) guarantees that the robot can climb small hills as well (with 2 motors, 0.125 radius wheel, 31rpm = 0.4m/s, acceleration = 0.2 ( 1/2 of nominal speed) see calculator
  • Integrated encoders, so it can measure the rotation speed and the distance
  • 24V (load current ~1A)

The left gear motor is connected as follows to the protector board:

Motor wiring (left motor):

Motor (black)  ==== Protector board Motor_1_OUT(1)
Motor (red)    ==== Protector board Motor_1_OUT(2)

For right motor, use Protector board Motor_2_OUT(1,2) accordingly.

Wheel motors odometry wiring

The Ardumower gear motors have integrated encoders. These encoders help us to compute speed and traveled distance. Here's how you connect the motor odometry wires to the PCB.

Motor odometry wiring (left motor):

Motor (brown)  ---- PCB VCC
Motor (green)  ---- PCB GND
Motor (blue)   ---- PCB OdometryLeft (3)
Motor (purple) ---- PCB OdometryLeft (4)

For right motor, use PCB OdometryRight accordingly.

IMPORTANT: PCB v0.5/1.2 are missing pull-up resistors! You need to add them yourself at the PCB:

PCB OdometryLeft(3) --- 4.7k --- 5v
PCB OdometryLeft(4) --- 4.7k --- 5v

Mower motor wiring

The Ardumower mower motor features:

  • Fast enough to cut the lawn (3150 rpm)
  • Enough torque (140 mNm / 46 W)
  • Quiet mowing (you cannot hear it)
  • 24V, load current ~1.0A (L=2.8mH, R=1.9ohm)

Warning.pngSecurity note: For security reasons, always remove mower blades in your first tests!


Here's how you connect the mowing motor to the protector board:

Motor (black)  ==== Protector board Motor_1_OUT(1)
Motor (red)    ==== Protector board Motor_1_OUT(2)

Motor decrease noise

Here's how you can decrease motor noise:


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):