Motor driver

Aus www.wiki.ardumower.de
Wechseln zu: Navigation, Suche

Abstract

To control a motor, it requires a 'motor driver' - a circuit that allows current to flow either one direction or the opposite direction through the motor - depending on wether the motor should turn forward or backward (so called 'H-bridge'). There are many motor drivers available as ready-circuit boards, some can even control two motors (Dual H-Bridge) - if you connect two of their H-bridges in parallel, the maximum motor current can be increased.

If the direction of the motor does not need to be controlled, (e.g. for the blades), you do not need an H-bridge, but instead a simple 'switch' (e.g. MOSFET-transistor-circuit).

Wheel motors (H-Bridge)

The motor driver is connected through control signals to the Arduino. Example:

Arduino Digital Pin —> MOTOR-DIR Pin
Arduino PWM Pin —> MOTOR-PWM Pin
Arduino Analog Pin <— MOTOR-Current Sensor Pin


One pin controls the direction (forward/backward), the other pin controls the speed One analog input pin is connected to the current sensor The current sensor module (ACS712-05A) is connected in series with the motor.

Popular modules

MC33926

Features: up to 3A with integrated current sensor and thermal shut-down protection, for all kind of robot mowers)

M1_FB     --- Motor1 current sensor output (Arduino)
M1_PWM_D1 --- connect with jumper to GND
M1_PWM_D2 --- connect with jumper to VDD
M1_IN1    --- Motor1 PWM (Arduino)
M1_IN2    --- Motor1 Dir (Arduino)
EN        --- connect with jumper to VDD
M2_FB     --- Motor2 current sensor output (Arduino)
M2_PWM_D1 --- connect with jumper to GND
M2_PWM_D2 --- connect with jumper to VDD
M2_IN1    --- Motor2 PWM (Arduino)
M2_IN2    --- Motor2 Dir (Arduino)
EN        --- connect with jumper to VDD
VDD       --- Arduino 5V

L298N

Features: up to 4A (for Tianchen TC-G158, Ambrogio L50, etc.) Notice: When using a L298N-motor driver, both H-bridges (2A) should be connected in parallel, so that both bridges drive a single motor (max. 4A):

Connect in parallel:

IN1 with IN4
IN2 with IN3
OUT1 with OUT4
OUT2 with OUT3

(Do NOT disconnect the SENSE-lines, except when you want to measure current by a 'shunt' resistor).

Make sure there is a jumper on both ENA and ENB. Also, make sure there is a jumper on S1.

L9958

Features: Arduino 240W H-bridge Motor Driver Board - SX8847, up to 8A (for Rotenbach SPM08-320 etc.)

L9958 GND---GND
L9958 VCC---Arduino 5V
L9958 EN---Arduino 5V
L9958 DI---GND
L9958 DIR---Arduino MOTOR_DIR
L9958 PWM---Arduino MOTOR_PWM
L9958 MOTOR(+)---motor(+)
L9958 MOTOR(-)---motor(-)
L9958 POWER(+)---battery(+)
L9958 POWER(-)---battery(-)

L9958

Features: Arduino 240W H-bridge Motor Driver Board - SX8847, up to 8A (for Rotenbach SPM08-320 etc.)

Mower motor (MOSFET)

For a the mowing motor, a MOSFET circuit is used. The MOSFET transistor IRLIZ44N (alternatives: IRF1404, IRL540N, RFP30N06LE, FQP30N06L) can already switch a current of 30A at the Arduino 5V control signal (N-LogL). The 10K resistor pulls down to ground when the Arduino starts. The 180 Ohm resistor limits the current at the Gate caused by level switches to about 30mA. The diode (MBR1045) protects the circuit against current caused by motor induction. A current sensor module (ACS712-30A) is connected in series with the motor.

Security note: For security reasons, always remove mower blades in your first tests!

Choosing a driver

When purchasing a motor driver, consider...

  • max. thermal load (short-circuit current)
  • price

Short-circuit current

To not damage the motor driver on the first run, find out the maximum current that can flow through your motors. In other words, find out the 'short-circuit' current. Typical measurement installation:

Battery === Ampere meter === Motor

The Amperemeter (e.g. model making) should be able to measure the maximum current (e.g. 30A). The motor to be measured is mechanically blocked (so it cannot rotate).

Warning

  • always remove blades
  • only connect battery for a short period (1-5 seconds)
  • always use cables with sufficient wire cross section

Example measurement:

  • Rotenbach SPM08-320
    • Wheel motor: 8A
    • Mowing motor:
  • Ambrogio L50
    • Wheel motor: 4,5A
    • Mowing motor: 22A
  • Tianchen TC-G158
    • Wheel motor: 5,4A
    • Mowing motor: 16A (both 32A)

The measured current will only flow in 'worst-case' scenarios, which means when the motor starts or when it is blocked and it will only flow for a short time (as your battery might not deliver the high current constantly, and so current and voltage will break down).


Current sensor

To detect certain conditions (robot drives against obstacle, motor blocks etc.), the motor current should be monitored constantly. There are two approaches for sensing current.

Approach "Hall sensor module"

This is the recommended approach for sensing current. These current sensor modules are available for different current ranges.

  • ACS712ELC-05A (185mV/A, max. 5A)
  • ACS712ELC-20A (100mV/A, max. 20A)
  • ACS712ELC-30A (66mV/A, max. 30A)
  • The lower the range, the more precise the measurement.

Approach "Shunt resistor (circuit)"

The current flows across a very small resistor (0.5 Ohm) and the voltage drop is measured