You are on page 1of 195

The

3d-printed „Robotic lawn mower“

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 1


Preface

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

Have fun with building this project!

Andreas Haeuser
Dezember 2015

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 2


Table of contents

Preface..................................................................................................................................................... 2

Table of contents ..................................................................................................................................... 3

1. How the Robotic lawn mower works .................................................................................................. 5

1.1 Warnings........................................................................................................................................ 8

2. Advices for printing the components .................................................................................................. 8

2.1 The Printer ..................................................................................................................................... 8

2.2 The STL files ................................................................................................................................. 10

2.3 Calibration of the printer............................................................................................................. 10

2.4 Required tools ............................................................................................................................. 10

2.5 Drilling and tapping ..................................................................................................................... 11

2.6 Arduino Uno and Arduino-Motorboard ...................................................................................... 12

3. Building the chassis ........................................................................................................................... 14

3.1 Parts list chassis ........................................................................................................................... 14

3.1.1 Printed parts ......................................................................................................................... 14


3.1.2 Other parts ........................................................................................................................... 16
3.2 The base ...................................................................................................................................... 20

3.3 The drive system ......................................................................................................................... 23

3.4 The front wheel ........................................................................................................................... 33

3.5 The cutting device ....................................................................................................................... 43

3.6 The sensor housings .................................................................................................................... 53

3.7 Batteries and battery holder ....................................................................................................... 57

3.8 The electronic housing ................................................................................................................ 63

3.9 The cover ..................................................................................................................................... 76

4. Building the electronics ..................................................................................................................... 81

4.1 The transmitter............................................................................................................................ 81

4.1.1 Parts list Transmitter ................................................................................................................ 83

4.1.1.1 Printed parts ...................................................................................................................... 83

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 3


4.1.1.2 Other parts ........................................................................................................................ 83
4.1.2 The housing .......................................................................................................................... 86
4.1.3 The electronics ..................................................................................................................... 88
4.2 The sensors .................................................................................................................................. 97

4.2.1 Parts lists sensors ................................................................................................................. 99


4.2.1.1 Printed parts ...................................................................................................................... 99
4.2.1.2 Other parts ........................................................................................................................ 99
4.2.2 Building the sensors ........................................................................................................... 101
4.3 The controller board.................................................................................................................. 111

4.3.1 Parts list controller board ................................................................................................... 113


4.3.1.1 Printed parts .................................................................................................................... 113
4.3.1.2 Other parts ...................................................................................................................... 113
4.3.2 Building the controller board ............................................................................................. 115
4.3.2.1 The breadboard ............................................................................................................... 115
4.3.2.2 Connecting the sensors ................................................................................................... 119
4.3.2.3 Connecting the status LEDs ............................................................................................. 122
4.3.2.4 Building the power supply ............................................................................................... 126
4.3.2.5 Connecting the motor board ........................................................................................... 133
4.3.2.6 Collision control .............................................................................................................. 157
4.3.2.7 The motor driver for the cutter motor ........................................................................... 165
4.3.2.8 The final robotic lawn mower sketch ............................................................................. 177
4.3.2.9 Final work ....................................................................................................................... 179
5. Placing the boundary wire fence BWF ............................................................................................ 182

6. Operating the robotic lawn mower ................................................................................................. 183

7. Troubleschooting ............................................................................................................................. 184

Legal disclaimer ................................................................................................................................... 185

Copyright notice .................................................................................................................................. 185

Appendix: A „FINAL_ MOWER_SKETCH” ............................................................................................. 186

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 4


1. How the robotic lawn mower works
The idea behind the robotic lawn mower is not to cut a long grown lawn short, but to keep a lawn to
a length it has. Depending on the size of the lawn it has to drive every day to cut the overnight grown
lawn continuously. It moves randomly. It is running straight until it comes to a boundary wire fence.
It turns around randomly and drives off again until it encounters the boundary wire fence again….and
so on. How long and how often the mower has to drive to get a beautifully manicured lawn depends
on many factors. As a guide I can describe my garden, which serves as a test facility for over 6 years:

- Lawn size about 500 square meters

- Central european climate. The grass grows well (but not fertilized!) and has to be mowed 7
months a year

- The lawn is wavy (about 0.3m in altitude)

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 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 5


Our robotic lawn mower moves in the space of a so-called “boundary wire fence (BWF)” that is laid
out on the lawn. In the front of the mower 2 sensor coils are mounted on each side. These sensors
detect when our mower comes close to the boundary wire fence and sends a signal to the arduino,
which ensures that the mower stops and rotates (Pic.2).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 6


The lawn is cut by two little cutter blades, screwed to a printed disc that is driven by a little DC-motor
(Pic.5).

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 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 7


1.1 Warnings
Read chapter “Legal disclaimer” in addition to these “Warnings”. Construction and operation of the
robotic lawn mower described in this construction manual may cause significant hazards! Electronic
circuits can heat up and cause serious injuries and fires. The gear motors have a high reduction ratio
and develop a substantial force, which may cause bruising or even fractures. The cutter disc has two
very sharp cutter blades that may cause severe injuries! Keep yourself out of the rotation plane of
the cutter disc when building, testing and operating the robotic lawn mower or parts of him. Always
wear suitable protective goggles. Do never look under the mower during operation to watch how it
cuts the lawn. Cutter disc or cutter blades may come off the mower and cause injuries or death!

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

2. Advices for printing the components


2.1 The Printer
In general, any conventional 3D printer can be used, which has a build volume of at least 180mm x
180mm x 60mm (x, y, z). Only 1 extruder is needed. The recommended nozzle size is 0.35mm to
0.5mm. Support material is only required for one part (Electronic housing Nr.14). As support material
we use the same filament as we use for printing the part, PLA. As material you need ABS and PLA. In
the parts list for the printed parts it is indicated which material is recommended for that component.
Some parts have to be printed from ABS because of high temperature loads. If one would use PLA
here, the parts would deform because of the temperature load during operation of the mower and
this may destroy it. However, the parts that are recommended to be made from PLA can also be
manufactured from ABS. I personally prefer PLA for components with low temperature loads,
because of a higher rigidity and less warpage.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 8


Picture 6 shows a Prusa I3 from the author. An inexpensive kit printer. For the construction of our
robotic lawn mower perfectly adequate.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 9


from the print bed and they will be absolutely warpage-free. The here recommended temperatures
may vary depending on the material manufacturer and on your oven.

2.2 The STL files


All STL-data file, provided with this construction manual are ready prepared, aligned and tested. The
files each contain only one component, even if more than one is needed. In the parts list you will find
all important information for printing. The number of needed components and the quantity of
filament that is approximate required. If you observe this information, printing the components
should not be difficult.

2.3 Calibration of the printer


The calibration of the printer? In the early days of 3D printers anyone who had built and operated
one, knew what this means. As mentioned earlier more and more “ready to use printer” enter the
market nowadays. Some of them are already well calibrated, but some are not. If we print a cylinder
with a diameter of 100mm and a height of 100mm, then it should really have this size if we measure
it. And if you print a 90° angle, then this should also be 90° and not 85°. The angularity between the
Z-axis and the XY plane is important and should be well calibrated. On a printed length of 100mm an
accuracy of +/- 0.2mm even with the kit printers of the first generation is not a problem if you
calibrate your printer well.

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.

2.4 Required tools


In addition to a 3D printer and the needed filament for printing the parts only a few tools and
resources are needed. These are mainly common hobbyist tools, such as screwdrivers, small files,
some pliers, a soldering iron, a coping saw with metal blade, try-square, a cutter knife and a ruler, a
few drills with different diameters, a countersink, and a M3 and a M4 tap. If the printer is calibrated
well, a small cordless drill is fine, since all the holes are pre-printed and just need to be reworked
with a drill. For building the motor hub Nr.14 from part list 3.1.1 I highly recommend the use of a drill
stand for drilling the center bore. This avoids wobbling of the cutter disc.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 10


straight (!) piece of plywood, 200 x 50 x 10mm in size. On one side sandpaper grit 120 and on the
other side sandpaper grit 240, glued with double side adhesive tape to the plywood.

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.

2.5 Drilling and tapping


Since we have to do a lot of drilling and tapping when building the robotic lawn mower I want to give
a few tips here. If you are already experienced with the construction of 3D printed projects you may
not need these informations. For those who are not these informations may be helpful.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 11


There are two kinds of taps. The one that is shown left side in picture 8 enables you to make the
thread with a single cut. If you work with the ones shown on the right side, you have to make 3 cuts. I
prefer the ones I only have to do one single cut. These tools also have the advantage that they are
longer, means you can cut deeper threads.

2.6 Arduino Uno and Arduino-Motorboard


The Arduino Uno is established as a universal control board worldwide. The low price, high
functionality as well as the large number of additional boards (shields) makes it the first choice for
small to medium sized robot projects. We use the arduino uno board together with a motor board,
which powers the drive motors of our robotic lawn mower. The combination of the arduino uno and
the motor board reduces electronic works to a minimum. This robotic lawn mower-project has no
high degree of difficulty in terms of electronics and programming. Beginner skills are however
required. If you have never worked with an arduino, you should start now. You will see that it is very
simple, a lot of fun and it offers a lot of new possibilities for your projects. I recommend not buying a
big book about arduino. This is totally unnecessary. It makes you think you should have to know the
knowledge that is written on hundreds of pages. As a basis for the construction of the robotic lawn
mower I recommend a simple "Arduino beginners tutorial". You will find lots of very good ones in the
internet, for free. After working for a few hours with such tutorials you will have the necessary basic
knowledge for building the robotic lawn mower. During the construction you will learn some more,
because:

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 12


Important Remark:

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.

Arduino and Arduino-Motorboard

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 13


3. Building the chassis
This construction manual was splitted in building the chassis and in building the electronics to make
it easy to build. Of course, you can build both sections parallel. This is even useful, since parts with
long printing times must be made during the construction of the chassis. This time you can make
good use of if you build parallel the electronics.

3.1 Parts list chassis


3.1.1 Printed parts
Print all parts from the parts list. I recommend using material- and printing-information’s from the
parts list for good results. Deflash and clean all parts.

Nr Picture Filename Quanti Material Note


German ty weight
Englisch

1 Grundplatte_VL.STL 1 PLA 80% Infill


(vorne links) 114 gr.
Base_FL.STL

2 Grundplatte_VR.STL 1 PLA 80% Infill


(vorne rechts 114gr.
Base_FR.STL

3 Grundplatte_HL.STL 1 PLA 80% Infill


(hinten links) 130gr.

Base_RL.STL
4 Grundplatte_HR.STL 1 PLA 80% Infill
(hinten rechts) 132gr.
Base_RR.STL

5 Antriebsflansch.STL 2 PLA / ABS 80% Infill


Drive mount.STL 47 gr.

6 Antriebsrad.STL 2 PLA 80% Infill


Drive wheel.STL 93 gr.

7 Radnabe.STL 2 PLA / ABS 80% Infill


Wheel hub.STL 27 gr.

6 Radgabel links.STL 1 PLA / ABS 80% Infill


Wheel fork left.STL 7 gr.

7 Radgabel rechts.STL 1 PLA / ABS 80% Infill


Wheel fork right.STL
7 gr.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 14


8 Vorderradflansch.STL 1 PLA 80% Infill
Front wheel mount.STL 18 gr.

9 Vorderrad.STL 1 PLA / ABS 80% Infill


Front wheel .STL 8 gr.

10 Lagernabe.STL 2 PLA 80% Infill


Bearing hub .STL 1 gr.

11 Motorflansch.STL 1 ABS ABS because of


Motor mount.STL 21 gr. temperature
80% Infill

12 Motornabe.STL 1 ABS ABS because of


Motor hub .STL 7 gr. temperature
80% Infill
13 Messerscheibe.STL 1 PLA 80% Infill
Cutter disc.STL 40 gr.

14 Elektronikgehäuse.STL 1 PLA / ABS PLA as support material


Electronic housing.STL 104 gr. Rectilinear 1,5mm / 45°
80% Infill

15 Gehäuseboden.STL 1 PLA / ABS 80% Infill


Housing baseplate.STL 65 gr.

16 Gehäusedeckel.STL 1 PLA / ABS 80% Infill


Housing top.STL 59 gr.

17 USB-Deckel.STL 1 PLA / ABS 80% Infill


USB-cap.STL 2 gr.

18 Magnethalter.STL 1 PLA / ABS 80% Infill


Magnet mount.STL 5 gr.

19 Magnethalterplatte.STL 1 PLA / ABS 80% Infill


Magnet mountplate.STL 2 gr.

20 Scharnier.STL 4 PLA / ABS 80% Infill


Hinge.STL 8 gr.

20 Scharnierplatte.STL 2 PLA / ABS 80% Infill


a Hinge plate.STL 2 gr.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 15


21 Sensorgehäuse links.STL 1 PLA / ABS 80% Infill
Sensor housing left.STL 38 gr.

22 Gehäusedeckel links.STL 1 PLA / ABS 80% Infill


Housing top left.STL 33 gr.

23 Sensorgehäuse 1 PLA / ABS 80% Infill


rechts.STL 38gr.
Sensor housing right.STL

24 Gehäusedeckel 1 PLA / ABS 80% Infill


rechts.STL 33 gr.
Housing top right.STL

25 LiPo Halter hinten.STL 2 PLA / ABS 80% Infill


LiPo mount front.STL 17 gr.

26 LiPo Halter vorne.STL 2 PLA / ABS 80% Infill


LiPo mount rear.STL 18 gr.

27 NiMH Halter hinten.STL 2 PLA / ABS 80% Infill


NiMH mount front.STL 16 gr.

28 NiMH Halter vorne.STL 2 PLA / ABS 80% Infill


NiMH mount rear.STL 20 gr.

29 Haken.STL 1 PLA / ABS 80% Infill


Hook.STL 20 gr.

3.1.2 Other parts

Nr. Picture Material Quantity Note


Describtion Source of supply
30 Cylinder head screw 36 DIY market, onlineshops
M3 x 16mm ebay

31 Nut M3 39 DIY market, onlineshops


ebay

32 Washer (big diameter) 94 DIY market, onlineshops


M3 (d=3,2mm D=9mm) ebay

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 16


33 Flex wire red 0,5mm² 1m Electronic shops, DIY market,
onlineshops
ebay

34 Flex wire blue 0,5mm² 1m Electronic shops, DIY market,


onlineshops
ebay

35 Cylinder head screw 3 DIY market, onlineshops


M4 x 25mm ebay

36 Cylinder head screw 6 DIY market, onlineshops


M4 x 12mm ebay

37 Counter sunk screw 13 DIY market, onlineshops


M3 x 8mm ebay

38 Geared DC motor RB35 2 www.conrad.de


Modelcraft Part Nr.: 227579-89
Transmission 1:200 !!! EAN: 4016138092929
Onlineshops, Ebay.
Search google: Modelcraft RB35
1:200
39 Felt 4mm thick 1 DIY market, onlineshops
50mm x 100mm ebay

40 Cylinder head screw 8 DIY market, onlineshops


M3 x 16mm ebay

41 Washer (big diameter) 21 DIY market, onlineshops


M4 (d=4,3mm D=12mm) ebay

42 Cylinder head screw 4 DIY market, onlineshops


M3 x 30mm ebay

43 Hex socket head screw 1 DIY market, onlineshops


M4 x 60mm ebay

44 Ball bearing 10x26x8mm 1 www.sturm-praezision.de


6000-2RS-NI This must be a very well sealed
bearing!

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 17


45 Washer (big diameter) 1 DIY market, onlineshops
M4 (d=4,3mm D=20mm) ebay

46 Self locking nut M4 1 DIY market, onlineshops


ebay

47 Nut M4 14 DIY market, onlineshops


ebay

48 Hex socket head screw 1 DIY market, onlineshops


M4 x 30mm ebay

49 Counter sunk screw 2 DIY market, onlineshops


M3 x 6mm ebay

50 Cylinder head screw 4 DIY market, onlineshops


M3 x 6mm ebay

51 Cutter blade 2 DIY market, onlineshops


B = 9mm ebay
T = 0,5mm

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

54 Cylinder head screw 22 DIY market, onlineshops


M3 x 10mm ebay

55 Sensor mount 2 DIY market, onlineshops


Aluminium profile ebay
b=15mm, t=2mm
L=171mm
56 Cylinder head screw 18 DIY market, onlineshops
M3 x 12mm ebay

57 foam rubber t = 2mm 1 DIY market, onlineshops,


50mm x 100mm modeler shops, amazon
ebay

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 18


58 Rechargeable NiMH- 2 www.reichelt.com
battery Part Nr. XR10 4500
12V 4500mAh Modeler shops, Onlineshops,
Ebay,
59 Rechargeable LiPO- 2 Modeler shops, Onlineshops,
Battery Ebay,
3S/11,1V 5000mAh Search ebay for:
Hacker TopFuel LiPo 11,1V 20C-
ECO-X 5000mAh 3S

60 LiPO-Battery charger 2 www.hobby3000.de


EK2-0851 Modeler shops, Onlineshops,
Ebay,

61 12V NiMH- Battery 2 www.Voelkner.de


charger Part Nr.: Y492741
Ansmann Modeler shops, Onlineshops,
Steckerladergerät ACS110 ebay,
1001-0023

62 Washer (big diameter) 1 DIY market, onlineshops, ebay


M4
D = 20mm, d = 4,3mm

63 Flynet 1 DIY market, onlineshops,


50mm x 100mm amazon, ebay

64 Flex wire 0,14mm² 1 Electronic shops, Onlineshops,


blue and red Ebay
L = 240mm

65 Automotive switch 1 Car shops , electronic shops,


12V/10A onlineshops, Ebay

66 LED Installation socket 2 www.reichelt.com


3mm Reichelt Part Nr.:
EBF I-3 S

67 LED red 3mm 1 www.reichelt.com


Reichelt Part Nr.:
LED 3MM ST RT

68 LED green 3mm 1 www.reichelt.com


Reichelt Part Nr.:
LED 3MM ST GN

69 Socket terminal strip 1 www.reichelt.com


2,54mm Reichelt Part Nr.:
MPE 115-1-036

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 19


70 Polycarbonat 1 www.conrad.de
330 x 440 x 0,75- 1mm Part Nr.: 229802
DIY market, onlineshops
ebay, modeler shops
71 Neodymium magnet 1 www.supermagnete.de
10 x 5mm onlineshops, Ebay

72 Selflocking nut M3 2 DIY market, onlineshops


ebay

73 Spray paint 1 DIY market, onlineshops


150ml ebay

3.2 The base


The base is made from parts Nr.1 to Nr.4. The shortcuts in the file names _FL, _FR, _RL and _RR mean
_Front Left, _Front Right, _Rear Left ans _Rear Right.

Drill the hexagons in the front to 4,2mm, as shown in pic.9.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 20


Drill all 3mm hexagons to 3,2mm as shown in pic.10.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 21


Screw the 4 parts of the base together, as shown in pic.12.

Drill the 4 preprinted tapping holes to 2,5mm. Cut a M3 thread in all 4 holes, as shon in pic. 13.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 22


Drill the 3mm hexagons at part Nr.4 to 3,2mm (Pic.14).

3.3 The drive system

The robotic lawn mower has 2 drives. They consist of the parts shown in pic.15.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 23


Drill all preprinted holes of the two drive mounts Nr.5 to 3,2mm, as shown in pic.16.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 24


Put some grease on the mounting surface of the motors. This avoids that dust and humidity goes
through the thread holes into the gear (Pic.19).

Screw the motors to the drive mounts as shown in Pic.20.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 25


Screw the drive mounts to the base as shown in pic.21 and pic.22.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 26


Solder about 50cm of the wires Nr.33 and Nr.34 to the motors. Blue wire to - pole, red to +pole. Keep
the wires close to the motors! There will be not a lot of space between the wires and the cutter
blades of the cutter disc (Pic.23).

Twist the wires to avoid EMC problems. We will power the motors with PWM (pulses). For this we
need twisted wires! (Pic.24).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 27


Deburr the 5mm bores and guide the wires through these (Pic.25).

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 28


Drill the preprinted holes of the wheel hubs Nr.7 to 3,3mm and cut a M4 thread in (Pic.28).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 29


Drill the center holes of the wheel hubs to 6mm (Pic.29).

Screw a screw Nr.35 in each wheel hub (Pic.30).

Screw the wheel hubs to the drive wheels as shown in pic.31.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 30


Dust and humidity can go into the gear along the gear axis. For this reason we have to seal this area
well! Cut two discs from felt Nr.39. Outer diameter should be 40mm, the inner one 6mm. The best
tool for making make the 6mm hole is a punch (Pic.32).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 31


Push the sealings on the motor axis. When placing the wheels on the axis, make sure that the screws
Nr.35 are aligned with the flattening on the axis (Pic.35)!

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 32


Press the Wheels against the sealings with some force and fasten the screws (Pic.36 and pic.37).

3.4 The front wheel


The front wheel consist of the parts shown in pic.38.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 33


Grind the wheel forks Nr.6 and Nr.7 as shown in pic.39:

Drill the 4 holes shown in pic.40 to 3mm. Don’t use grease for drilling. We will glue these parts
together later!

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 34


Screw the wheel forks together as shown in pic.41. After this drill the other both holes to 3mm
(Pic.41).

Put the other two 3mm screws into the wheel fork and fasten them. Now drill the 4mm holes as
shown in pic.42.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 35


Disassemble the wheel fork. Put glue on both parts of the wheel fork and on the screw Nr.43.
Assemble the fork again as shown in pic.43 and pic.44. „Uhu Plus Endfest 300“ is a very good glue for
this.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 36


When the glue is hardened you should cut the screws and file them smooth (Pic.45 and pic.46).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 37


Roughen the inside of the front wheel Nr.9 with sandpaper and degrease the outer side of the ball
bearing Nr.44 with alcohol or acetone. Check that the ball bearing fits into the front wheel (Pic.47).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 38


Install the front wheel using the screw Nr.35 and nut Nr.47. Secure the nut with a drop of superglue
(Pic.51).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 39


Drill the hole in the front wheel mount Nr.8 to 4,2mm, as shown in Pic.52.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 40


Check that the front wheel mount can be clamped very strongly using screw Nr. 48, nut Nr.47 and
two washers Nr.41. This is important for getting a well-functioning cutting height adjustment (Pic.54).

Install the front wheel as shown in pic.55. Put some grease on the fork axis.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 41


Now install the front wheel assembly into the base as shown in pic.56.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 42


3.5 The cutting device

The cutting device is made from the parts shown in pic.57.

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 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 43


Install the motor Nr.52 with two screws Nr.49. Install the three silent blocks Nr.53 as shown in pic.60.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 44


Make the same with the 4 bores on the outer surface of the motor hub (Pic.62).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 45


Screw all screws into the threads as shown in pic.64. Put some grease on the threads of the screws.
After this you have to unscrew the screws Nr.54.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 46


Push the motor hub on the motor axis as shown in pic.66.

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 47


Install the assembly as shown in pic.68 and pic.69.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 48


Drill the outer bores of the cutter disc Nr.13 to 3mm (Pic.70).

Drill the inner bores of the cutter disc to 3mm (Pic.71).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 49


Screw the screws Nr.50 and nuts Nr.31 to the cutter disc, as shown in pic.72.

Break the cutter blades Nr.51 to a length of 35mm as shown in pic.73.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 50


Install the cutter blades as shown in pic.74 and pic.75.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 51


Now screw the cutter disc to the motor hub as shown in pic.76. Check by spinning the cutter disc,
that the cutter blades don’t strike other parts and that the cutter disc 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!

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 52


3.6 The sensor housings
The two sensor housings are made from the parts, shown in pic.77.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 53


Drill in each housing top 3 x 2,5mm tapping holes and cut M3 threads in (Pic.80).

Drill in each housing top 2 x 2,5mm tapping holes and cut M3 threads in (Pic.81).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 54


Screw in each housing top 2x screws Nr.54. We use these screws for installing the sensor
breadboards later (Pic.82).

Screw sensor housings and housing tops together, using scews Nr.54 and washers Nr.32 (Pic.83).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 55


Screw the sensor mounts to the sensor tops as shown in pic.84.

Screw the sensor mounts to the base as shown in pic.85 and pic.86.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 56


3.7 Batteries and battery holder
Lead-acid batteries, NiMH batteries and LiPo batteries were tested. The most important factor for
choosing is the weight. Lead-acid batteries are very inexpensive, but also very heavy! For this reason,
these batteries are not a good choise. Our robotic lawn mower must carry the weight of the batteries
and that costs a lot of energy! We need the energy of the batteries for lawn mowing and not for
carrying their own weight. In addition high weight reduces the service life of our drive motors. NiMH
batteries and Li-Po batteries are a good choice, because of high capacity and low weight.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 57


longer (Pic.87). The longer life time of LiPo batteries is another argument to choose these, especially
since the price nowadays no longer differs from NiMH batteries.

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 58


Drill the tapping holes to 2,5mm and cut a M3 thread in as shown in pic.90.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 59


Use superglue for gluing the strips to the battery mounts as shown in pic.92.

Pic.93 shows, where to screw the battery mounts.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 60


Pic. 94 shows the mower with installed NiMH battery mounts.

Pic.95 shows where to screw the different kinds of battery mounts with screws Nr.56 and washers
Nr.32.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 61


Pic. 96 shows the mower with NiMH batteries.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 62


3.8 The electronic housing
The electronic housing is made from the parts shown in pic.97.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 63


Countersink the bore of the washer Nr.62 this way that the head of the screw Nr.37 is flush with the
washers surface (Pic.100).

Screw the washer to the housing top as shown in pic.101.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 64


Drill the preprinted bores of the housing base plate to 3,5mm (Pic.102).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 65


If the screws do not have a tight fit you should glue them with some superglue (Pic.104).

Drill the lower bores of the electronic housing Nr.14 to 3,5mm (Pic.105).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 66


Place the electronic housing onto the base plate and screw both parts together as shown in pic.106.

Use a file to rework the hexagon on the front of the housing to make it fit for the switch Nr.65
(Pic.107).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 67


Glue a strip of fly net on the ventilation opening of the housing, as shown in pic.108. Take the switch
out for this work.

When the glue is hardened you can install the switch in again (Pic.109).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 68


Drill both preprinted countersinks at the USB-opening to 2,5mm and cut a M3 thread in there
(Pic.110).

Screw the USB-cap Nr.17 to the housing as shown in pic.111.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 69


Drill the preprinted tapping holes in the housing to 2,5mm and cut a M3 thread in (Pic.112).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 70


Now you have to build two LED-wires as shown in pic.113 and pic.114. Cut 2 times two pairs of
contacts from the socket terminal strip Nr.69. Use a sharp cutter knife for this. Take care of the
polarity of the LEDs. Isolate the soldered points with some heat shrink tube. Be careful. The LED
installation sockets are a little bit tricky. Do not just push the LEDs in. This may cause a short circuit.
You have to disassemble the LED sockets as shown in pic.113a.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 71


Drill the preprinted countersinks on the backside of the housing stepwise to 6mm. Use grease for
drilling, to make sure that drilling goes smooth and that the drill does not hook into the material and
splits the printed layers (Pic.115).

Install the LED-wires as shown in pic.116.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 72


Screw the housing top to the electronic housing as shown in pic.117.

Disassemble the base plate and install the three silent blocks Nr.53 as shown in pic.118 and pic.119.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 73


Install the base plate as shown in pic.120 and pic.121.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 74


Screw the electronic housing to the base plate (Pic.122). Looks nice, what do you think?

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 75


3.9 The cover
The cover is made from the parts that are shown in pic.123.

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 76


Install the hinges as shown in pic.126.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 77


Glue the magnet Nr.71 with some superglue into the magnet mount Nr.18 (Pic.127).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 78


Now click the magnet mount onto the washer on the top of the electronic housing. Align the cover to
the mowers base. Mark the tapping holes of the hinges on the polycarbonate cover and drill these
marks to 3,5mm (Pic.130).

Screw the cover and the hinge plates Nr.20a to the hinges as shown in pic.131.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 79


Clean the side of the polycarbonate which later faces inwards with alcohol and paint it with spray
paint (Pic132). I strongly recommend to paint the cover in a bright color. If you do not paint it acts as
a greenhouse and the roboter underneath will be heated up extremely in the summer, which may
cause thermal damage to the PLA-components. Dark paint is also not recommended because it also
gets very hot in sunlight. As the paint on the polycarbonate does not well adheres the inside of the
cover should be painted. On the outside the paint will be scratched when the mower works under
low bushes.

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 80


4. Building the electronics
The electronics has 4 assemblies:

4.1 The transmitter


4.2 The sensors
4.3 The controller board

Each assembly has its own parts list.

4.1 The transmitter


The transmitter generates a frequency of 7,812 KHz and powers the boundary wire fence with this.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 81


The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 82
4.1.1 Parts list Transmitter
4.1.1.1 Printed parts
Print all parts from the parts list. I recommend using material- and printing-information’s from the
parts list for good results. Deflash and clean all parts.

Nr Picture Filename Quanti Material Note


German ty weight
Englisch

1 Sendergehäuse.STL 1 PLA 80% Infill


Transmitter housing.STL 55 gr.

2 Sender 1 PLA 80% Infill


Gehäusedeckel.STL 23 gr.
Transmitter top.STL

3 Sender 1 PLA 80% Infill


Platinenschablone.STL 9 gr.
Transmitter circuit
board template.STL

4.1.1.2 Other parts

Nr. Picture Material Quantity Note


Describtion Source of supply
4 Fly net 1 DIY markets,
20mm x 90mm Online shops,
Ebay

5 LED Installation socket 1 www.reichelt.com


3mm Reichelt Part Nr.:
EBF I-3 S

6 panel jack, 4 mm, fully 2 www.reichelt.com


insulated, blue Reichelt Part Nr.:
BIL 20 BL

7 Panel-mounted coupler, 1 www.reichelt.com


front mounting, pin Ø Reichelt Part Nr.:
2.35 mm LUM 1614-10

8 Flex wire 0,14mm² 1 DIY markets, electronic shops,


Blue and red Online shops, Ebay
L = 100mm

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 83


9 Cylinderhead screw 6 DIY markets,
M3 x 6mm Online shops,
Ebay

10 220V plug-in power 1 www.reichelt.com


supply unit,12 V, 1000 Reichelt Part Nr.:
mA, 2.5mm connector SNT 1000 12V 2,5

11 4-mm bunch plug, blue 2 www.reichelt.com


Reichelt Part Nr.:
BUELA 20K BL

12 Clip-on heat sink for 2 www.reichelt.com


housing TO-220, 21K/W Reichelt Part Nr.:
V CK 633

13 Flex wire red 0,5mm² 1 DIY markets, electronic shops,


L = 20 cm Online shops, Ebay

14 Flex wire blue 0,5mm² 1 DIY markets, electronic shops,


L = 20 cm Online shops, Ebay

15 IC socket, 16-pin 1 www.reichelt.com


Reichelt Part Nr.:
GS 16

16 Flex wire 2,5mm² Depends DIY markets, electronic shops,


on how Online shops, Ebay
long your
BWF will
be
17 Soldering pins, 1 mm 6 www.reichelt.com
Reichelt Part Nr.:
RTM 1-100

18 Breadboard, laminated 1 www.reichelt.com


paper, 160x100 mm Reichelt Part Nr.:
H25PR160

19 2-pin terminal strip, 2 www.reichelt.com


spacing 5.0/lift Reichelt Part Nr.:
AKL 012-02

20 Welding wire Depends DIY markets,


D = 2mm, L= 150mm on how Online shops, Ebay
long your
BWF will
be

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 84


LED1 LED, 3 mm, standard, 1 www.reichelt.com
green Reichelt Part Nr.:
LED 3MM ST GN

S1 Toggle switch, 1-pin, 6 A - 1 www.reichelt.com


125 V AC, on-on Reichelt Part Nr.:
MS 500A

VR1 7805 1 www.reichelt.com


Voltage regulator, 1.5-A Reichelt Part Nr.:
positive, TO-220 µA 7805

Qz1 Quarz 4 MHz 1 www.reichelt.com


Standard quartz, basic Reichelt Part Nr.:
tone, 4.0 MHz 4.0000-HC18

R1 Metal film resistor 1 www.reichelt.com


1.00 mOhm, 1% Reichelt Part Nr.:
METALL 1,00M

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

R4 17-watt wirewound 1 www.reichelt.com


resistor Reichelt Part Nr.:
22 Ohm 17W AXIAL 22

C1 Ceramic capacitor, 500 V, 2 www.reichelt.com


C2 22 P Reichelt Part Nr.:
KERKO-500 22P

C3 Ceramic capacitor 100 N 2 www.reichelt.com


C4 Reichelt Part Nr.:
KERKO 100N

C5 Electrolytic capacitor, 10 x 1 www.reichelt.com


20 mm, spacing 5.0 mm Reichelt Part Nr.:
470μF / 35V RAD 470/35

C6 Electrolytic capacitor, 1 www.reichelt.com


12.5 x 25 mm, spacing 5.0 Reichelt Part Nr.:
mm RAD 1.000/35
1000μF / 35V
T1 BD139 1 www.reichelt.com
NPN TO-126 transistor 80 Reichelt Part Nr.:
V 1.5 A 8 W BD 139 STM

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 85


IC1 74HC4060 N 1 www.reichelt.com
14 LEVEL BINARY Reichelt Part Nr.:
COUNTER 74HC 4060

4.1.2 The housing


Glue a strip of fly net Nr.4 on the ventilation openings of the transmitter top Nr.2 (Pic.135).

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 86


Build a 100mm long LED-wire as shown in pic.138. Take care about the polarity of the LED (take a
look at pic.114).

Install all parts as shown in pic.139. We will use the screws Nr.9 for installing the breadboard later
on.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 87


Screw the transmitter top to the transmitter housing as shown in pic.140.

4.1.3 The electronics


Take some pieces of two sided adhesive tape and put them on the backside of the transmitter circuit
board template Nr.3. Then stick it to the breadboard (Pic.141 and pic.142). Make sure that the
template has a firm grip to the breadboard to ensure that it does not slip when you do the drilling.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 88


The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 89
Mark the slots and the outline of the template as shown in pic.143.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 90


Take the template from the breadboard and cut this to size (Pic.145).

Check that the breadboard fits into the housing (Pic.146).

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 91


After placing the big components you should clip the heat sinks Nr.12 on voltage regulator and on
the transistor and check that everything fits well into the housing (Pic.149).

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 92


If everything fits well you can finish the circuit. When ready you can connect the resistor R4 (Pic.150).

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 93


Connect all parts to the circuit. But do not connect the BWF (Pic.152). Switch power on. The green
LED should light now. Between pin 8 and pin 16 of the IC socket you should measure a voltage of 5V.

If everything works well put the IC1 into the IC socket. Take care about the right orientation of the
IC1 (Pic.153)!

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 94


Now connect the BWF and switch power on. The resistor R4 must become very hot now. This is right!
Take care; don’t burn your fingers (Pic.154).

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 95


Now you need a boundary wire fence (BWF) that is long enough to encircle your lawn and some
hooks to pin the wire to the ground. Because you need a lot of wire it is worse to look for a good
price! I use cheap 2,5mm² speaker cables (Nr.20). I tested a BWF with a length of 430m in my garden.
It works perfectly without any loss of power, so for sure you can realize much longer BWFs.

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

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 96


4.2 The sensors
At the front the robotic lawn mower has sensors on both sides. These sensors detect the BWF when
it comes close and tell the arduino to stop and turn the mower. Pic.159 shows the schematic
diagram. It is the same for the left and for the right sensor.

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.

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 97


The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 98
4.2.1 Parts lists sensors

4.2.1.1 Printed parts


Print all parts from the parts list. I recommend using material- and printing-information’s from the
parts list for good results. Deflash and clean all parts.

Nr Picture Filename Quanti Material Note


German ty weight
Englisch

1 Sensor 1 PLA 80% Infill


Platinenschablone 6 gr.
links.STL
Sensor template left.STL
2 Sensor 1 PLA 80% Infill
Platinenschablone 6.gr.
rechts.STL
Sensor template
right.STL

4.2.1.2 Other parts

Nr. Picture Describtion Quantity Note


Source of supply
3 Soldering pins, 1 mm 6 www.reichelt.com
Reichelt Part Nr.:
RTM 1-100

4 Breadboard, laminated 1 www.reichelt.com


paper, 160x100 mm Reichelt Part Nr.:
H25PR160

5 IC socket, 8-pin 2 www.reichelt.com


Reichelt Part Nr.:
GS 8

6 50-pin header, angled, 1 www.reichelt.com


pitch 2.54 Reichelt Part Nr.:
SL 1X50W 2,54

7 Twisted 3 wire cable 1m DIY markets, electronic shops,


0,14mm² Online shops, Ebay

8 Arduino Uno 1 www.reichelt.com


Reichelt Part Nr.:
ARDUINO UNO
Ebay

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 99


L1, Stationary inductor, 09P, 4 www.reichelt.com
L2 8.2 mH Reichelt Part Nr.:
Manufacturer: FASTRON 09P 8,2M

D1, Schottky diode 4 www.reichelt.com


D2 1N 5819 Reichelt Part Nr.:
1N 5819

IC 1 LM 358 2 www.reichelt.com
Operational amplifier, Reichelt Part Nr.:
dual, DIP-8 LM 358 DIP

C6, Ceramic capacitor 47 N 4 www.reichelt.com


C7 Reichelt Part Nr.:
KERKO 47N

C4, Ceramic capacitor, 500 V, 4 www.reichelt.com


C5 4.7 N Reichelt Part Nr.:
KERKO-500 4,7N

C1 Radial electrolytic 2 www.reichelt.com


capacitor, 105°C, low ESR, Reichelt Part Nr.:
spacing 3.5 mm RAD FR 100/35
100μF / 35V
C2 Ceramic capacitor 100 N 4 www.reichelt.com
C3 Reichelt Part Nr.:
KERKO 100N

R1 Metal film resistor 2 www.reichelt.com


470 kOhm, 1% Reichelt Part Nr.:
METALL 470K

R2 Metal film resistor 2 www.reichelt.com


100 kOhm, 1% Reichelt Part Nr.:
METALL 100K

R3 Metal film resistor 2 www.reichelt.com


10.0 kOhm, 1% Reichelt Part Nr.:
METALL 10,0K

R4, Metal film resistor 8 www.reichelt.com


R5, 1.00 mOhm, 1% Reichelt Part Nr.:
R6, METALL 1,00M
R7

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.

2) Mark the outline and the slots.

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.166 shows the finished sensor breadboards, ready for testing.

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

int Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable forsensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

void setup() { // Setup

// Print

Serial.begin(9600); //Start the serial communication

void loop() { // Start main programm

// Read sensors

Sensevalueleft = analogRead(Sensepinleft); // Read left sensor

Sensevalueright = analogRead(Sensepinright); // Read right sensor

Serial.print("Left = "); // Print

Serial.println(Sensevalueleft); // Print sensorvalue left

Serial.print("Right = "); // Print

Serial.println(Sensevalueright); // Print sensorvalue right

Serial.println(" "); // Print

delay(500); // Wait 500ms

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.

Repeat this test with the side-coil as shown in pic.172.

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

4.3.1.1 Printed parts


Print all parts from the parts list. I recommend using material- and printing-information’s from the
parts list for good results. Deflash and clean all parts.

Nr Picture Filename Quanti Material Note


German ty Weight
Englisch

1 Platinenschablone.STL 1 PLA 80% Infill


Board template.STL 29 gr.

4.3.1.2 Other parts


Nr. Picture Describtion Quantity Note
Source of supply
2 Soldering pins, 1 mm 13 www.reichelt.com
Reichelt Part Nr.:
RTM 1-100

3 Breadboard, laminated 1 www.reichelt.com


paper, 160x100 mm Reichelt Part Nr.:
H25PR160

4 L298N Dual H Bridge 1 www.satistronics.com

Search Ebay or Google for:


L298N DC Stepper Motor
Driver Module Dual H Bridge

5 Spacers, metal, 6-edge, 11 www.reichelt.com


M3, 10 mm Reichelt Part Nr.:
DA 10MM

6 Nut M3 11 DIY markets,


Online shops, Ebay

7 Cylinderhead screw 11 DIY markets,


M3 x 6mm Online shops, Ebay

8 Washer (big diameter) 4 DIY markets,


M3 (d=3,2mm D=9mm) Online shops, Ebay

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

10 3-pin terminal strip, 2 www.reichelt.com


spacing 5.0/lift Reichelt Part Nr.:
AKL 012-03

11 Tamia Stecker 2 www.xxl-modellbau.de


Männchen Modeler shops
Ebay

12 Flex wire red 0,5mm² 1m DIY markets, electronic shops,


Online shops, Ebay

13 Flex wire blue 0,5mm² 1m DIY markets, electronic shops,


Online shops, Ebay

14 Flex wire red 0,14mm² 50cm DIY markets, electronic shops,


Online shops, Ebay

15 Flex wire blue 0,14mm² 50cm DIY markets, electronic shops,


Online shops, Ebay

16 Flex wire yellow 0,14mm² 50cm DIY markets, electronic shops,


Online shops, Ebay

17 50-pin header, straight, 1 www.reichelt.com


pitch 2.54 Reichelt Part Nr.:
SL 1X50G 2,54

18 Automotiv connector 2 Car shops,


female Onlineshops, Ebay

R1……. Metal oxide resistor 1 W, 10 www.reichelt.com


…R10 5%, 10 Ohm Reichelt Part Nr.:
1W 10

R11 Metal film resistor 1 www.reichelt.com


22,0 KOhm, 1% Reichelt Part Nr.:
METALL 22,0K

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

R13 Metal film resistor 2 www.reichelt.com


R14 220 Ohm, 1% Reichelt Part Nr.:
METALL 220

R15 Metal film resistor 2 www.reichelt.com


10 KOhm, 1% Reichelt Part Nr.:
METALL 10,0K

T1 BUZ 11 1 www.reichelt.com
N-FET TO-220AB Reichelt Part Nr.:
transistor 50 V 35 A BUZ 11

C1 1000μF / 35V 1 www.reichelt.com


Electrolytic capacitor, Reichelt Part Nr.:
12.5 x 25 mm, RAD 1.000/35
spacing 5.0 mm

D1 SB 550 1 www.reichelt.com
Schottky diode, DO201, Reichelt Part Nr.:
50 V, 5 A SB 550

4.3.2 Building the controller board

4.3.2.1 The breadboard


Again we build the breadboard with the help of a printed board template Nr.1 (Pic.179):

1) Stick the template with two sided tape to the breadboard Nr.3.

2) Mark the outline and the slots.

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:

+ = RED - /GND = BLUE Signal = Yellow

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

Install the breadboard and connect the sensors (Pic.190).

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

And this is new:

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.

// STATUS LED TEST

// Read sensors

int Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

// Status LEDs

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

void loop() { // Start main programm

digitalWrite(Ledbat, LOW); // Swich red LED off

digitalWrite(Ledstart, HIGH); // Swich green LED on

delay(500);

digitalWrite(Ledbat, HIGH); // Swich red LED on

digitalWrite(Ledstart, LOW); // Swich green LED off

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.

And this is new in the sketch „READ_VOLT_TEST“:

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

int Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 128
// Status LEDs

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

float Volt; // Define variable for voltage

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

void loop() { // Start main programm

Volt = analogRead(Voltpin); // Read voltage from PIN A0

Volt = Volt * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

Serial.print(" Battery voltage = "); // Print text without linefeed

Serial.println(Volt); // Print Volt-Value with linefeed

Serial.println(" "); // Print nothing as a linefeed

delay(500); // Wait 500ms

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.

And this is new in our test sketch "STOP_FUNCTION_TEST":

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

int Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 130
// Status LED

intLedbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

Int Voltpin = 0; // Define PIN A0 for reading battery voltage

float Volt; // Define variable for voltage

floatVoltvalue; // Define variable for avarage voltage calculation

floatVoltlow = 10; // Define variable and setup for minimum operation voltage

int I; // Define variable for LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

void loop() { // Start main programm

digitalWrite(Ledstart, HIGH); // Switch green status LED ON

// Read Voltpin for 10 times and calculate average voltvalue

Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

Serial.println(I); // Print LOOP counter

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 131
}

Voltvalue = Voltvalue / 10; // calculate average value

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

Serial.print(" Battery voltage = "); // Print text without linefeed

Serial.println(Voltvalue); // Print avaragevoltvalue with linefeed

Serial.println(" "); // Print nothing as a linefeed

if (Voltvalue<Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // if battery is low go to “Stop()” function

delay(500); // Wait 500ms

/////////FUNCTIONS///////////

void Stop() { // Stop the ROBOTIC LAWN MOWER if battery is low

digitalWrite(Ledstart, LOW); // Switch green status LED OFF

while (I_bat< 10) // As long as batterystatus is low, stay here

// flash red status LED

digitalWrite(Ledbat, HIGH);

delay(100);

digitalWrite(Ledbat, LOW);

delay(500);

Serial.println("Low Battery"); // Print "Low battery" message

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:

L298N DC Stepper Motor Driver Module Dual H Bridge

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.

Motor Left Forward Backward Stop Stop

IN3 LOW HIGH HIGH HIGH

IN4 HIGH LOW LOW LOW

ENB 0…255 0…255 0…255 0…255

Motor Right Forward Backward Stop Stop

IN1 LOW HIGH HIGH HIGH

IN2 HIGH LOW LOW LOW

ENA 0…255 0…255 0…255 0…255

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.

And this is new at our test sketch "DRIVE_MOTOR_TEST":

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

int Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

// Status LED

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

float Volt; // Define variable for voltage

floatVoltvalue; // Define variable for avarage voltage calculation

floatVoltlow = 10; // Define variable and setup for minimum operation voltage

int I; // Define variable for LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

// Drive motors

int Driveleft = 9; // Define PIN 9 for left Motor PWM output

int IN3 = 6; // Define PIN 6 for left Motor IN3

int IN4 = 5; // Define PIN 5 for left Motor IN4

int Driveright = 10; // Define PIN 10 for right Motor PWM output

int IN1 = 8; // Define PIN 8 for right Motor IN1

int IN2 = 7; // Define PIN 7 for right Motor IN2

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

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

// Drive motors

pinMode(IN1, OUTPUT); // Define IN1 PIN as OUTPUT

pinMode(IN2, OUTPUT); // Define IN2 PIN as OUTPUT

pinMode(IN3, OUTPUT); // Define IN3 PIN as OUTPUT

pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT

void loop() { // Start main programm

digitalWrite(Ledstart, HIGH); // Switch green status LED ON

// Read Voltpin for 10 times and calculate average voltvalue

Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

Serial.println(I); // Print LOOP counter

Voltvalue = Voltvalue / 10;

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

Serial.print(" Voltvalue = "); // Print text without linefeed

Serial.println(Voltvalue); // Print avaragevoltvalue with linefeed

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 139
Serial.println(" "); // Print nothing as a linefeed

if (Voltvalue<Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // If battery is low go to “Stop()” function

forward(); // Go to "forward()" function

/////////FUNCTIONS///////////

void Stop() { // Stop the ROBOTIC LAWN MOWER if battery is low

analogWrite(Driveleft, 0); // Switch off left drive motor

digitalWrite(IN3,LOW);

digitalWrite(IN4,LOW);

analogWrite(Driveright, 0); // Switch off right drive motor

digitalWrite(IN1,LOW);

digitalWrite(IN2,LOW);

digitalWrite(Ledstart, LOW); // Switch green status LED OFF

while (I_bat< 10) // As long as batterystatus is low, stay here

// flash red status LED

digitalWrite(Ledbat, HIGH);

delay(100);

digitalWrite(Ledbat, LOW);

delay(500);

Serial.println("Low Battery"); // Print "Low battery" message

void forward() { // Drive forward

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 140
digitalWrite(IN3,LOW); // Switch PIN IN3 LOW

digitalWrite(IN4,HIGH); // Switch PIN IN4 HIGH

digitalWrite(IN1,LOW); // Switch PIN IN1 Low

digitalWrite(IN2,HIGH); // Switch PIN IN2 HIGH

analogWrite(Driveleft, Drivespeedleft); // Set PWM-value for left motor

analogWrite(Driveright, Drivespeedright); // Set PWM-value for right motor

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

And this is new in the test 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

int Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

// Status LED

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 142
float Volt; // Define variable for voltage

float Voltvalue; // Define variable for avarage voltage calculation

float Voltlow = 10; // Define variable and setup for minimum operation voltage

int I; // Define variable for IF-LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

// Drive motors

int Driveleft = 9; // Define PIN 9 for left Motor PWM output

int IN3 = 6; // Define PIN 6 for left Motor IN3

int IN4 = 5; // Define PIN 5 for left Motor IN4

int Driveright = 10; // Define PIN 10 for right Motor PWM output

int IN1 = 8; // Define PIN 8 for right Motor IN1

int IN2 = 7; // Define PIN 7 for right Motor IN2

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

int I_Ramp; // Define counter-variable for motor ramp

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

// Drive motors

pinMode(IN1, OUTPUT); // Define IN1 PIN as OUTPUT

pinMode(IN2, OUTPUT); // Define IN2 PIN as OUTPUT

pinMode(IN3, OUTPUT); // Define IN3 PIN as OUTPUT

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 143
pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT

void loop() { // Start main programm

digitalWrite(Ledstart, HIGH); // Switch green status LED ON

// Read Voltpin for 10 times and calculate average voltvalue

Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

Voltvalue = Voltvalue / 10;

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

if (Voltvalue < Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // If battery is low go to “Stop()” function

forward(); // Go to "forward()" function

delay(2000); // Go forward for 2000ms

backward(); // Go to "backward()" function

Turnleft(); // Go to "Turnleft()" function

forward(); // Go to "forward()" function

delay(2000); // Go forward for 2000ms

Turnright(); // Go to "Turnright()" function

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 144
/////////FUNCTIONS///////////

void Stop() { // Stop the ROBOTIC LAWN MOWER if battery is low

analogWrite(Driveleft, 0); // Switch off left drive motor

digitalWrite(IN3,LOW);

digitalWrite(IN4,LOW);

analogWrite(Driveright, 0); // Switch off right drive motor

digitalWrite(IN1,LOW);

digitalWrite(IN2,LOW);

digitalWrite(Ledstart, LOW); // Switch green status LED OFF

while (I_bat < 10) // As long as batterystatus is low, stay here

// flash red status LED

digitalWrite(Ledbat, HIGH);

delay(100);

digitalWrite(Ledbat, LOW);

delay(500);

Serial.println("Low Battery"); // Print "Low battery" message

void forward() { // Drive forward

digitalWrite(IN3,LOW); // Switch PIN IN3 LOW

digitalWrite(IN4,HIGH); // Switch PIN IN4 HIGH

digitalWrite(IN1,LOW); // Switch PIN IN1 Low

digitalWrite(IN2,HIGH); // Switch PIN IN2 HIGH

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 145
analogWrite(Driveleft, Drivespeedleft); // Set PWM-value for left motor

analogWrite(Driveright, Drivespeedright); // Set PWM-value for right motor

void backward() { // Drive backward

// Switch IN-PINs for backward drive

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

delay(1000); // The time the mower should go backwards

analogWrite(Driveleft, 0); // Stop motor after going backwards

analogWrite(Driveright, 0); // Stop motor after going backwards

delay(250); // Give the mower some time to stop

void Turnleft() { // Turn left

// Switch IN-PINs for turn left

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

Turntime = random(100, 1500); // Random for turning time

delay(Turntime);

analogWrite(Driveleft, 0); // Stop motor after turning

analogWrite(Driveright, 0); // Stop motor after turning

Sensevalueleft = 0; // Set left sensor-value back to zero

Sensevalueright = 0; // Set right sensor-value back to zero

delay(250);

// 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);

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 147
void Turnright() { // Turn right

// Switch IN-PINs for 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);

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

Turntime = random(100, 1500); // Random for turning time

delay(Turntime);

analogWrite(Driveleft, 0); // Stop motor after turning

analogWrite(Driveright, 0); // Stop motor after turning

Sensevalueleft = 0; // Set left sensor-value back to zero

Sensevalueright = 0; // Set right sensor-value back to zero

delay(250);

// 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);

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 148
delay(5);

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

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.

And this is new in the sketch „DRIVE_WITH_SENSORS“:

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 Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

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

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

float Volt; // Define variable for voltage

float Voltvalue; // Define variable for avarage voltage calculation

float Voltlow = 10; // Define variable and setup for minimum operation voltage

int I; // Define variable for IF-LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

// Drive motors

int Driveleft = 9; // Define PIN 9 for left Motor PWM output

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 150
int IN3 = 6; // Define PIN 6 for left Motor IN3

int IN4 = 5; // Define PIN 5 for left Motor IN4

int Driveright = 10; // Define PIN 10 for right Motor PWM output

int IN1 = 8; // Define PIN 8 for right Motor IN1

int IN2 = 7; // Define PIN 7 for right Motor IN2

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

int I_Ramp; // Define counter-variable for motor ramp

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

// Drive motors

pinMode(IN1, OUTPUT); // Define IN1 PIN as OUTPUT

pinMode(IN2, OUTPUT); // Define IN2 PIN as OUTPUT

pinMode(IN3, OUTPUT); // Define IN3 PIN as OUTPUT

pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT

void loop() { // Start main programm

digitalWrite(Ledstart, HIGH); // Switch green status LED ON

// Read Voltpin for 10 times and calculate average voltvalue

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 151
Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

Voltvalue = Voltvalue / 10;

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

if (Voltvalue < Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // If battery is low go to “Stop()” function

// Read sensors

Sensevalueleft = analogRead(Sensepinleft); // Read left sensor

Sensevalueright = analogRead(Sensepinright); // Read right sensor

Serial.print("Left = ");

Serial.println(Sensevalueleft);

Serial.print("Right = ");

Serial.println(Sensevalueright);

Serial.println(" ");

if (Sensevalueleft > Sensemaxleft) { //Compare left sensor

analogWrite(Driveleft, 0);

analogWrite(Driveright, 0);

delay(250);

backward();

Turnright();

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 152
}

if (Sensevalueright > Sensemaxright) { // Compare right sensor

analogWrite(Driveleft, 0);

analogWrite(Driveright, 0);

delay(250);

backward();

Turnleft();

// Go forward

forward();

delay(200);

/////////FUNCTIONS///////////

void Stop() { // Stop the ROBOTIC LAWN MOWER if battery is low

analogWrite(Driveleft, 0); // Switch off left drive motor

digitalWrite(IN3,LOW);

digitalWrite(IN4,LOW);

analogWrite(Driveright, 0); // Switch off right drive motor

digitalWrite(IN1,LOW);

digitalWrite(IN2,LOW);

digitalWrite(Ledstart, LOW); // Switch green status LED OFF

while (I_bat < 10) // As long as batterystatus is low, stay here

// flash red status LED

digitalWrite(Ledbat, HIGH);

delay(100);

digitalWrite(Ledbat, LOW);

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 153
delay(500);

Serial.println("Low Battery"); // Print "Low battery" message

void forward() { // Drive forward

digitalWrite(IN3,LOW); // Switch PIN IN3 LOW

digitalWrite(IN4,HIGH); // Switch PIN IN4 HIGH

digitalWrite(IN1,LOW); // Switch PIN IN1 Low

digitalWrite(IN2,HIGH); // Switch PIN IN2 HIGH

analogWrite(Driveleft, Drivespeedleft); // Set PWM-value for left motor

analogWrite(Driveright, Drivespeedright); // Set PWM-value for right motor

void backward() { // Drive backward

// Switch IN-PINs for backward drive

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

delay(1000); // The time the mower should go backwards

analogWrite(Driveleft, 0); // Stop motor after going backwards

analogWrite(Driveright, 0); // Stop motor after going backwards

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 154
delay(250); // Give the mower some time to stop

void Turnleft() { // Turn left

// Switch IN-PINs for turn left

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

Turntime = random(100, 1500); // Random for turning time

delay(Turntime);

analogWrite(Driveleft, 0); // Stop motor after turning

analogWrite(Driveright, 0); // Stop motor after turning

Sensevalueleft = 0; // Set left sensor-value back to zero

Sensevalueright = 0; // Set right sensor-value back to zero

delay(250);

// Switch IN-PINs for driving forward

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

void Turnright() { // Turn right

// Switch IN-PINs for 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);

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

Turntime = random(100, 1500); // Random for turning time

delay(Turntime);

analogWrite(Driveleft, 0); // Stop motor after turning

analogWrite(Driveright, 0); // Stop motor after turning

Sensevalueleft = 0; // Set left sensor-value back to zero

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 156
Sensevalueright = 0; // Set right sensor-value back to zero

delay(250);

// 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);

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

4.3.2.6 Collision control

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.

This is new in the sketch „Collision_Conrol“:

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 Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

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

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 161
float Volt; // Define variable for voltage

float Voltvalue; // Define variable for avarage voltage calculation

float Voltlow = 10; // Define variable and setup for minimum operation voltage

int I; // Define variable for IF-LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

// Drive motors

int Driveleft = 9; // Define PIN 9 for left Motor PWM output

int IN3 = 6; // Define PIN 6 for left Motor IN3

int IN4 = 5; // Define PIN 5 for left Motor IN4

int Driveright = 10; // Define PIN 10 for right Motor PWM output

int IN1 = 8; // Define PIN 8 for right Motor IN1

int IN2 = 7; // Define PIN 7 for right Motor IN2

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

int I_Ramp; // Define counter-variable for motor ramp

// Collision control

int Drivepinleft = 1; // Define PIN A1 for left motor current

int Drivepinright = 2; // Define PIN A2 for right motor current

int Drivesenseleft; // Define variable for left motor current

int Drivesenseright; // Define variable for right motor current

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

void setup() { // Setup

// Print

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 162
Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

// Drive motors

pinMode(IN1, OUTPUT); // Define IN1 PIN as OUTPUT

pinMode(IN2, OUTPUT); // Define IN2 PIN as OUTPUT

pinMode(IN3, OUTPUT); // Define IN3 PIN as OUTPUT

pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT

void loop() { // Start main programm

digitalWrite(Ledstart, HIGH); // Switch green status LED ON

// Read Voltpin for 10 times and calculate average voltvalue

Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

Voltvalue = Voltvalue / 10;

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

if (Voltvalue < Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // If battery is low go to “Stop()” function

//Collision control

Drivesenseleft = analogRead(Drivepinleft); // Read left motor current

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 163
Drivesenseright = analogRead(Drivepinright); // Read right motor current

Serial.print("Motor current left = "); // Print

Serial.println(Drivesenseleft);

Serial.print("Motor current right = ");

Serial.println(Drivesenseright);

if (Drivesenseleft > Drivemaxleft) { // Compare left motor current

backward() ;

Turnright();

if (Drivesenseright > Drivemaxright) { // Compare right motor current

backward() ;

Turnleft();

// Read sensors

Sensevalueleft = analogRead(Sensepinleft); // Read left sensor

Sensevalueright = analogRead(Sensepinright); // Read right sensor

Serial.print("Left = ");

Serial.println(Sensevalueleft);

Serial.print("Right = ");

Serial.println(Sensevalueright);

Serial.println(" ");

if (Sensevalueleft > Sensemaxleft) { // Compare left sensor

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.

4.3.2.7 The motor driver for the cutter motor

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.

And this is new in the sketch “CUTTER_MOTOR_TEST”:

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 Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

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

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

float Volt; // Define variable for voltage

float Voltvalue; // Define variable for avarage voltage calculation

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; // Define variable for IF-LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

// Drive motors

int Driveleft = 9; // Define PIN 9 for left Motor PWM output

int IN3 = 6; // Define PIN 6 for left Motor IN3

int IN4 = 5; // Define PIN 5 for left Motor IN4

int Driveright = 10; // Define PIN 10 for right Motor PWM output

int IN1 = 8; // Define PIN 8 for right Motor IN1

int IN2 = 7; // Define PIN 7 for right Motor IN2

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

int I_Ramp; // Define counter-variable for motor ramp

// Collision control

int Drivepinleft = 1; // Define PIN A1 for left motor current

int Drivepinright = 2; // Define PIN A2 for right motor current

int Drivesenseleft; // Define variable for left motor current

int Drivesenseright; // Define variable for right motor current

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

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

// Drive motors

pinMode(IN1, OUTPUT); // Define IN1 PIN as OUTPUT

pinMode(IN2, OUTPUT); // Define IN2 PIN as OUTPUT

pinMode(IN3, OUTPUT); // Define IN3 PIN as OUTPUT

pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT

void loop() { // Start main programm

// Read Voltpin for 10 times and calculate average voltvalue

Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 173
}

Voltvalue = Voltvalue / 10;

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

if (Voltvalue < Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // If battery is low go to “Stop()” function

if (I_Start < 10) { // Go to "Start()" function

Start();

//Collision_ control

Drivesenseleft = analogRead(Drivepinleft); // Read left motor current

Drivesenseright = analogRead(Drivepinright); // Read right motor current

Serial.print("Motor current left = "); // Print

Serial.println(Drivesenseleft);

Serial.print("Motor current right = ");

Serial.println(Drivesenseright);

if (Drivesenseleft > Drivemaxleft) { // Compare left motor current

backward() ;

Turnright();

if (Drivesenseright > Drivemaxright) { // Compare right motor current

backward() ;

Turnleft();

// Read sensors

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 174
Sensevalueleft = analogRead(Sensepinleft); // Read left sensor

Sensevalueright = analogRead(Sensepinright); // Read right sensor

Serial.print("Left sensor = ");

Serial.println(Sensevalueleft);

Serial.print("Right sensor = ");

Serial.println(Sensevalueright);

Serial.println(" ");

if (Sensevalueleft > Sensemaxleft) { // Compare left sensor

analogWrite(Driveleft, 0);

analogWrite(Driveright, 0);

delay(250);

backward();

Turnright();

if (Sensevalueright > Sensemaxright) { / / Compare right sensor

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

digitalWrite(Ledbat, LOW); // Switch red status-LED off

digitalWrite(Ledstart, HIGH); // Switch green status-LED on

delay(500);

Cutterspeed = 10; // Set cutterspeed = 10 (makes only noise, no spinning)

analogWrite(Cutter, Cutterspeed);

delay(3000);

Cutterspeed = 50; // Set cutterspeed = 50 (makes spinning)

analogWrite(Cutter, Cutterspeed);

delay(3000);

I_Start = 20; // Set I_Start to a high value for not entering this function again

void Stop() { // Stop the ROBOTIC LAWN MOWER if battery is low

Cutterspeed =0; // Switch off cutter motor

analogWrite(Cutter, Cutterspeed);

analogWrite(Driveleft, 0); // Switch off left drive motor

digitalWrite(IN3,LOW);

digitalWrite(IN4,LOW);

analogWrite(Driveright, 0); // Switch off right drive motor

digitalWrite(IN1,LOW);

digitalWrite(IN2,LOW);

digitalWrite(Ledstart, LOW); // Switch green status LED OFF

while (I_bat < 10) // As long as batterystatus is low, stay here

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 176
{

// flash red status LED

digitalWrite(Ledbat, HIGH);

delay(100);

digitalWrite(Ledbat, LOW);

delay(500);

Serial.println("Low Battery"); // Print "Low battery" message

4.3.2.8 The final robotic lawn mower sketch

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

digitalWrite(Ledbat, LOW); // Switch red status-LED off

digitalWrite(Ledstart, HIGH); // Switch green status-LED on

delay(500);

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 177
//Default Settings

Sensemaxleft = 4; // Set max sensorvalue left (should be >2)

Sensemaxright = 4; // Set max sensorvalue right (should be >2)

Drivemaxleft = 215; // Set max motor current left

Drivemaxright = 215; // Set max motor current right

Drivespeedleft = 255; // Set left motor speed (valid range 0....255)

Drivespeedright = 255; // Set right motor speed (valid range 0....255)

Voltlow = 10; // Set minimum operation voltage

Cutterspeed = 50; // Set Cutter motor speed (50 should be maximum!)

// Start cutter motor

analogWrite(Cutter, Cutterspeed);

delay(3000);

I_Start = 20; // Set I_Start to a high value for not entering this function again

4.3.2.8.1 Explanation oft he default settings

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.

Take care about:

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!

4.3.2.9 Final work


If all tests run fine you can do the final work. Install the controller board on the base plate and make
the connecting wires for the batteries. Pic.223 shows the schematic diagram for this.

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.

5. Placing the boundary wire fence BWF


Just pin the wire (Nr.16 from parts list 4.1.1.2) for the BWF with the help of the hooks (Nr.20 from
parts list 4.1.1.2) to the ground. The wire should lay flat on the ground to avoid that it is caught by
the cutter disc of the mower. The distance between the hooks should be 1……2 meters (Pic.230).

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.

6. Operating the robotic lawn mower


Note: Read the warnings chapter 1.1 and the legal disclaimer of this construction manual.

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.

Error: The mower overruns the BWF sometimes

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

Error: The mower makes abnormal noises and vibrations

- Check the cutter blades. May be one is broken. Replace it.

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

The sensors show abnormal values:

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

Abnormal values for the motor currents are shown:

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

- The brushes of the motor are exhausted. Replace the motor.

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 Sensepinleft = 4 ; // Define PIN A4 for left Sensor

int Sensepinright = 3 ; // Define PIN A3 for right Sensor

int Sensevalueleft; // Define variable for sensorvalue left

int Sensevalueright; // Define variable for sensorvalue right

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

int Ledbat = 3; // Define PIN 3 for digital output red LED

int Ledstart = 4; // Define PIN 4 for digital output green LED

// Read Battery voltage

int Voltpin = 0; // Define PIN A0 for reading battery voltage

float Volt; // Define variable for voltage

float Voltvalue; // Define variable for avarage voltage calculation

float Voltlow = 10; // Define variable and setup for minimum operation voltage

int I; // Define variable for IF-LOOP counter

int I_bat = 20; // Define variable for battery status (low or high)

// Drive motors

int Driveleft = 9; // Define PIN 9 for left Motor PWM output

int IN3 = 6; // Define PIN 6 for left Motor IN3

int IN4 = 5; // Define PIN 5 for left Motor IN4

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 IN1 = 8; // Define PIN 8 for right Motor IN1

int IN2 = 7; // Define PIN 7 for right Motor IN2

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

int I_Ramp; // Define counter-variable for motor ramp

// Collision control

int Drivepinleft = 1; // Define PIN A1 for left motor current

int Drivepinright = 2; // Define PIN A2 for right motor current

int Drivesenseleft; // Define variable for left motor current

int Drivesenseright; // Define variable for right motor current

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

int I_Start = 0; // Define variable for entering "Start()" function

void setup() { // Setup

// Print

Serial.begin(9600); // Start the serial communication

// Status LEDs

pinMode(Ledbat, OUTPUT); // Define Ledbat PIN as OUTPUT

pinMode(Ledstart, OUTPUT); // Define Ledstart PIN as OUTPUT

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 187
// Drive motors

pinMode(IN1, OUTPUT); // Define IN1 PIN as OUTPUT

pinMode(IN2, OUTPUT); // Define IN2 PIN as OUTPUT

pinMode(IN3, OUTPUT); // Define IN3 PIN as OUTPUT

pinMode(IN4, OUTPUT); // Define IN4 PIN as OUTPUT

void loop() { // Start main programm

// Read Voltpin for 10 times and calculate average voltvalue

Voltvalue = 0;

for (I = 0;I<10; I++){

Volt = analogRead(Voltpin);

Voltvalue = Voltvalue + Volt;

delay(10);

Voltvalue = Voltvalue / 10;

Voltvalue = Voltvalue * 0.02765; // 0.02765 is factor for voltagedevider 22K / 4,7K

if (Voltvalue < Voltlow) { // Make dicission: Batteryvoltage O.K or low

I_bat = 1; // If battery voltage is low set status 1

Stop(); // If battery is low go to “Stop()” function

if (I_Start < 10) { // Go to "Start()" function

Start();

//Collision control

Drivesenseleft = analogRead(Drivepinleft); // Read left motor current

Drivesenseright = analogRead(Drivepinright); // Read right motor current

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 188
Serial.print("Motor current left = "); // Print

Serial.println(Drivesenseleft);

Serial.print("Motor current right = ");

Serial.println(Drivesenseright);

if (Drivesenseleft > Drivemaxleft) { // Compare left motor current

backward() ;

Turnright();

if (Drivesenseright > Drivemaxright) { // Compare right motor current

backward() ;

Turnleft();

// Read sensors

Sensevalueleft = analogRead(Sensepinleft); // Read left sensor

Sensevalueright = analogRead(Sensepinright); // Read right sensor

Serial.print("Left sensor = ");

Serial.println(Sensevalueleft);

Serial.print("Right sensor = ");

Serial.println(Sensevalueright);

Serial.println(" ");

if (Sensevalueleft > Sensemaxleft) { // Compare left sensor

analogWrite(Driveleft, 0);

analogWrite(Driveright, 0);

delay(250);

backward();

Turnright();

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 189
}

if (Sensevalueright > Sensemaxright) { // Compare right sensor

analogWrite(Driveleft, 0);

analogWrite(Driveright, 0);

delay(250);

backward();

Turnleft();

// Go forward

forward();

delay(200);

/////////FUNCTIONS///////////

void Start() {

digitalWrite(Ledbat, LOW); // Switch red status-LED off

digitalWrite(Ledstart, HIGH); // Switch green status-LED on

delay(500);

//Default Settings

Sensemaxleft = 4; // Set max sensorvalue left (should be >2)

Sensemaxright = 4; // Set max sensorvalue right (should be >2)

Drivemaxleft = 215; // Set max motor current left

Drivemaxright = 215; // Set max motor current right

Drivespeedleft = 255; // Set left motor speed (valid range 0....255)

Drivespeedright = 255; // Set right motor speed (valid range 0....255)

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 190
Voltlow = 10; // Set minimum operation voltage

Cutterspeed = 50; // Set Cutter motor speed (50 should be maximum!)

// Start cutter motor

analogWrite(Cutter, Cutterspeed);

delay(3000);

I_Start = 20; // Set I_Start to a high value for not entering this function again

void Stop() { // Stop the mower if battery is low

Cutterspeed =0; // Switch off cutter motor

analogWrite(Cutter, Cutterspeed);

analogWrite(Driveleft, 0); // Switch off left drive motor

digitalWrite(IN3,LOW);

digitalWrite(IN4,LOW);

analogWrite(Driveright, 0); // Switch off right drive motor

digitalWrite(IN1,LOW);

digitalWrite(IN2,LOW);

digitalWrite(Ledstart, LOW); // Switch green status LED OFF

while (I_bat < 10) // As long as batterystatus is low, stay here

// flash red status LED

digitalWrite(Ledbat, HIGH);

delay(100);

digitalWrite(Ledbat, LOW);

delay(500);

Serial.println("Low Battery"); // Print "Low battery" message

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 191
}

void forward() { // Drive forward

digitalWrite(IN3,LOW); // Switch PIN IN3 LOW

digitalWrite(IN4,HIGH); // Switch PIN IN4 HIGH

digitalWrite(IN1,LOW); // Switch PIN IN1 Low

digitalWrite(IN2,HIGH); // Switch PIN IN2 HIGH

analogWrite(Driveleft, Drivespeedleft); // Set PWM-value for left motor

analogWrite(Driveright, Drivespeedright); // Set PWM-value for right motor

void backward() { // Drive backward

// Switch IN-PINs for backward drive

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

delay(1000); // The time the mower should go backwards

analogWrite(Driveleft, 0); // Stop motor after going backwards

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 192
analogWrite(Driveright, 0); // Stop motor after going backwards

delay(250); // Give the mower some time to stop

void Turnleft() { // Turn left

// Switch IN-PINs for turn left

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

Turntime = random(100, 1500); // Random for turning time

delay(Turntime);

analogWrite(Driveleft, 0); // Stop motor after turning

analogWrite(Driveright, 0); // Stop motor after turning

Sensevalueleft = 0; // Set left sensor-value back to zero

Sensevalueright = 0; // Set right sensor-value back to zero

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

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

void Turnright() { // Turn right

// Switch IN-PINs for 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);

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 194
}

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

Turntime = random(100, 1500); // Random for turning time

delay(Turntime);

analogWrite(Driveleft, 0); // Stop motor after turning

analogWrite(Driveright, 0); // Stop motor after turning

Sensevalueleft = 0; // Set left sensor-value back to zero

Sensevalueright = 0; // Set right sensor-value back to zero

delay(250);

// 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);

analogWrite(Driveleft, Drivespeedleft); // After motor ramp use default drivespeed-value

analogWrite(Driveright, Drivespeedright); // After motor ramp use default drivespeed-value

The 3d-printed „Robotic lawn mower“ © by A. Haeuser, Dezember 2015 Seite 195

You might also like