Ardumower Sunray

Wechseln zu: Navigation, Suche

NOTE: everything here is still in development! Use Azurit firmware instead if you need a working firmware...

Ardumower sunray1.jpg

Ardumower Sunray is an alternative Firmware (experimental) for the Ardumower. It uses odometry, an IMU (gyro+compass) installed in a 'tower' and a perimeter to localize itself on the perimeter and within the perimeter. A particle filter estimates the robot position on a map based on moved distance and absolute angle.

Currently, a PC must be connected via Bluetooth to the robot to run the particle filter-based localization.

Demo video:

Significant changes compared to Azurit Firmware

  • Optimized for PCB 1.3
  • Optimized for Arduino Due (no longer sensor polling, individual pin interrupt handling, DMA transfers, flexible ADC sampling frequencies...)
  • Optimized for slope and odometry (no longer imprecise time-based driving distances or rotations)
  • Optimized for MPU6050 and DMP (digital motion processor)


  • Ardumower PCB 1.3 (incl. MC33926 motor drivers) - for PCB1.2 see further below
  • Arduino Due
  • IMU GY-88 (MPU6050, HMC5883L) installed on a 'tower'
  • 2 perimeter coils (left, right), Ardumower perimeter sender
  • Ardumower motors using odometry
  • Bluetooth module and a PC using an USB Bluetooth dongle (e.g. Delock EDR 150m)

Ardumower tower.jpg Ardumower compass tower.jpg

Why Arduino Due? The Arduino Due has a DMA controller for ADC sampling without CPU interaction. Mapping and localization requires some working memory - Arduino Due has 96 KB SRAM for this task. Arduino Due supports flexible ADC sampling frequencies, spike filtering on I/O pins, I/O interrupts for all pins.

Why IMU GY-88? The MPU6050 has integrated sensor fusion (acc+gyro) via it's DMP (digital motion processor). Also, the MPU6050 gyro has a low measurement error (0.005 dps/sqrt,


Arduino Due operates at 3.3v - PCB1.2 is not designed to work for 3.3v, however you can modify and use PCB1.2 (with limitations/on your own risk) at 3.3v:

  1. Remove Jumper JP3 (PowerA3.3) and Jumper JP12 (PowerA5.0) so no Arduino voltage regulators are used. Remove any measurement jumpers as well (Mess3.3 etc.).
  2. Set DC-DC U7 to 3.3v (all old 5v lines and VCC-lines on the PCB will now operate at 3.3v !)
  3. Set DC-DC U6 to 5.0v (all old 3.3v lines on the PCB will now operate at 5.0v ! It's recommended to make big labels on the PCB so you get not confused later!).
  4. MC33926 motor driver and INA169 module and odometry will now operate at 3.3v. Change VCC pin for the following modules to operate them at 5v:
    1. HC-05 module operates at 5v
    2. GY88 module (IMU) operates at 5v (SCL, SDA lines operate at 3.3v).
    3. LM386 modules (perimeter) operate at 5v.


  1. Using Arduino IDE, flash the Sunray firmware onto your Arduino Due: (you may have to adjust serial ports in config.h).
  2. Install Processing (
  3. Using Processing, run 'processing_sunray' and verify that the bluetooth connection to the Firmware is working.

Bluetooth connection

On the PC, choose the COM port for your Bluetooth connection. In processing_mag.pde:

 String serialport = "COM14";

Compass calibration

Ardumower Sunray relies on a carefully-performed compass calibration, so it knows the robot's direction up to 3 degrees.

  1. Install IMU module 35cm away from metal parts (suggestion: use a 'tower' for it as you can see in the photos). Use 1m cable so you can move the module out of robot for calibration. Do no use metal parts (screws etc.) within 5cm of the module - use plastic screws. Fixate everything within 5cm of the module. A small movement of a cable etc. will make the calibration useless.Verteileraufputzdose 2017-01-22.jpg
  2. Move IMU out of robot (so you can freely rotate the module without the robot) and power-on robot.
  3. On the PC, start 'processing_mag'. Compass calibration.png
  4. Ensure there is at least >1m to all metal parts in the surrouding.
  5. Rotate IMU module slowly into all directions and collect > 20,000 measurements. Calibration ist performed and transmitted continously to robot (robot confirms with a tone).
  6. Install IMU module in the robot at least 35cm away from metal parts.

In the next section, we will verify compass yaw and gyro yaw are showing same values (up to 3 degree).

User interface (for testing/development)

  1. In 'processing_sunray.pde', setup Bluetooth port.
  2. On the PC, start 'processing_sunray'. The robot's sensors should be shown. At start (and every 3 minutes), the robot calibrates the Gyro and the IMU calibration status is shown in the user interface (the robot will make short buzzer beeps during gyro calibration time). After this is completed, you can verify the compass calibration by rotating the robot using the green joystick shown on the screen. Compass yaw and gyro yaw should be always the same (up to 3 degrees).


Test functions

Verify the the robot is moving correctly using these test functions. Click on one of the buttons in the user interface:

  • line : robot should move on a straight line
  • line rev : robot should move reverse on a straight line
  • rotate +90deg : robot should rotate counter-clockwise 90 degree

Recording / Playback

You can record or playback all robot messages (e.g. to test the particle filter offline without robot). In processing_sunray.pde:

String logFile = "outdoor_mow_rand.log";  // if file exists, playback mode, otherwise record mode

There are sample files in the 'data' folder you can use for testing mapping and localization without a robot:

  • outdoor_track.log (robot tracking a 120m perimeter)
  • outdoor_mow_rand.log (robot randomly mowing inside a 120m perimeter with annotated ground truth)


Before you can localize the robot on the map, the map needs to be generated. This is called mapping.

  1. On the PC start 'processing_sunray' and connect to robot via Bluetooth.
  2. Put robot on perimeter, as close as possible to charging station (for anti-clockwise tracking).
  3. On the PC, choose 'track anti-clockwise' and 'mapping is ON'.
  4. Let robot track perimeter until it returns at the other side of charging station.
  5. Press 'mapping is OFF'. The map will be generated and stored on the PC.


A particle filter will estimate the robot's position on the map (this is called localization). You can reset the particle filter at any time by clicking 'reset particles'. In perimeter tracking mode, slightly different particle filter parameters will be used than during ordinary mowing. You can set the robot's position manually (this is called kidnapping) by clicking on the map in the user interface. If you move the robot in the real world manually on the ground with your hands, this is kidnapping too, and the filter has to detect this situation and will reset automatically.

Random mowing

In random mowing mode, the robot will move until a sensor (perimeter, bumper etc.) triggers and then choose a random direction and continue.

  1. On the PC, choose 'mow rand'

Demo video:

Lane-by-lane mowing

In lane-by-lane mode, the robot will move one lane until a sensor triggers, then enter the next lane and continue. NOTE: A strategy for mowing not-mowed areas on the map is not yet implemented.

  1. On the PC, choose 'mow lane'

Demo videos:,

Perimeter tracking

The particle filter will estimate the robot's position on the perimeter while tracking.

  1. On the PC, choose 'track'

Demo video:

Particle filter tuning

The particle filter can be tuned in map.pde where you can set steering and distance noise for the particles:

 public static final float steeringNoise = 0.5;  
 public static final float distanceNoise = 0.05;


While in perimeter tracking mode, the robot will stop immediately after seeing voltage at its charging pins and start charging.

Demo video:

Stuck detection

Direction change is measured via (1) odometry and (2) gyro and both are compared to detect a tire stuck. Additionally, (1) set angle and (2) current angle of direction PID controller are compared to detect a tire stuck.

Demo Video:

Discussion / forum thread