Professional Documents
Culture Documents
Automatic lawn mowers are very modern ... and very useful. Unfortunately, but also very expensive!
Approximately 800 to 1500 €. Cheaper they are hard to get. 6 years ago I started to design my first
“homemade” automatic mower. I had to build the whole electronic by myself and the chassis was
made from aluminum, steel and other materials. It was a very complex design and for a replica you
needed a lot of electronic experience and a well equipped workshop with a milling machine and a
lathe.
With the development of 3D printers for home use and the worldwide spread of the arduino we now
have the tools for replicating such projects in an easy way. 3D printers enable us to build complex
mechanical parts without lathe and milling machine. The Arduino reduces the electronics work to a
minimum, so that even beginners in this field are able to replicate this interesting and very useful
project, and at a fraction of the cost that one would have to apply for a commercial automatic
lawnmower.
The experience from 6 years building homemade automatic mowers went into this project. The "3D
printed Robotic lawn mower" is well tested, robust ......and it will take a lot of work from you.
If this construction manual looks very long for you, don’t worry. Most of this is pictures for making
building easy. True to the motto: Nice to print ... easy to build
Andreas Haeuser
Dezember 2015
Preface..................................................................................................................................................... 2
1.1 Warnings........................................................................................................................................ 8
- Central european climate. The grass grows well (but not fertilized!) and has to be mowed 7
months a year
Our robotic lawn mower is powered by two rechargeable 12V NiMH batteries with a capacity of
4500mAh, or alternatively by two rechargeable 11.3 V LiPo batteries, each with 5000mAh. Depending
on the status of the batteries, unfortunately their performance decreases over the years, the robotic
lawn mower travels approximately 90-120 minutes. On the test facility described above (my garden) I
let him go once a day (or about 90-120 min). This is enough for a pretty good result. In a much
smaller area, it might be enough to let him go every second day. On a larger lawn it has to drive
longer, or more often. In the end you have to collect your own experience for your garden.
Our robotic lawn mower works on the same principle as its commercial counterparts, which can be
bought for a lot of money at most hardware stores. Batteries are used as an energy source and two
small geared motors provide propulsion and direction changes. The small front wheel supports the
mower in the front and is used to adjust the cutting height (Pic.1).
The “boundary wire fence (BWF)” is just a wire that is pinned to the lawn. A simple electronic circuit,
the transmitter, powered by a wall wart, generates a frequency of 7,812 kHz and inducts this into the
BWF. The sensors of our mower detect exactly this freuquency. The BWF was tested with a length up
to 430m without any decrease of the power. This means, that for sure you can make a much longer
BWF if you want (Pic.3).
Although the sensors of our mower prevent it from crossing the BWF, it’s still possible to create
“islands”, e.g. to drive around trees that are standing in the middle of the lawn. If the BWF-wire is
separately it radiates the frequency generated by the transmitter. If you guide the BWF-wire back to
itself and put it very close together, the radiated waves cancel each other and the mower can run
over the two BWF-wires (figure 4).
Of course, it cannot always be avoided that sometimes things are lying around on the lawn that really
do not belong there. Garden equipment, children's toys or other objects forgotten on the lawn can
be recognized by our robotic lawn mower, if they are not too small. The current of the drive motors
is measured during the entire operation. If the mower hits items that try to stop him the current of
the motors increases. The arduino gets this, stops the mower and lets him turn around. We call this
“collision control”.
When the battery voltage decreases below a critical value, the robotic lawn mower switches off
automatically in order to prevent deep discharging of the batteries. The batteries must then be
charged, or be replaced by already charged batteries.
The robotic lawn mower described here has no safety devices that protect from improper handling
or operation. Operate the mower and the transmitter never without your personal supervision.
Other people, children and pets do not know about the dangers emanating from the mower and may
suffer severe injuries.
Make sure that there are no power cables on the ground on which you operate your mower. Cutting
a power cable may suffer severe injuries or death.
The use of this manual and the associated electronic records, data file and the information contained
therein is expressly at your own risk. The author cannot take over a guarantee for the freedom of
mistake, exactness and completeness of the information and excludes any liability for any accidents
or damage of any kind arising from the use of this manual and the associated data file. Read chapter
“Legal disclaimer“.
It is December 2015. The theme “3D printer” is on everyone's lips. In the beginning only homemade
"reprap printer" as Prusa and Mendelmax were used. Nowadays almost weekly new industrially
produced 3D printers come to the market place. Some are well-adjusted in the factory and work well,
but some do not. For this reason I would like to give here a few tips that maybe help the one or the
other to eliminate existing problems with printing.
An often discussed problem is that large components sometimes do not stick sufficiently to the print
bed and peel off during printing. For those who still have problems here, I tell you my solution: I print
all the components on mirror tiles that are covered with kapton tape. Before printing PLA
components I clean the surface of the kapton tape every time with "Würth Brake Cleaner" (available
in any auto parts store or on EBAY). With ABS components I use acetone (available in any hardware
store) for cleaning the kapton tape. Furthermore the printing bed temperature is very important for
good results. PLA components I print with a print bed temperature of 65 ° C. For ABS I take 105 ° C.
But beware! Do not trust the display of your control software. I have made the experience that the
ads are very inaccurate. This comes from the fact that the temperature is measured with a
thermistor. Most of all printers have this thermistor mounted in the heat bed. But the surface of the
kapton tape is from there still far away. I measure the surface temperature of the kapton tape with a
contact free infrared thermometer in the center of the print bed. If you adjust the printer this way,
so that it will reach the temperatures mentioned above, it should work fine. For me this combination
of cleaning and temperature works with 3 different printers without any problems. Even large
components made of ABS and PLA can be printed as almost distortion–free and the components stick
to the print bed till to the end of the print.
Some parts have to be printed absolutely free of distortion. Leave the components on the print bed
after printing and place it for 60 minutes in the oven. Set oven temperature for ABS parts to 100 ° C
and for PLA parts to 70 ° C. Turn the oven off after 60 minutes and allow the parts to cool down
slowly to room temperature while they stay in the oven. After this you can take the components
From my perspective, there are two good reasons to calibrate a printer really well:
1) It's just a lot more fun when printed parts can be easily fitted together without much rework.
2) If you want to use the printed parts for the construction of a moving machine, as the
example of our robotic lawn mower, then a certain precision in the components is required
to make sure that the machine works well. An Example: For printing the “Motor hub”, the
angularity between the Z-axis and the XY-plane has to be well calibrated. If it is not, the
central bore for the motor axis will not be perpendicular to the plane of rotation of the cutter
disc. The cutter disc then will wobble and generate vibrations. This may cause damages to
your robotic lawn mower.
If you did not think about the calibration of your printer yet, maybe it is worth to do it. You will find a
lot of good tutorials about printer calibration in the internet.
Furthermore, a few things are required that are not listed in the parts lists. Superglue, Uhu Plus
Endfest 300, acrylic sealant, alcohol, some grease, tin solder, 3,5mm cable ties, sandpaper with
different grits and adhesive tape (single and double sided). Very useful is a small emery board. A
Many works can be done in different ways and with different tools. This is the reason why I do not
give a tool list. As previously recommended you should read the construction manual before starting
construction. Then you see what you have at home and what you need to obtain.
The problem with drilling and tapping printed components is the material: Thermoplastic. When
drilling and tapping the tool will be heated by the friction, the material melts and sticks to the drill or
tap. The bores are not going too well, and the threads are not really accurate. The durability of these
threads will be very poor. This can be prevented in a simple manner:
If the bores and threads are not deeper than 1-2mm you will not have any problems, because the
tools don’t heat up very much. But if they are deeper they will heat up very quickly. The quicker the
tool spins, the quicker the tool heats up. So the best is to work with low speed! I always use a little
cordless screwdriver for drilling and tapping and I always put a little grease onto the tool. This cools it
down and lowers the friction. Deep bores and threads should be made stepwise. Cut 5mm in and
then rewind the tool out and clean it from shavings. If you cut a brush to a short length, you get a
hard kemp. This works very well for cleaning the tools. If I have to cut bores or threads I don’t use
grease on the tools if I have to do some gluing in this area, of course! (Pic.7).
We will build the electronics step by step. After every single step we will test the electronic circuit
with a test-sketch which is part of the electronic data files that are supplied with this construction
manual. This way your electronic circuit and your arduino-controler-programm (called “sketch”)
“grows” step by step. You will learn how the electronic circuit and how the arduino-programm works.
Finally you will have the knowledge you need for modifying this project to your demands (if you
want).
All arduino sketches, supplied with this construction manual, were developed and tested with the
arduino IDE version 1.6.6. Please do not use older versions, because there may be compatibility
problems.
Base_RL.STL
4 Grundplatte_HR.STL 1 PLA 80% Infill
(hinten rechts) 132gr.
Base_RR.STL
52 DC-Motor 1 www.conrad.de
IGARASHI SP3657-30GF Part.Nr.: 244465
Onlineshops, Ebay.
Search google for: IGARASHI
SP3657-30GF
53 Silent block Typ A 6 www.RC-Force.de
M4 Part Nr.: 2233-531
D=15mm, L=25mm Onlineshops, Ebay
Make sure that the side walls of the base parts are rectangular. Sometimes the first perimeter of a
print extends a little bit. If this is the case take a file and correct this. Only if the side walls are
rectangular you get a straight and flat base after screwing together the single parts (Pic.11).
Drill the 4 preprinted tapping holes to 2,5mm. Cut a M3 thread in all 4 holes, as shon in pic. 13.
The robotic lawn mower has 2 drives. They consist of the parts shown in pic.15.
The 6 bores for the mounting screws Nr.37 must be edited with a countersink. The heads of the
screws must be flush to the plane of the drive mount. Be careful! Don’t go to deep with the
countersink, to make sure that the threads of the screws do not stay out to far on the backside. The
threads in the motors are pretty short! (Pic.17).
Now we have to prepare the two motors Nr.38. These little geared motors are really robust, but they
have a weak spot. Dust and humidity that goes into the gears damages it.
Put 2 layers of elastic isolation tape over the gap between motor and gear (Pic.18).
Twist the wires to avoid EMC problems. We will power the motors with PWM (pulses). For this we
need twisted wires! (Pic.24).
To protect the contacts against humidity you have to cover them with the help of a hot-melt gun, as
shown in pic.26 and pic.27.
Put grease all over the felt-sealings. Fill grease into a little plastic bag and put the sealings in. Now
tumble the sealings in the grease. Make sure that they are well soaked with grease (Pic.33 and
pic.34)!
Drill the 4 holes shown in pic.40 to 3mm. Don’t use grease for drilling. We will glue these parts
together later!
Put the other two 3mm screws into the wheel fork and fasten them. Now drill the 4mm holes as
shown in pic.42.
Glue the ball bearings in the front wheel. If the bearing fits exactly into the front wheel superglue is
well suited. If the adhesive gap is slightly larger you should use Uhu plus endfest 300 here (Pic.48).
Drill the center holes of both bearing hubs Nr.10 to 4mm. Check that the bearing hubs fit into the
bearings (Pic.49 and pic.50).
Trim the front wheel mount this way, that it fits into the base. It should slide up and down with a
very little friction only (Pic.53).
Install the front wheel as shown in pic.55. Put some grease on the fork axis.
Please ensure to print the parts Nr.11 and Nr.12 from ABS! The cutter motor gets hot during
operation. PLA would not stand this temperature load.
Drill the two inner holes of part Nr.11 to 3,2mm as shown in pic.58.
Countersink both bores this way that the heads of the screws Nr.49 are flush with the outer surface
(Pic.59).
The motor hub Nr.12 must be build very carefully. If not, the cutter disc may wobble during
operation and this causes vibrations and noise. In the worst case it will go off the motor axis.
Drill the tapping bores for mounting the cutter disc to 2,5mm and cut a M3 thread in (Pic.61).
Drill the center hole for the motor axis to 3,2mm. To make sure that this bore becomes rectangular. I
recommend using a drill stand for this work (Pic.63).
Push a 3,2mm drill into the center bore oft he motor hub. Fasten the screws Nr.30 with low force.
Unscrew all of them 1/16 turn and pull the drill out of the bore (Pic.65).
Tighten the clamping screws now crosswise according to the numbering of pic.67 with low force. In a
second pass tighten the screws again with some more force. Caution: Tighten the screws not with
violence; thereby you may deform the motor hub! Check by turning the motor hub that it drags
nowhere and does not wobble.
WARNING: Do not connect to the motor to a power source! The motor will be driven by the
electronics with low power only! The direct connection to a 12V battery overloads the construction.
This may cause a loosening of the cutter disk and may cause very serious injuries!!!!! For the further
construction it is best to unscrew the cutter disc again!
Build two sensor mounts from an aluminum profile 15mmx2mm as shown in pic.78.
Drill in both sensor housings (Nr.21 and Nr.23) 4 x 2,5mm tapping holes and cut M3 threads in
(Pic.79).
Drill in each housing top 2 x 2,5mm tapping holes and cut M3 threads in (Pic.81).
Screw sensor housings and housing tops together, using scews Nr.54 and washers Nr.32 (Pic.83).
Screw the sensor mounts to the base as shown in pic.85 and pic.86.
I recommend 2 x 5000mAh LiPo batteries or 2 x NiMH batteries with a capacity of 4500mAh. You can
find both versions in the parts list and have to choose one. My personal favorites are the LiPo
batteries. Because of the lower voltage of LiPo batteries the mower moves slower than with NiMH
batteries but because of the higher capacity and the lower weight the operation time of the mower is
Battery charger you get from 20€ to 200€ and more. If our mower works at daytime we have the
whole night for charging the batteries. In this case a cheap “Plug-in charger” as shown in pic.88 for
about 20€ is well suited. With two of these chargers and two batteries your mower can work every
day. Recommendations for chargers are listed in the parts list.
The battery mounts are made from the parts shown in pic.89. In this construction manual I show how
to build the battery holders for the NiMH batteries. Battery mounts for LiPo batteries are build in the
same way; just take the printed parts Nr.25 an Nr.26 instead of parts Nr.27 and Nr.28.
Cut 5mm wide strips from the foam rubber. The length of the strips for NiMH battery holders should
be 15mm, for LiPo battery holders about 25mm. You need 6 strips for every battery mount (Pic.91).
Pic.95 shows where to screw the different kinds of battery mounts with screws Nr.56 and washers
Nr.32.
Glue two strips of fly net Nr.63 over the ventilation opening of the housing top Nr.16. “Uhu-Extreme
is a good glue for this (Pic.98 and pic.99).
Screw a nut Nr.31 to the end of a long M3 screw and heat it with a lighter. Then push it into the
hexagon of the housing base plate. Make sure that the screw is aligned rectangular when the PLA
cools down. Do the same with the other 3 nuts (Pic.103).
Drill the lower bores of the electronic housing Nr.14 to 3,5mm (Pic.105).
Use a file to rework the hexagon on the front of the housing to make it fit for the switch Nr.65
(Pic.107).
When the glue is hardened you can install the switch in again (Pic.109).
Disassemble the base plate and install the three silent blocks Nr.53 as shown in pic.118 and pic.119.
Note: I painted some wave lines on the polycarbonate only to take the pictures for this construction
manual.
Drill the preprinted tapping holes of the 4 hinges Nr.20 and of the magnet mount Nr. 18 to 2,5mm
and cut a M3 thread in. Drill the hinge holes of the 4 hinges Nr.20 to 3mm (Pic.124).
Assemble the hinges as shown in pic.125. Fasten the self-locking nuts this way that you can easily
move the hinges.
Cut to the polycarbonate Nr.70 to a size of 440 x 330mm. If you do not buy the polycarbonate as a
flat plate, but from a roll, as it is often available in hardware stores, so it is often arched. Note here
that the 440mm must then be measured in the direction of curvature (Pic.129). Screw the magnet
mount Nr.18 together with the magnet mountplate Nr.19 to the polycarbonate. The magnet mount
should be on the inside of the curvature of the polycarbonate (Pic.128 und pic.129).
Screw the cover and the hinge plates Nr.20a to the hinges as shown in pic.131.
When the paint has dried, you can reassemble everything. Pic.133 shows the robotic lawn mower
with finished cover. The magnetic closure allows quick access to the batteries. Although the sides of
the cover are open, it has proved to work very well! Even in heavy rain it keeps the electronic and the
batteries sufficiently dry. It also prevents that the robotic lawn mower is caught by branches when it
works close to low bushes.
Picture 134 shows the schematic diagram of the transmitter. The quartz QZ1 generates a frequency
of 4MHz. The IC 1 is a 74HC4060. It’s a 14 level binary counter that divides the frequency of the quarz
to 7,812 KHz. The transistor T1 amplifies this signal and gives it to the boundary wire fence (BWF).
R2 Metalfilmresistor 1 www.reichelt.com
220 Ohm, 1% Reichelt Part Nr.:
METALL 220
R3 Metalfilmresistor 1 www.reichelt.com
470 Ohm, 1% Reichelt Part Nr.:
METALL 470
Drill the six preprinted tapping holes of the transmitter housing Nr.1 to 2,5mm and cut a M3 thread
in (Pic.136).
File the openings at the front so the parts shown in pic.137 fit in.
Install all parts as shown in pic.139. We will use the screws Nr.9 for installing the breadboard later
on.
Drill the preprinted bores stepwise first 2,5mm than 3,5mm. Drill slowly to ensure that the template
does not slip on the bread board (Pic.144).
Now you can place the electronic parts on the breadboard according to the schematic from pic.134.
The breadboard is big enough so that it should not be a problem to place them all. The terminals for
the resistor R4 must be soldered into the marked rear corners so that this can be connected later
through the openings in the housing. If you use pic.147 as a guideline for placing the electronic parts
you will have it easy to wire all electronic parts. Take care about the polarity of the electrolytic
capacitors C5 and C6 and the right connection of the voltage regulator VR1 and the transistor T1. All
connection points for cables should be made with solder nails Nr.17. Ensure that no parts and solder
joints are too close to the bores in the breadboard otherwise you get trouble when you want to
screw the breadboard into the housing.
Make sure that the power connectors are clearly marked with + and – . A wrong polarity may
destroy your electronics.
The testing of the circuit should be done before the board is installed in the housing. Although the
circuit is not complicated..... errors do happen and can be corrected easily if you do not have to build
everything apart again. Solder connectors and switch to wires as shown in pic.151. You also need a
little boundary wire fence. Build it from a piece of wire and the two bunch plugs Nr.11.
If everything works well put the IC1 into the IC socket. Take care about the right orientation of the
IC1 (Pic.153)!
If everything works well you can install the breadboard into the housing, as shown in pic.155.
Connect the resistor R4 with a 5mm gap to the housing (because of heat) and screw the transmitter
top on the housing (Pic.156 and pic.157).
It will be difficult to get such a long wire in one peace. If you have to solder some wires together,
make sure do make a very good isolation against humidity on the solder joint. Humidity destroys the
copper core of your wire very quickly! The best way is to put some silicon on the solder joint and a
heat shrink tube on top. This works very well.
You need a lot of hooks to pin the BWF to the ground. The easiest and cheapest way is to make them
from 2mm welding wire Nr.20. Cut it to 15cm long pieces and bend 1/3 of it (Pic.158).
Each sensor has two resonant circuits, made from L1,C4,C6 and L2,C5,C7. These resonant circuits are
matched to a frequency of 7,812 KHz. If one of the resonant circuits comes close to our BWF (that
also works on 7,812 KHz) it generates a voltage. A very low voltage. This voltage goes to an
operational amplifier IC1 that amplifies it in an amount, that the arduino can measure it.
Why does every sensor have two resonant circuits? Easy answer: If the longitudinal axis of the coil is
parallel to the wire of the BWF the signal is very low, it’s nearly zero. If it is 90° to the BWF the signal
is very strong. Later we will place both coils in a 90° angle to each other. This ensures that the worst
angle between one of the coils and the BWF can be 45°. This way you will always get a good signal
from one of both resonant circuits.
IC 1 LM 358 2 www.reichelt.com
Operational amplifier, Reichelt Part Nr.:
dual, DIP-8 LM 358 DIP
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 100
4.2.2 Building the sensors
For making the sensor breadboards we are using printed templates, again. Nr.1 for the left and Nr.2
for the right sensor. We do it in the same way we did when we built the transmitter (Pic.160).
1) Stick the printed templates with two sided tape onto the breadboard Nr.4.
3) Drill the preprinted holes stepwise first to 2,5mm and then to 3,5mm.
4) Take the templates from the breadboard and cut the sensor breadboards to size. Smooth the
cutting edges with sandpaper.
As example pic.161 shows how to place the coils L1 and L2 on the right sensor breadboard. Cut the
connection wires of the coils to a length of about 6mm and solder them in the marked areas. For all
following work have in mind not to place any parts in the red marked rectangle, shown in pic.161.
We need this area for mounting the sensor!
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 101
Pic.162 shows right sensor breadboard from top and left sensor breadboard from downside, after
soldering the coils.
The breadboards are big enough to mount all parts according to the schematic diagram in pic.159.
Use pic.163 as an orientation for placing the parts. This way you will have a good basis for a simple
structure of the circuit.The capacitors C6 and C4, C5 and C7 should be placed as close as possible to
the coil, with which they form a resonant circuit. Pay attention to the polarity of the electrolytic
capacitor C1. The negative pole faces the edge of the board. The solder nails (Nr.3) for the supply
voltage should be maked with + and - mark. An incorrect polarity may damage both the sensor and
the arduino!
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 102
Before you place the operational amplifier IC1 in the IC socket Nr.5 you should check with a
multimeter that there is no short circuit between pin4 and pin 8 at the IC socket (Pic.164).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 103
Take care about the orientation of the IC1 when placing it in the socket (Pic.165).
Pic.167 shows the schematic diagram for connecting the sensors to the arduino. You do not need a
external power supply . Arduino and sensors are powered by the USB connection from the PC.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 104
Use a cutter to cut a 6-contact strip and an 8-contact strip from the 50-pin header Nr.6 (Pic.168).
Insert the trimmed headers in the socket connectors of the arduino, as shown in pic.169. Now you
can solder the connecting wire Nr.7 to the pins of the arduino. Be sure to use twisted cables for
connecting the sensors! We will later operate 3 DC motors with pulsed (PWM) currents that emit
strong electromagnetic pulses. The twist of all cable reduces unwanted disturbance. First connect
just one sensor in order to test them individually.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 105
For testing the first sensor you need a USB cable to connect the arduino with the PC and your
transmitter with BWF (Pic.170).
Open your arduino IDE (make sure that you have the arduino IDE version 1.6.6 or a newer version)
and open the sketch “SENSORTEST” from the files that were delivered with this construction manual.
As already said at the beginning of this manual we will extend the electronics and the control
programs step by step. You will find all variables and definitions of this first test sketch in the
following sketches.
At the beginning of the sketch “SENSORTEST” we define the analog pins A3 and A4 as input pins for
reading the signal of the left and the right sensor. Also we define the variables „Sensevalueleft“ and
„Sensevalueright“. These variables take over the values that are measured at the analog pins A3 and
A4.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 106
In the „Setup“ we start the serial communication.
In the “main program” we go through a simple loop. First we measure the sensor signals at analog
pins A3 and A4. We write these values into the variables „Sensevalueleft“ and „Sensevalueright“.
Next we print these variables to make them visible on the serial monitor of the arduino IDE. At the
end there is a delay of 500ms. We need this to have some time for reading the prints on the monitor.
// SENSORTEST
// Read sensors
// Read sensors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 107
Switch the transmitter off and place the front-coil of the sensor you connected directly on the BWF
as shown in pic.171. Load the sketch “SENSORTEST” up to your arduino and start the serial monitor
of your arduino IDE. The arduino now prints the values it reads from the analog pins A3 and A4. For
the sensor that is connected to the arduino you should get a value about 0..1. For the sensor that is
not connected it should show an arbitrary value that changes (the pin is instable because no sensor is
connected). Now switch the transmitter ON. The value for the connected sensor should be about 600
now. Because of tolerances of the electronic parts this value may differ about +/- 50.
Do this test with the other sensor. If this also works well connect both sensors to the arduino,
according to the schematic diagram in pic.167, and test them together (Pic.173). If everything works
fine you can go on. If not you have to look for the error and correct it.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 108
Now place the sensors with a distance of 5cm to the BWF. The values should be about 200 now
(Pic.174). Like said before the values may differ because of tolerances but they should not be below
100.
If the sensors are tested and work fine you can install them as shown in pic.175 and pic.176.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 109
Route the sensor wires as shown in pic.177 and fix them with cable ties. When operating the mower
you have to bend the aluminum sensor mounts this way that the sensor housings are close to the
lawn. For this you have to make sure that the wires are not too tight, otherwise you cannot bend the
sensor mounts anymore. The best is to make a little cable loop between sensor housing and base.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 110
4.3 The controller board
Pic. 178 shows the schematic diagram of the control board. We will build this step by step and check
the individual sections with arduino test sketches. This way you will learn how the electronics and
the arduino controller software works. This enables you to find errors, to do repairs and to modify
the project to your demands if you want.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 111
Pic.178
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 112
4.3.1 Parts list controller board
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 113
9 2-pin terminal strip, 2 www.reichelt.com
spacing 5.0/lift Reichelt Part Nr.:
AKL 012-02
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 114
R12 Metal film resistor 1 www.reichelt.com
4,7 KOhm, 1% Reichelt Part Nr.:
METALL 4,70K
T1 BUZ 11 1 www.reichelt.com
N-FET TO-220AB Reichelt Part Nr.:
transistor 50 V 35 A BUZ 11
D1 SB 550 1 www.reichelt.com
Schottky diode, DO201, Reichelt Part Nr.:
50 V, 5 A SB 550
1) Stick the template with two sided tape to the breadboard Nr.3.
3) Drill the preprinted bores stepwise first to 2,5mm and second to 3,5mm.
4) Take the template from the bredboard, cut it to size and smooth the edges with sandpaper.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 115
Pic.180 shows the breadboard cut to size.
Install the 7 spacers Nr.5 with the nuts Nr.6 as shown in pic.181. Do not fasten the nuts yet. The
spacers must be loose enough to move them in the bores.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 116
Install the arduino uno and the motorboard with screws Nr.7 on the spacers. After this you can
fasten the nuts to fix the spacers in the right position on the breadboard (Pic.182).
Install 4 spacers Nr.5 on the base plate of the electronic housing as shown in pic.183.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 117
Check that the breadboard fits the spacers easily. If it clamps you should do some rework to the
bores with a file (Pic.184).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 118
4.3.2.2 Connecting the sensors
Pic.185 shows the schematic diagram for connecting the sensors. Compare this with the schematic
from pic.178. The sensors are powered by the arduino 5V outline. The signal lines of the sensors go
to the analog pins A3 and A4 of the arduino.
Solder the two 3-pin terminals Nr.10 in the marked area onto the breadboard (Pic.186).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 119
Mark the terminals as shown in pic.187. Have in mind that an error in the connection may destroy
your arduino and your sensors. Marks help to avoid such errors!
Connect the terminals as shown in the schematic from pic.185. Take the flex wire Nr.14, 15 and 16
for this:
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 120
Install the base plate of the electronic housing on the base of the mower (Pic.189).
Use the arduino test sketch „SENSORTEST“ for testing the assembly as you did it before when
building the sensors (Pic.191).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 121
4.3.2.3 Connecting the status LEDs
Pic.192 shows the schematic diagram for connecting the status LEDs. Compare this with the
schematic from pic.178. The status LEDs must be connected in series with the resistors R13 and R14
to the digital pins 3 and 4 of the arduino.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 122
There must be some contacts left from the 50-pin header Nr.6 from part list 4.2.1.2. Cut a 10-pin
strip from this and a 8-pin strip. Push these into the socket connectors of the arduino as shown in
pic.193.
Cut 2 x 2 pins from the 50-pin header Nr.17 and solder them, according to the schematic from
pic.192, together with the Resistors R13 and R14 on the breadboard. Mark the pins with green and
red dots for connecting the LED wires (Pic.194 and pic.195).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 123
Take the LED wires from the electronic housing and connect them. Take care about the polarity
(Pic.196).
For testing the circuit load the sketch „STATUS_LED_TEST“ up on your arduino. After uploading the
two LEDs must flash alternating.
As said before we not only build the electronics step by step but also the software. This means that
this sketch is based on the sketch before („SENSORTEST“). So you find all defined pins and variables
from this sketch in the new sketch „STATUS_LED_TEST“.
The digital pins 3 and 4 were defined as connecting pins for the LEDs. In the setup we define these
pins as output pins so we can switch them high and low. The main program is very simple. We switch
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 124
one LED on and the other off. We wait 500ms. Then we invert the the LEDs. We are waiting again
500ms and then the loop starts from the beginning.
// Read sensors
// Status LEDs
// Status LEDs
delay(500);
delay(500);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 125
4.3.2.4 Building the power supply
Pic.197 shows the circuit diagram for the construction of the power supply. Compare this diagram
with the circuit diagram of pic.178. It is essential to build up the power supply on the board before
you connect the motors. Otherwise the motors would draw power via the voltage regulator of the
arduino, so this would be overloaded and destroyed. The power supply consists of the electrolytic
capacitor C1 that smoothes the supply voltage (which is very important because the 3 DC motors are
all operated with PWM) and a voltage divider consisting of R11 and R12. At the junction of the two
resistors the ADC of the arduino is connected with PIN A0 to measure the battery voltage and disable
the robotic lawn mower if this goes below the permissible minimum voltage. This way the batteries
will not be deep discharged.
Solder the 2-pin terminals Nr.9 in the marked area on the breadboard. The right terminal is used to
connect the battery. The cutter motor will be connected to the left terminal later. Mark the positive
and negative poles of the terminal for the battery significantly, as shown in pic.198.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 126
Place the components of the power supply as shown in pic.199. To have the possibility to disconnect
the arduino and the later coming motor driver circuits (you may have to do this for testing and
repairs!) we connect soldering nails Nr.2 to the circuit of the power supply. Make sure that the
22Kohm resistor is connected to the positive pole of the power supply and the 4,7Kohm resistor to
the negative pole. An error here will kill the ADC of your arduino! Pay attention to the correct
polarity of the electrolytic capacitor C1 and pay attention to a sufficiently thick connection between
the 2-pin terminal and the solder nails. Here a current of about 5A flows!
Now connect the arduino as shown in the schematic from pic.197 to the power supply. For now
coming tests you need to have a 20cm long, twisted cable for connecting the battery. Build it as
shown in pic.200 from plug Nr.11, and the wires Nr.12 and Nr.13.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 127
To test the circuit for the power supply load the test program "READ_VOLT_TEST" on the arduino.
Do not connect the battery to the board! Now switch on the serial monitor of your arduino IDE.
Because the battery is not connected yet, the arduino prints the voltage that comes from itself,
influenced by the voltage divider (R11 and R12). It should be about 4,4V. Now connect the battery.
The arduino should now reflect the voltage of your battery. You can check the value with the help of
a multimeter at the 2-pin terminal of the battery. Due to component tolerances of the resistors R11
and R12, it may be slightly different, but you can correct this in the sketch easily.
The analog PIN A0 is defined as an input pin for reading the battery voltage ("Voltpin") and it is a
float variable defined, in which the measured value at PIN A0 is written into ("float voltage"). In the
main program the following happens: The measured voltage on “Voltpin” PIN A0 is written to the
variable “voltage”. This value is multiplied by a factor of 0.02756. With this the digital value of the
arduino's ADC is converted to an analog voltage value. This factor also considers the voltage divider
R11 and R12. By changing this factor you can correct the influence of the tolerances of your voltage
divider. At the end of the main program the voltage value is printed ... .it comes a delay of 500ms and
the loop starts from the beginning.
// READ_VOLT_TEST
// Read sensors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 128
// Status LEDs
// Status LEDs
Before we connect the motors in the next chapter, we need to ensure that they are only activated
when a battery is connected to the board. If this is not the case, the motor would get his power from
the voltage regulator of the arduino .This cannot stand such a big load! This safety circuit is
incorporated in the next test sketch. In addition, this program takes over the "battery management"
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 129
of our robotic lawn mower. It switches it off when the battery voltage drops below a defined
permitted minimum voltage, to prevent a deep charging of the battery.
Upload the sketch "STOP_FUNCTION_TEST" on the arduino. Connect a fully charged battery to the
board and start the serial monitor of your arduino IDE (this sequence is important here!). The green
LED should now be switched on (=> battery voltage OK). In very quick succession (10ms) your arduino
prints the numbers 0 to 9. The program calculates the average value of 10 measurements of the
battery voltage (to prevent that individual measured voltage spikes cut off the robotic lawn mower,
even though the battery is still fully charged). Thereafter, the arduino prints the average battery
voltage ... .and the loop start from the beginning. If you remove the battery from the circuit board
now, the green LED goes off and the red LED starts to flash. The arduino prints the message "Low
Battery". Also connecting the battery again does not change anything. If the battery power drops
below the defined permitted minimum voltage this program will switch off the robotic lawn mower.
A float variable “Voltvalue” was defined to take over the calculated average battery voltage. A float
variable “Voltlow” was defined. This variable is the permitted minimum voltage value. In this case
this is 10 Volt. This is a suitable value for NiMH and LiPO Batteries. An int variable “I” was defined.
This serves as a loop-counter for calculating the average volt value. An int variable “I_bat” was
defined. This serves as a status variable for the condition of our battery, full or empty. Just at the
beginning we set this to 20. This gives the information that the battery if full charged. If this value is <
10 it means that the battery is empty (we will come to this later). And for the first time we use a
function “void Stop(){}”.
The main program: First the green status LED is switched On. After this the program goes into a loop,
measures the battery voltage 10 times, calculates the average voltage value and prints this. Then it
compares the average volt value “Voltvalue” with the permitted minimum voltage value “Voltlow”. If
“Voltvalue” < “Voltlow” the status “I_bat” is set to 1 (this means the battery is empty). In this case
the program jumps to the function “void Stop{}”.
The function “void Stop()”: First the green status LED is switched Off. A “While-loop” is used to
toggle the red status LED and to print the message “Low Battery”, till the battery is disconnected
(and the USB cable is disconnected from the arduino).
// STOP_FUNCTION_TEST
// Read sensors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 130
// Status LED
floatVoltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Status LEDs
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 131
}
/////////FUNCTIONS///////////
digitalWrite(Ledbat, HIGH);
delay(100);
digitalWrite(Ledbat, LOW);
delay(500);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 132
4.3.2.5 Connecting the motor board
Warning: If you have connected motor electronics to the arduino, you should not load up to the
arduino the previous sketches. The reason is as follows: In the previous sketches pins to which the
motor electronic is connected, were not yet defined. Undefined pins may be unstable. This means
that you never know what they are doing. This may cause damage to the electronics, but also it may
cause a sudden start of the motor and this may cause personal injury. If you want to use previous
sketches you have to disconnect the motor electronics from the power supply of the board!
As motor board we use a board with an L298N motor driver IC. This board can power 2 motors with a
max. driving current of 2A each, making it ideal for our application. On the market there are various
types for these boards. Unfortunately, these do not have exact type designations. This means you
have to identify it with the help of pictures. But this is very easy, since the various boards are visually
very different. The images 201 and 202 show the board that we use. The easiest procurement
channel is EBAY. Use the Ebay search and look for the keywords:
You will find a lot of deals worldwide. The price varies between 3 to 8 €. With the stated keywords
you will also find provider and onlineshops with the help of “google” and “amazon”. One provider is
www.satistronics.com. Of course you can also use other board types. But then also the schematic
diagram will possibly be different (for this you should have electronics experience) and the mounting
holes of the template Nr.1 must also be customized.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 133
Pic.203 shows the schematic for connecting the motor board. There are the power pins +/- for the
supply voltage and 3 pins for each of the two motors we want to control. The EN-pins are used to
control the speed of the motors with a PWM-signal. The IN-pins we use to control the direction of
rotation as we switch them HIGH or LOW.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 134
Pic.203
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 135
Before you can connect the mother board we have to prepare this as shown in pic.204. Pull the
jumper from the ENA and ENB pins. Cut appropriate contacts of the socket terminal strip Nr.69 (from
parts list 3.1.2) and place it on the pin strip of the motor board. Now you can solder the wires to the
contacts.
Screw the motor board to the breadboard and connect it as shown in the schematic from pic.203.
Pic.205 shows the connected motor board.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 136
Install the controller board on the chassis and connect the motors to the motor board as shown in
pic.203. You don’t have to take care about the polarity of the motors. We come to this later (Pic.206).
Connect the arduino to the PC. The 12V battery should not be connected yet. Upload the sketch
"DRIVE_MOTOR_TEST" on the arduino. After uploading the program the red status LED should
toggle immediately because no battery is connected. Disconnect now the arduino from the USB cable
and put your robotic lawn mower on the floor. If you now connect the 12V battery your robotic lawn
mower will start driving. The aim is that it drives straight forward, i.e. both wheels should rotate
forward. If one, or even both wheels rotate in reverse you need to exchange the connecting cables of
the respective motor at the terminal of the motor board.
The pins 9 and 10 of the arduino are defined as PWM output pins for controlling the rotation speed
of the motors („Driveleft“, „Driveright“). Two this pins the variables „Drivespeedleft“ and
„Drivespeedright“ belong. We write the desired PWM values into these variables and the named pins
give these out as pulses. These values may be between 0…and 255. 0 means lowest power (motor
off) and 255 means maximum power, so the full battery voltage.
In the test sketch the PWM value is set to 255. This value is well tested for operating the mower and I
recommend staying with this. The pins 5, 6, 7 and 8 are defined as digital output pins to control the
direction of rotation of the two motors. And we have a new function “void forward() {}”.
The main program: First the voltage is measured. If this is higher than 10V the program jumps to the
function “void forward()”.
The Function void forward(): In this function the IN-pins are set to drive both motors forward and
the PWM pins („Driveleft“, „Driveright“) are set to 255 („Drivespeedleft“, „Drivespeedright“).
The function void Stop(): This function was modified this way that both motors will be switched off
when the battery voltage is low.
Note: As said before the variables „Drivespeedleft“ and „Drivespeedright“ define the driving speed
of our mower and the maximum value of 255 is well suited for operating it. But we can also use these
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 137
variables to correct the steering of the robotic lawn mower. Because of different friction in the gears
the motors may have a different rotation speed and then the mover drives a curve. You can correct
this by modifying the PWM values of the motors.
// DRIVE_MOTOR_TEST
// Read sensors
// Status LED
floatVoltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Drive motors
int Driveright = 10; // Define PIN 10 for right Motor PWM output
int Drivespeedleft = 255; // Define variable for left motor speed and set PWM value
int Drivespeedright = 255; // Define variable for right motor speed and set PWM value
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 138
void setup() { // Setup
// Status LEDs
// Drive motors
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 139
Serial.println(" "); // Print nothing as a linefeed
/////////FUNCTIONS///////////
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(Ledbat, HIGH);
delay(100);
digitalWrite(Ledbat, LOW);
delay(500);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 140
digitalWrite(IN3,LOW); // Switch PIN IN3 LOW
If your robotic lawn mower travels forward after this test, you should mark the connections of the
motor cables to the motor board to have it easy if you want to remove the cables and connect them
again later. Now you should also stabilize the capacitor C1 with a few drops of hot melt glue. This
protects it from vibrations (Pic.207).
For lawn mowing our mower needs not only to move forward. It must also be able to reverse, as well
as perform left and right turns. We will realize this with the next sketch ”DRIVE_TEST_COMPLETE".
There are 2 new variables "Turntime" and "I_Ramp". The left and right turns are controlled by time.
The time value is calculated by a random and written to the variable "Turntime". As our drive motors
have a strong gear reduction quick starts of the motors cause a heavy load on the small gears in the
transmission. For this reason we start the motor via a so-called. "Ramp". This means that the voltage
of the motor is increased gradually when starting. A "soft start". This operation is performed in a
simple loop in which the PWM value of the motors is incremented by "1". The variable "I Ramp" is
the counter variable for this loop.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 141
And we have 3 new functions: „backward()“, „Turnleft()“ and „Turnright()“. These functions control
reverse drive and the turns.
The function „backward()“: First, the IN pins are switched to reverse. Then the PWM value of both
engines gradually increases (the "ramp"). After the ramp the PWM values of both engines are set to
the specified value ("Drivespeedleft" and "Drivespeedright"). The following break "delay (1000)"
specifies the time which our mover is driving backwards. The value of 1000ms works well. Then both
motors are switched to zero to stop. At the end of this function the program jumps back to the main
program.
The function „Turnleft()“: First the IN pins are switched to "turn left", so that the right wheel rotates
forwards, the left one backwards. Then both motors are accelerated with a ramp. Then, in a random
generator ("random"), a period is computed between 100ms and 1500ms (these values have proved
themselves in practice). This is the time that our mower will carry out the turn and then shut down
the engines again. Later we use the turns if one of the sensors has detected the BWF. After the turn,
the sensor values are reset to "0". Now the IN pins are again switched to driving forward and the
motors are accelerated via a ramp.
The function „Turnright()“: This function works similar to the function “Turnleft()”, just with the
difference that it controls the mowers right-turns.
Upload the sketch "DRIVE_TEST_COMPLETE" on the arduino and unplug the USB cable. Connect the
battery to the board. The main program now controls the following sequence: The robotic lawn
mower is going forward for 2seconds. Then it goes backwards for 1 second and makes a left turn.
After this it goes forward for 2 seconds and makes a right turn. After this the program starts from the
beginning.
// DRIVE_TEST_COMPLETE
// Read sensors
// Status LED
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 142
float Volt; // Define variable for voltage
float Voltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Drive motors
int Driveright = 10; // Define PIN 10 for right Motor PWM output
int Drivespeedleft = 255; // Define variable for left motor speed and set PWM value
int Drivespeedright = 255; // Define variable for right motor speed and set PWM value
int Turntime; // Define variable for the time the mower has to turn
// Status LEDs
// Drive motors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 143
pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 144
/////////FUNCTIONS///////////
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(Ledbat, HIGH);
delay(100);
digitalWrite(Ledbat, LOW);
delay(500);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 145
analogWrite(Driveleft, Drivespeedleft); // Set PWM-value for left motor
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 146
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
delay(Turntime);
delay(250);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 147
void Turnright() { // Turn right
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
delay(Turntime);
delay(250);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 148
delay(5);
Your robotic lawn mower now has all the driving functions it needs for lawn mowing. It only needs to
use these functions at the right time, when the sensors tell him that he approaches the BWF. That's
what happens in the next sketch "DRIVE_WITH_SENSORS". Set up a little “test ground” with your
transmitter and a small BWF as shown in pic.208. A square of 3 x 3 m is big enough. Upload the
sketch "DRIVE_WITH_SENSOR" on the arduino and unplug the USB cable. Place the Mower in the
center of the BWF and connect the battery to the board. The Mower must now go forward to the
BWF, stop, reverse, turn and go on. If you have a laptop you can watch the sensor values with a long
USB cable via the serial monitor. This is also a good method for debugging. At any point of the sketch
you can place print-commands that help you to monitor the work of your robotic lawn mower.
There are 2 new variables, “Sensemaxleft” and “Sensemaxright”. These are the thresholds values for
our sensors. If one of your sensor signals (“Sensevalueleft”, “Sensevalueright”) is higher than the
associated threshold value, the mower knows that it is close to the BWF. It will stop, go back and
turn. A well tested value for “Sensemaxleft” and “Sensemaxright” is “4”.
The main program: First, the green status LED is switched on again and the battery voltage is
checked. If the battery is sufficiently charged it goes on and the sensors are read. First, the left sensor
value ("Sensevalueleft") is compared with the associated threshold ("Sensemaxleft"). If the sensor
value is higher than the threshold (because the sensor has come close to the BWF), both motors are
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 149
switched off and the program jumps to the function "backward ()", that controls the mower to go
backwards for 1 second. Next the program jumps to the function "Turn Right ()". This controls the
mower to make a right turn and it sets both sensor values to “0”. Because both sensor values are “0”
now, the main program jumps to the function "forward ()". The mower now will drive forward till it
comes close to the BWF and so on, till the battery voltage drops below 10V. In this case the main
program will jump to the function „Stop()“. This will switch the off the green status LED and the
motors and it will toggle the red status LED.
// DRIVE_WITH_SENSORS
// Read sensors
int Sensemaxleft = 4; // Define variable for max sensorvalue left and set default
int Sensemaxright = 4; // Define variable for max sensorvalue right and set default
// Status LED
float Voltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Drive motors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 150
int IN3 = 6; // Define PIN 6 for left Motor IN3
int Driveright = 10; // Define PIN 10 for right Motor PWM output
int Drivespeedleft = 255; // Define variable for left motor speed and set PWM value
int Drivespeedright = 255; // Define variable for right motor speed and set PWM value
int Turntime; // Define variable for the time the mower has to turn
// Status LEDs
// Drive motors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 151
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
// Read sensors
Serial.print("Left = ");
Serial.println(Sensevalueleft);
Serial.print("Right = ");
Serial.println(Sensevalueright);
Serial.println(" ");
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnright();
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 152
}
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnleft();
// Go forward
forward();
delay(200);
/////////FUNCTIONS///////////
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(Ledbat, HIGH);
delay(100);
digitalWrite(Ledbat, LOW);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 153
delay(500);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 154
delay(250); // Give the mower some time to stop
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
delay(Turntime);
delay(250);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 155
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
delay(Turntime);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 156
Sensevalueright = 0; // Set right sensor-value back to zero
delay(250);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
If you operate an automatic lawnmower in your garden, you normally ensure that you don’t leave
any obstacle on your lawn. Normally, however…not always. To make sure that our mower does not
get any damages and goes on with working if it encounters an obstacle, it has collision detection. This
works quite simple. The result of a collision is that the drive motors have to take a higher load. This
causes an increase of the motor current. Our arduino measures the current of both drive motors. If
the current is higher than normal it will stop the mower and let it turn around to drive around the
obstacle.
Our motor board uses a L298N as a motor driver IC. At the pins 1 and 15 of this IC you can measure
the current for both motors. On most available boards this function is not provided and these pins
are connected to the GND line. But this is not a problem for us. Remove the motor board from the
controller board, cut both pins short above the breadboard and bend them up slightly, so that they
do not have contact to the GND (Pic.209).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 157
Solder two flex wires with a length of about 10 cm to the pins 1 and 15 as shown in pic.210. Than
install the motor board on the controller board again.
Pic.211 shows the schematic diagram for the collision detection. Pin A1 of your arduino measures the
current of the left drive motor at pin 15 of the L298N. Pin A2 measures the current of the right motor
at pin 1 of the L298N.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 158
Pic.211
Solder the resistors R1…R5 and R6…R10 onto the breadboard as shown in pic.212. To connect this
circuit with arduino, motor board and power supply we use soldering nails again (Pic.213.)
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 159
Install the controller board on the chassis again. You should jack your mower now for testing the
collision control. Otherwise your mower will drive away and doesn’t give you the chance for testing
(Pic.214).
Connect your arduino with the PC and load up the sketch „Collision_Conrol“. When the upload is
completed the red status LED will start to flash. This is correct, because the 12 V battery is not
connected yet. Now connect the battery with the controller board. The red status LED goes on with
flashing because you program stays in the “Stop()” function. Now start the serial monitor of your
arduino IDE. This resets your arduino and the main program starts his work. The motors start to
rotate and the digital values of the motors current are shown on the serial monitor. After this the
sensor values are shown. Depending on the friction of the gearbox and of component tolerances, the
values for the motor currents should vary between 10 and 40. Please make a note of these values, as
you need them for a later testing!
Now try to stop one of the wheels with your hands slightly. The associated value will increase. Try to
stop the wheel harder. If the associated value overshoots the defined threshold value
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 160
(„Drivemaxleft=215“ or „Drivemaxright=215“), both motors will stop, turn backwards and make a
turn. Then both motors will rotate forward again. This is how the mower drives around an obstacle.
Make the same test with the other wheel.
Note: There are no changes at the functions. Because of this these are not printed here. If you want
to look at the whole sketch, please use your arduino IDE for this.
The procedure for programming is identical to the sensors (please compare).Two analog pins of the
arduino are defined as input pins for reading the motor currents and two variables are defined to
take over the values. Two threshold values are defined to compare these with. As threshold values
“215” was tested and works fine. But because of component tolerances you may have to modify
these, if necessary.
In the main program first the green status LED is switched on and the battery voltage is checked.
Then we come to the “collision control”. The digital values of the motor current are read and
compared with the associated threshold values. If one of the motor current is higher than the
threshold the program jumps to the function „backward()“ and after this to the function „Turnleft()“
or „Turnright()“. After this the main program goes on with reading the sensor values.
// Collision_Control
// Read sensors
int Sensemaxleft = 4; // Define variable for max sensorvalue left and set default
int Sensemaxright = 4; // Define variable for max sensorvalue right and set default
// Status LED
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 161
float Volt; // Define variable for voltage
float Voltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Drive motors
int Driveright = 10; // Define PIN 10 for right Motor PWM output
int Drivespeedleft = 255; // Define variable for left motor speed and set PWM value
int Drivespeedright = 255; // Define variable for right motor speed and set PWM value
int Turntime; // Define variable for the time the mower has to turn
// Collision control
int Drivemaxleft = 215; // Define variable for max motor current left and set default
int Drivemaxright = 215; // Define variable for max motor current right and set default
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 162
Serial.begin(9600); // Start the serial communication
// Status LEDs
// Drive motors
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
//Collision control
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 163
Drivesenseright = analogRead(Drivepinright); // Read right motor current
Serial.println(Drivesenseleft);
Serial.println(Drivesenseright);
backward() ;
Turnright();
backward() ;
Turnleft();
// Read sensors
Serial.print("Left = ");
Serial.println(Sensevalueleft);
Serial.print("Right = ");
Serial.println(Sensevalueright);
Serial.println(" ");
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnright();
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 164
if (Sensevalueright > Sensemaxright) { // Compare right sensor
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnleft();
// Go forward
forward();
delay(200);
Place your robotic lawn mower on the lawn and let it drive against an obstacle. If necessary you have
to modify the threshold values. On smooth floor it may happen that the wheels are slipping before
the "Collision control" reacts, that’s why you should perform this test on your lawn.
Warning: If you have connected the motor driver for the cutter motor to the arduino, you should not
load up to the arduino the previous sketches. The reason is as follows: In the previous sketches pins
to which the motor driver is connected were not yet defined. Undefined pins may be unstable. This
means that you never know what they are doing. This may cause damage to the electronics, but also
it may cause a sudden start of the cutter motor and this may cause personal injury. If you want to use
previous sketches you have to disconnect the motor driver from the power supply of the board!
As our cutter motor must rotate in one direction only to drive the cutter disc, we here do not need a
motor board. The motor driver circuit consists of only three electronic components. A MOS-FET T1,
the resistor R15 and the schottky diode D1. Pic.215 shows the circuit diagram for the motor driver.
The arduino generates a PWM signal at pin 11 which is applied to the gate of the MOSFET T1. The
resistor R15 between gate and source of T1 ensures that the gate is set to LOW when the arduino
gives no HIGH signal. The schottky diode D1 serves as a protection diode against inductive voltage
spikes.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 165
Pic.215
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 166
The cutter motor is critical and may cause EMC-problems. Therefore it is important to place this
circuit far away from all sensor wires and close to the capacitor C1. Pic.216 shows how to connect
the BUZZ11 (T1).
Because the connecting wires of the schottky diode are pretty thick the best way is to solder it to
soldering nails. The BUZZ11 don’t needs a heat sink because we power it with a very low power. Also
a heavy heat sink may cause vibration problems to the connecting wires.
The connecting terminal for the cutter motor was already soldered to the breadboard before. Mark
the right connecting terminal with a “+”-symbol and connect it with the “+” -terminal of the power
supply (Pic.217).
Place T1, D1 and R15 as close to the terminal and to the capacitor C1 as possible. The connections for
the gate and source of T1 you should make with soldering nails. This enables you to disconnect the
motor driver from the controller board. This can sometimes be handy for troubleshooting, or if you
want to upload previous sketches for testing or repair (Pic.218).
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 167
Use the wires Nr.12 and Nr.13 for making a twisted connecting cable for the cutter motor and
connect it as shown in pic.219. Connect the red wire to the “+”-terminal. If the motor turns the
wrong way when testing later we will change the wires at the motor soldering contacts.
Screw the electronic housing with two screws to the base palte as shown in pic.220. This make it easy
to handle the mower for the next tests, because you can just turn it upside down.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 168
Mark the right direction of rotation on the cutter disc and unscrew the cutter blades. You should not
underestimate the risk of injury (I know what I'm talking about !!!!). Read the warnings from chapter
1.1 of this construction manual!
Turn the mower upside down. Make sure that you can see the status LEDs for the coming tests
(Pic.222)
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 169
To avoid damage to your electronics because of construction errors, stay with the here described
sequence for the next tests and stay close to the instructions! Upload the sketch
"CUTTER_MOTOR_TEST" to the arduino and unplug the USB cable. Now connect the battery to the
board. The green status LED should light up, and then you hear for about 3sec. a noise from the
cutter motor. The noise comes from a very low PWM signal (Cutterspeed = 10) that powers the
motor at the beginning. It’s not enough power to make the motor spinning, but enough to make a
little noise (you hear the PWM pulses). After this noise the motor must begin spinning for 3 seconds,
because it gets a higher PWM signal (Cutterspeed = 50). After this the main program goes on….the
wheels start spinning. If the cutter motor speeds up at the beginning, without making a noise before
for 3 seconds, disconnect the battery quickly. There must be an error in the construction that has to
be fixed! If you don’t disconnect your battery quickly this may destroy your electronics. Watch the
direction of rotation of the cutter disc. If it turns wrong way, change the wires at the motor.
If this test was successful we have to check, that the cutter motor doesn’t cause EMC-problems to
the sensors. We will do this with the same sketch that is still on your arduino.
Connect your arduino with the PC first. Then connect the battery with the controller board. Now
start the serial monitor of your arduino IDE. This gives a reset to the arduino. First you will hear the
noise from the cutter motor again, then it starts spinning and the wheels start to rotate. On your
monitor you can now watch the values for the drive motor currents and the sensor values. The
values for the drive motor values should be in the range it was when you did the „Collision_Control“
testing. The values for the sensors should be between 0 and 3. If the values differ from this you
should have a close look to your construction. The cutter motor influences your sensors! Look for the
error and fix it. Are all motor cables well twisted? Now power or PWM wire crosses the sensor wires?
Check the capacitor C1 (polarity, function). Do the same with the diode D1.
Pin 11 of the arduino is named “Cutter” and is so defined as PWM-Output pin. The associated
variable “Cutterspeed” was defined. “Cutterspeed” holds the PWM value that is defined by us. This
variable is set to “0” at the very beginning and it must stay “0” here! Otherwise your MOS-FET T1 will
be destroyed! The variable “I_Start” was defined and set to “0” at the beginning of the program. This
variable serves as status variable for calling the new function “Start()”. The “Start()” function is only
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 170
called once to speed up the cutter motor before the drive wheels start to rotate. After this the status
variable “I-Start” is set to “20” in the “Start()” function. This avoids that this function is called a
second time. Furthermore the “Stop()” function was enlarged to switch of the cutter motor by
setting the PWM value “Cutterspeed” to “0”.
The main program also changed: First the battery voltage is checked. Is it below 10V the program
jumps to the “Stop()” function and the cutter motor will be switched off. Is the battery voltage fine
the program checks the status variable “I_Start”. Because this is set to “0” the program jumps to the
“Start()” function. In the “Start()” function the red status LED is switched off and the green one is
switched on. Then the PWM value for the cutter motor is set to 10 for 3 seconds (this only makes
noise). After this the PWM value is set to “50” (the cutter motor speeds up) and the status variable
“I_Start” is set to “20”, to avoid that the main program jumps to the “Start()” function a second time.
After this the program jumps back to the main program….and it goes on with collision control.
Not all functions are printed here. Only the ones that were modified. If you want to have a look at
the whole program, please use your arduino IDE for this.
// CUTTER_MOTOR_TEST
// Read sensors
int Sensemaxleft = 4; // Define variable for max sensorvalue left and set default
int Sensemaxright = 4; // Define variable for max sensorvalue right and set default
// Status LED
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 171
float Voltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Drive motors
int Driveright = 10; // Define PIN 10 for right Motor PWM output
int Drivespeedleft = 255; // Define variable for left motor speed and set PWM value
int Drivespeedright = 255; // Define variable for right motor speed and set PWM value
int Turntime; // Define variable for the time the mower has to turn
// Collision control
int Drivemaxleft = 215; // Define variable for max motor current left and set default
int Drivemaxright = 215; // Define variable for max motor current right and set default
// Cutter motor
int Cutterspeed = 0; // Define variable for Cutterspeed PWM value (must be "0" here!
int Cutter = 11; // Define PIN 11 for cutter motor PWM output
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 172
int I_Start = 0; // Define variable for entering "Start()" function
// Status LEDs
// Drive motors
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 173
}
Start();
//Collision_ control
Serial.println(Drivesenseleft);
Serial.println(Drivesenseright);
backward() ;
Turnright();
backward() ;
Turnleft();
// Read sensors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 174
Sensevalueleft = analogRead(Sensepinleft); // Read left sensor
Serial.println(Sensevalueleft);
Serial.println(Sensevalueright);
Serial.println(" ");
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnright();
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnleft();
// Go forward
forward();
delay(200);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 175
/////////FUNCTIONS///////////
void Start() {
delay(500);
analogWrite(Cutter, Cutterspeed);
delay(3000);
analogWrite(Cutter, Cutterspeed);
delay(3000);
I_Start = 20; // Set I_Start to a high value for not entering this function again
analogWrite(Cutter, Cutterspeed);
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 176
{
digitalWrite(Ledbat, HIGH);
delay(100);
digitalWrite(Ledbat, LOW);
delay(500);
The sketch CUTTER_MOTOR_TEST already has the whole functionality your robotic lawn mower
needs for his work. In the „FINAL_ MOWER_SKETCH” only slightly modifications were made. These
modifications affect the “Start()” function only. Because of this only the modified “Start()” function is
printed here. If you want to look at the whole sketch, please use your arduino IDE. To give you a
“hard-copy “ of the „FINAL_ MOWER_SKETCH” it is printed as an appendix to this construction
manual.
Here are the modifications that were made to the “Start()” function: The PWM value “10” was
deleted. We only needed this for testing the cutter motor. Furthermore the setting of all default
settings is repeated in the “Start()” function. These default setting you need to adjust your mower.
These were already defined in the beginning of the sketch with values I personally use for my garden.
But for sure you will play around with these settings to optimize them for your demands. So now you
have all default settings close together in the “Start()” function. This is very handy. Because the
“Start()” function is called every time at the beginning of the sketch, the program takes the settings
from here to control your mower. And if you are not happy with your own settings you can copy the
ones I use from the beginning of the sketch to the “Start()” function.
//FINAL_ MOWER_SKETCH
void Start() {
delay(500);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 177
//Default Settings
analogWrite(Cutter, Cutterspeed);
delay(3000);
I_Start = 20; // Set I_Start to a high value for not entering this function again
Note: Modifications at the default settings should only be done in the „Start()“ function. Only the
values from the „Start()“ function will be used for controlling the mower!
Sensemaxleft ,Sensemaxright:
These are the threshold values for the sensors. If the sensor values are higher than the thresholds
the mower thinks he is close to the BWF. It will stop and turn. Never use values < 2, because EMC
influence of the motors cannot be eliminated completely. The value “4” works well with my mowers.
Drivemaxleft, Drivemaxright:
These are the threshold values for the drive motor current. You need them for collision control. If the
current of one of the motors is higher than the associated threshold, the mower thinks that it
stroked an obstacle. It will stop and turn. These thresholds have to be adjusted depending to your
lawn. If your garden is hilly you will need higher values than on a flat lawn, because the motor
current is higher when your mower hast to drive up a hill. My lawn is a little bit hilly and a default
setting of “215” is fine for this. Make changes in small steps only when modifying.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 178
Drivespeedleft, Drivespeedright:
These settings control the drive speed of your mower. Because the gears of the drive motors have a
very high transmission ratio you can use the highest value “255”. If your mower does not drive
straight but in a slight curve you can use these settings to correct this. Just slow down the faster
wheel.
Voltlow:
This is the threshold for the battery voltage. If the voltage drops below this value the mower is
switched off. I use “10” here for NiMH and for LiPO batteries. Check the manual of your batteries for
recommendations.
Cutterspeed:
This setting controls the power of your cutter motor and it depends on the quality of your lawn. A
short and soft lawn needs a value of about “35”. If it is grown long and if there is a lot of weed in the
lawn you may need the highest value “50”. You have to test this.
In the beginning of the sketch the value for “Cutterspeed” is set to “0”. Leave this always like it is. If
you change the setting of “Cutterspeed” at this position you risk damage to your electronics!
Modifications should only be done in the “Start()”function!
A value of “50” should not be exceeded. The design of the motor hub Nr.12 does not stand higher
loads than this. If you set “Cutterspeed” to higher values than “50” the cutter disc may come off the
mower and it may cause bad injuries or death. Read the warnings chapter 1.1 of this construction
manual!
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 179
Make the twisted(!) connecting wires from the plugs Nr.11 and wires Nr.12 and Nr.13. To connect
the wires to the switch use the automotive connectors Nr.18 (Pic.224).
There are some slots in the base plate to guide the wires for connecting the batteries and to fix them
with cable ties. Depending on the length of the cables of your batteries the cables should look out of
the base plate with a length of about 5 to 10 cm (Pic.225).
Nearly ready…Pic.226
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 180
There is one part left: The „Hook“ Nr.29 from parts list 3.1.1. The robotic lawn mower is balanced
that the front wheel only carries a very little load. If the mower operates in hilly areas this may cause
that he flips over to the rear. The hook avoids this. Install the hook as shown in pic.227 and pic.228.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 181
Ready….Pic.229.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 182
If you want to guide the BWF around an “island”, for example a tree, do it as shown in pic.231. Also
take a look at pic.4 of this construction manual.
The BWF was teted up to a length of 430m, without any loss of power. So for sure you can realize a
much longer BWF.
As said at the beginning of this construction manual, the robotic lawn mower was developed to keep
a lawn on a certain length. For cutting a long grown lawn short it has not enough power. Adjust the
front wheel so that the cutter disc is at the same hight as the tips of the lawn. Bend the sensor
mounts so that the bottoms of the sensor housings just touch the tips of lawn (Pic.232). Switch on
the transmitter and the robotic lawn mower.
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 183
Watch your mower. If necessary modify the default settings as described in 4.3.2.8.
7. Troubleschooting
All technical things sometimes may have errors….and these may have different reasons. To help you
with troubleshooting I will describe here the errors that occurred during the operation of my mowers
within 6 years and how to fix them.
- The BWF is grown deep into the ground. I had this error after 3 years. The BWF engrosses
every year a little bit more. If it is too deep in the ground the signal of the transmitter is not
strong enough, especially if the lawn is wet. Pull the BWF out of the ground and pin it on the
top of the lawn again.
- The grass just behind the BWF is grown too high. It lifts the front of the mower. The distance
between sensors and BWF it to wide than. Cut the grass that is close behind the BWF short.
- Check the mounting screws of motor hub and cutter motor. May be they became loose.
Error: The mower stops and turns, without being close to the BWF
When this error occurs your mower assume that either a threshold value for the sensors or a
threshold value for the motor currents is exceeded. The easiest way to-troubleshoot is to connect
your arduino with a long USB cable to a laptop and to use the serial monitor of your arduino IDE to
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 184
monitor your mower. This way you can see whether the error is caused by the sensors or by the
motors.
- Dirt or humidity penetrated into the sensor housings. Dry, clean and seal them.
- The capacitor C1 from the controller board is broken. Electrolytic capacitors have a limited
life expectancy. Check and replace it.
- An increased gear friction shows such errors. Often dirt or humidity penetrated in the gears
and causes this error. But also the motors and gears have a limited life expectancy and may
be exhausted. Replace motors and gears.
Error: The robotic lawn mower runs not straight (although he did so to the beginning), but slight
curves. The turning radius is getting smaller with time until the mower only runs close circles.
- An increased gear friction shows such errors. Often dirt or humidity penetrated in the gears
and causes this error. But also the motors and gears have a limited life expectancy and may
be exhausted. Replace motors and gears. Make sure to seal the gear well. Make sure that the
felt-sealings are well soaked with grease!
Error: The cutter motor no longer rotates uniform. The rotation speed is unsteady.
- The most common cause for this is that the cutting disc was blocked in operation. It may
happen then, that the MOS-FET T1 or schottky diode D1 is broken. Replace the components.
Legal disclaimer
The use of this manual and of the associated electronic records, data files and the informations
contained therein is expressly at your own risk. The author cannot take over a guarantee for the
freedom of mistake, exactness and completeness of the information and excludes any liability for any
accidents or damage of any kind arising from the use of this manual and the associated data files.
Read chapter “Warnings” carefully.
Copyright notice
This document, including all associated electronic records and data file is protected by copyright. All
rights reserved. Commercial use, reprinting, reproduction, also in an electronic way or in parts
thereof or the disclosure to third parties require the express written permission of the author. All
rights reserved for translation. © by A. Haeuser, Dezember 2015
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 185
Appendix: A „FINAL_ MOWER_SKETCH”
// FINAL_ MOWER_SKETCH
// Read sensors
int Sensemaxleft = 4; // Define variable for max sensorvalue left and set default
int Sensemaxright = 4; // Define variable for max sensorvalue right and set default
// Status LED
float Voltlow = 10; // Define variable and setup for minimum operation voltage
int I_bat = 20; // Define variable for battery status (low or high)
// Drive motors
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 186
int Driveright = 10; // Define PIN 10 for right Motor PWM output
int Drivespeedleft = 255; // Define variable for left motor speed and set PWM value
int Drivespeedright = 255; // Define variable for right motor speed and set PWM value
int Turntime; // Define variable for the time the mower has to turn
// Collision control
int Drivemaxleft = 215; // Define variable for max motor current left and set default
int Drivemaxright = 215; // Define variable for max motor current right and set default
// Cutter motor
int Cutterspeed = 0; // Define variable for Cutterspeed PWM value (must be "0" here!
int Cutter = 11; // Define PIN 11 for cutter motor PWM output
// Status LEDs
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 187
// Drive motors
Voltvalue = 0;
Volt = analogRead(Voltpin);
delay(10);
Start();
//Collision control
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 188
Serial.print("Motor current left = "); // Print
Serial.println(Drivesenseleft);
Serial.println(Drivesenseright);
backward() ;
Turnright();
backward() ;
Turnleft();
// Read sensors
Serial.println(Sensevalueleft);
Serial.println(Sensevalueright);
Serial.println(" ");
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnright();
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 189
}
analogWrite(Driveleft, 0);
analogWrite(Driveright, 0);
delay(250);
backward();
Turnleft();
// Go forward
forward();
delay(200);
/////////FUNCTIONS///////////
void Start() {
delay(500);
//Default Settings
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 190
Voltlow = 10; // Set minimum operation voltage
analogWrite(Cutter, Cutterspeed);
delay(3000);
I_Start = 20; // Set I_Start to a high value for not entering this function again
analogWrite(Cutter, Cutterspeed);
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(Ledbat, HIGH);
delay(100);
digitalWrite(Ledbat, LOW);
delay(500);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 191
}
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 192
analogWrite(Driveright, 0); // Stop motor after going backwards
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
delay(Turntime);
delay(250);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 193
// Switch IN-PINs for driving forward
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 194
}
delay(Turntime);
delay(250);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
for (I_Ramp = 0; I_Ramp < 255; I_Ramp ++) { // Counter-loop for motor ramp
analogWrite(Driveleft, I_Ramp);
analogWrite(Driveright, I_Ramp);
delay(5);
The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 195