test face

Note: Use the WIKI for latest informationen!


A lawn sensor should detect if the robot is still on lawn or not. In other words, it should find out if the media directly below the robot is still lawn or something else (air etc.).  Therefore, a capacity sensor can be used as the media below the robot has influence on the capacity. No difference in capacity however is between lawn and flowers etc. - so you should have a distinct area around your lawn that is different to lawn (e.g. bark mulch).

Principle operation
A lawn sensor could be a copper plate in a closed plastic tube. To find out if the plate has contact with lawn, the capacity of this sensor is measured. If the robot is on lawn (lawn is 'dielectric'), the measured capacity increases slightly (by a few pF).

Ambrogio L50 capacity measurement     lawn sensor      capsense

no lawn: ~0 pF
lawn: 1-4 pF


Front lawn sensor: 
Arduino Mega Pin 40 Receive Front -------------|

Arduino Mega Pin 41 Send    Front --- 2 MOhm --+---|  Lawn

Back lawn sensor:
Arduino Mega Pin 42 Receive Back  -------------|

Arduino Mega Pin 43 Send    Back  --- 2 MOhm --+---|  Lawn

Detailed operation
Initially, the copper plate is discharged by pulling the send pin to low. Then send pin is set to 'high' - via a resistor (2 Megaohm) the copper plate is charging slowly. By constantly reading input receiver pin, the Arduino measures the time until it becomes 'high' (capacity measurement). Because microcontrollers are fast and precise in time measurement, you can measure very low capacities with this.

Note: Use the WIKI for latest informationen!


Basic principle: The robot reaches the charging station via tracking the perimeter wire loop. When the robot reached the charging station, it will recharge. The robot will track the perimeter loop (clockwise) until it detects a voltage at its charging pins (charging voltage). Then it will stop for charging.

The charger is build into the charging station (or it is connected to it). The charger must be able to handle several aspects (here: Lithium-Ion, lead-acid battery is similar):
-Charge battery via roboter charging pins
-Limit charging voltage
-Limit charging current
If you are going to re-use your charging station, it will probably handle these aspects for your specific battery type.

Inside the robot, the battery voltage is monitored (see schematics below). This allows the robot to detect a low battery state so it knows when it will have to drive home to the charging station. Also, the charging voltage and current are monitored. This allows the robot to detect if it has reached the charging station and when the battery has been fully recharged.

charging station circuit:

Power supply => Charger 24V (+)----- Charging station charger pin(+)
                GND         (-)----- Charging station charger pin(-)

                Charger 24V (+)----- DC-DC converter 5V  => Perimeter sender Arduino Nano 
                Charger 24V (+)----- DC-DC converter 12V => Perimeter sender MC motor driver

robot charging circuit:

Charging station (+)---+------+-- relais ---- current sensor ----- battery (+)
                              ---- voltage sensing
Charging station (-)-- +------------------------------------------ battery (-)


See schematics

Charge plotting etc.
Via pfodApp (Android) you can get a plot of the charging process.

ardumower battery plotting


Charging station - Ideas

l50 laden    ardumower charging     ardumower charging station example   ardumower perimeter  ardumower charging station1   ardumower charging station2    ardumower charging station3

video   Ambrogio "Ardumower" (drive into charging station)

video   Ambrogio "Ardumower" (charging station - drive in and out)

video   Ardumower Chassis tracking and docking




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)
  • Price

Popular motor driver modules

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)

Arduino motor driver


MC33926 motor driver (wiring)
mc33926 example     MC33926 schematics
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)

motordriver l298n     L298N schematics

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)

motor driver L9958

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

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.

Arduino motor       mosfet

warning 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.

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
l298n module circuit

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!

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


Note: Use the WIKI for latest informationen!

Kompaßmodul (GY-80)

Acceleration sensor (to detect orientation of the robot)
An acceleration sensor measures earth gravity force (m*s^2) in all 3 robot axes (x/y/z) allowing you to calculate the orientation towards earth center of the robot (Roll, Pitch). However, it cannot detect movement around Yaw - this requires a gyro.

ardumower pitch roll yaw

Gyro (to detect rotation of the robot)
A gyro measure rotation speed (degree/second) in all 3 robot axes (Rol, Pitch, Yaw). This allows us to correct the robot if it is driving 'off-course' due to wet conditions or slope.

Compass (to detect the robot's course)
If a robot drives on a wet lawn, you'll notice quickly that it will not drive straight forward, but instead tends to drive into the direction of the slope. A compass can solve this problem and the robot will drive again straight forward.

However, a compass has a problem: if tilting the robot, the compass measurements (x,y,z) relate to the tilted robot. So, you need to correct them using knowing the tilt angles. This requires the use of the accerlation sensor (x,y).

Sensor fusion
To eliminate the issues of all sensor, they are merged to compute the course (degree) and pitch/roll angles (IMU - Intertial Measurement Unit). The IMU is key component of an intertial navigation system.

ardumower sensor fusion

A Kalman filter can be used to fusion all sensor values.

Nine Axis IMU Module

GY-80     GY80-Schematic

  • Acceleration sensor: ADXL345B
  • Compass sensor: HMC5883L
  • Gyro: L3G4200D
  • Pressure sensor: BMP085  (not used here)


The IMU module (GY-80) is connected to an Arduino Nano which reads and evaluates compass, gyro and acceleration data. For exact wiring, see schematics.

This photo shows how the IMU module is placed in driving position (the black arrow shows the driving position). The shown tube was a prototype. Actually, you can now place the IMU module directly in the robot.

gy80 direction


video  Compass test ('robot dance')

video  Compass keeps robot on track!

video  Robot drives lanes

Step 1: Calibration - Acceleration sensor

This one-time calibration ensures that all 3 axes measurements are weighted equally. This calibration can be performed even outside of the robot.

1. Connect the Arduino Nano to your PC. On the PC, open the serial console (19200) in the Arduino environment. After the automatic gyro calibration menu appears (this can be shown at any time by pressing the "m" + ENTER keys).

2. Start the calibration by pressing "1" + ENTER keys.

2.1. After calibration, each of the 6 sides of the module has to look up-side and down-side (rotated 180 °). The module has 6 sides, so it must be rotated 6 times, so that each side once is on the table (you can hold the module with your hand  without moving it). Press ENTER after each calibration step. The aim of the calibration to determine the acceleration due to gravity (more precisely, the minimum / maximum value) for each axis . The module must not be artificially accelerated. The order of the sides does not matter.

ardumower pitch roll yaw imu

Finally, the calibration values ​​for acceleration sensor are printed out on serial console.

Step 2: Calibration - compass
This one-time calibration ensures that cable, metal, etc. which is located in the robot near the IMU module has no effect on the compass data.

A measured value (x, y, z) of a 3D compass points (as seen by his origin 0,0,0) always in one direction: to the north pole. If you rotate the 3D compass around all of its axes, all measured values ​​lie on a sphere:

compass sphere

If you add a magnetic material (e.g. metal) near the compass, the measured values ​​from the origin (0,0,0) of the sensor suddenly point in one direction only - Why?
There are two types of disturbances of the magnetic field which change / move the values​​:

Hard ircon (e.g. magnets): the sphere moves
Soft ircon (e.g. metal): the sphere deforms (becomes an Ellipsoid)

Example measurements

compass ellipsoid    compass ellipsoid cal1    compass ellipsoid cal2

(left: the uncalibrated readings do not lie on a sphere but on an ellipsoid and have shifted from the origin of the sensor
center: shift-corrected values
right: the calibrated values ​​are now undeformed again on a sphere, centered around the origin of the sensor)

The aim of the calibration is that the measurements are centered again on a sphere around the origin of the sensor.

Calibration steps:

First ensure that the IMU module is mounted on the final position and that entire robotic electronic equipment and metal objects are 30cm or more away from it (ie the sensor is not distracted by metallic objects in its environment).

1. Download ArduMag calibration app for Android.
2. If not done yet, pair your Android device with the Bluetooth module: On the Android device main screen, choose symbol "Settings" (via Android menu). Now choose  "Wirless and Networks->Bluetooth Settings" and "Find device". Finally, choose "pair with this device" and enter your pin (very often "1234"). The Bluetooth module should now appear as "paired".
3. In the ArduMag app, press the Android menu key and then "Bluetooth" to connect with your Bluetooth module (and your robot). The robot should confirm the connection with a beep. The number of measurements should increase.

Turn around the robot slowly for all axes and all 6 sides for at least 360 degrees:

ardumower compass calibrate

The order of the axis of rotation and the direction does not matter. For example, rotate each side 180 degree clockwise and then again 180 degree counterclockwise (result is a 360 degree rotation). The measurements may not fit a sphere.

ardumag1   ardumag2   ardumag3

4. Finally, press 'Calibrate' to finish the calibration. The robot will confirm the calibration with two beeps. The measurements should fit a sphere now.

ardumag4    ardumag5

Testing of compass and tilt angles (via serial console)

The Arduino outputs:

yaw: Course/Yaw (see above figure)
pitch: Pitch angle (see above figure)
roll: Roll angle (see above figure)
frequency: Number of measurements per second (100)
latency: Number of latency overflows (0)
access: Number of external access counts (from Arduino Mega)

(by using LED)
Align the compass facing north, south, east, west - the LED should go ON. Between them it should go OFF. North, south and east, west about should be opposite.

Testing (via Android pfodApp)
You can plot the results of the IMU module (yaw, pitch, roll) using pfodApp:

ardumower imu plotting