- Hits: 17188
Note: Use the WIKI for latest informationen!
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 motor: one motor driver per motor
Mower motor: a simple MOSFET circuit
When purchasing a motor driver, consider...
- max. thermal load (short-circuit current)
Popular motor driver modules
- MC33926, up to 3A with integrated current sensor and thermal shut-down protection (for all kind of robot mowers)
- STL298N (Arduino L298N motor driver), up to 4A (for Tianchen TC-G158, Ambrogio L50, etc.)
- STL6203/STL6201PS, up to 4A
- STL9958 (Arduino 240W H-bridge Motor Driver Board - SX8847), up to 8A (for Rotenbach SPM08-320 etc.)
Wheel motors - Wiring
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.
(Note: for full wiring, see Ardumower schematics here)
MC33926 motor driver (wiring)
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 motor driver (wiring)
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 motor driver (wiring)
L9958 VCC---Arduino 5V
L9958 EN---Arduino 5V
L9958 DIR---Arduino MOTOR_DIR
L9958 PWM---Arduino MOTOR_PWM
Mowing 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!
Mowing motor (ready-module version)
Another variant for the mowing motor is described here.
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.
Chossing the right motor driver (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. My 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).
- always remove blades!
- only connect battery for a short period (1-5 seconds)
- always use cables with sufficient wire cross section!
- 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).