Introduction: RoboGrazer - Rules Based Mower

About: I am a retired engineer. Always liked programming. I am self taught and had experience of various programming languages including machine code in my early days as an apprentice.

Robo Grazer is a robot lawn mower. This is using a Rules based programming using Arduino. The command and control uses a Rule array and has a web interface for monitoring and control. Parts of the hardware build are derived from Ardumower such as the type of motors, charging circuit and the sender and perimeter detection.

This implementation does away with the overly complex software and it is replaced with a rules based program. This is highly compact and reliable method of programming and the basic mowing and perimeter detection runs on a single Arduino Nano if you need to. However, I have extended the functionality of Robo Grazer to include rain detection, bump detection, battery management, a simple scheduler, power shutdown, temperature monitoring and a web server to view the progress and status.

As much as possible I have put the build details in GitHub rather than have multiple sources.


Please see my Demo project to understand the Rules based programming.


This build is provided with greatest thanks to all diy developers out there. I hope this build helps you and you are free to use whatever parts

you need. I have tried to keep it error free but I cannot gaurentee that it is. Please extra take care using large lithium batteries as used in Robo Grazer.

Do not charge them in your home without supervision.


Please note thanks to the Ardumower community. The Sender is based on the original Ardumower V2 code. It has had some minor modifications.


Disclaimer:

The Robo Grazer uses a lithium ion battery. Although this project will show you how I have used it you must take every precaution when working with these. I do not take any responsibility for errors or omissions in this project and therefore you build this at your own risk. Please when charging the battery please do not do it unsupervised.

Supplies

Git Hub repository

https://github.com/flappydunk/AI-Rules-for-Arduino/tree/Robo-Grazer

https://github.com/flappydunk/AI-Rules-for-Arduino/tree/Rules-Demo


For Robo Grazer

Arduino Nano x 2

NodeMCU

Ardumower (wheel kit)

Dual_TB67H420FTG Motor wheel Driver

Dual_MC33926 Mow driver

24v battery

Step 1: Construction

The case was built using Heeks and cut out using a CNC machine. Based on a Ardumower originally however only the motors and drivers are used. The control programming proved too inflexible and overly complicated to modify so I developed the rules based method to facilitate it.

All the control unit is a plug in back board with series of plug in boards. This allows more flexibility in development and dealing with unforeseen changes in functionality. See the boards overview below.

Each board uses wire wrapping to ease construction and allow component layout to much easier to develop. See section on wire wrapping.




Step 2: Rules Based Program

I have created a separate Demo to illustrate how the rules work. Its amazingly flexible and adding functionality is quite simple. The command and control setup is provided in a .XLS file.

https://www.instructables.com/AI-Rules-Base-Programming-With-Arduino-Demo/

It shows you how the Hex codes are created for use in the Arduino modules. So if you need to modify or change the way Robo Grazer interacts in the environment or add or change sensors 

you can with minimal programming. You will see the Rules can handle Servos, temperature modules, moisture and using sequenced commands if need be and change the behaviour of Robo Grazer

with just a few HEX codes. So to fully understand the code provided you will need to have a look at how the Rules work.

Step 3: Wire Wrapping

The section covers the general build and gives some insight to what I wanted to achieve in building Robo Grazer.


First I wanted the ability to modify and upgrade parts of the system with as little rebuilds or new circuit boards. 

Flexibility was key but I wanted to be able to have a prototype and a finished project without getting custom boards made.

So I have used a modular approach a rack (back plane) and standard size board system. Each board components interconnected using the board wire wrapping method.


Wire Wrapping

The project is built using wire wrapping. I decided to use this since I have had experience with it. I used to work in Telephones exchanges

and this was the prime method of connecting the various parts together and proved wholly reliable.


Using the standard square pins (0.1 inch) veroboard style. I have discovered they do provide a reliable method

for interconnecting components. This allows flexibility on the board to situate a component where you like and using "Wire Wrapping wire"

to connect to the components. Where power and ground is needed standard solder and wire is used for powering the devices. 

Some signalling gnds/earth can be done using wire wraps. A pin can generally take two wraps so looping wire around is straight forward.

Care is needed when wrapping as the wire is quite thin. Don't use over pressure and cover half the pin and you should be OK.


Step 4: Boards Overview

Boards

Overview of Board Configuration


Sender <---- UDP ------> NodeMCU ------------> http Web Page


NodeMCU (Master I2C) (Polling) (via level shifter) to Nano's


Arduino Nano (motors) >------ I2C --------< Arduino Nano (Monitor)

      |_____________( STOP ) _____________|


Robo Grazer has a Backplane on which are mounted the following:

Power board: Converts 24v to 5V and delivers it to the back plane. It also provides power for two 12v fans in series.


NodeMCU Board: This board originally had a NodeMCU (also works with ESP32) and a Arduino Nano fitted. However later work when implementing the Rules method I was able do away with Arduino Nano. So this board only has a NodeMCU fitted. It controls the interconnection of the boards using I2C and level shifter. It brings together all the information from all the boards including the sender for presentation to the web page. 


Key Functions are : Overall Status, Error monitoring, Charge and mowing timer, current display for charging and Perimeter, Simple Scheduler, Perimeter status,

Perimeter switching, Temperature, Docking, Rules Log display, and control buttons.

It also has a ability to power down completely. The mower if commanded to SHUTDOWN. Will go home, charge itself and then using a servo power down the Robo Grazer, 

also it will power down the sender using a TPlink mains power controller. Robo Grazer can communicate directly with it and turn the power off.

On start-up when the TPlink is activated a relay in Robo mower operates and powers up the Robo Grazer and switches the servo on.


Nano Board: This board has two Arduino Nanos fitted. 

     Motor Nano: Rules Based Control. This really is the control of all the motors, and evasive manoeuvres of Robo Grazer. It also monitors the Perimeter signals from the sender

     It controls the wire tracking and homing to the base station. It does have a direct connection the monitor Nano called STOP to immediately stop the Robo Grazer

     if a bump is detected. It provides noise filtering (capacitors and resistors) on the long wiring. Key flag status is gathered by the NodeMCU to keep in step with what's going on.

     Monitor Nano: Rules Based Control. This Nano handles all the sensor collection. It provides battery monitoring, Rain sensor, Power Servo, Leaf collector servo (still experimental),

     Temperature monitoring and Fan control. Also Bumpers which sends a STOP signal via a dedicated link to the Motors. 

     Key flag status is gathered by the NodeMCU to keep in step with what's going on.

 24V Board: This board original modified from Ardumower V2 provides a 24v control and fusing for charging and monitoring voltages. This interfaces the Battery

 to the Power Board.

Motor Driver: This board is separated from the backplane due to high power and is kept near to the motors to reduce interference. It provides drivers for the mow motor as well as the drive motors.

All protection circuitry is on the board to protect the 5v logic. Interface resistors are provided on the boards to all the 5V signalling to the Motor Nano.

Plug in boards Dual_TB67H420FTG_Motor_Driver and Dual_MC33926 are mounted on the board to drive the motors.

Step 5: Sender

The sender also uses this backplane but this only has two boards. You can see this uses a TPlink power control plug. However this can be omitted.


Power:

A separate PSU 24v power from the standard charger and connects it to the Home Station when charging is needed. It also powers the Sender driver a L295N(s) at 12V which delivers power to the garden current loop(s).


Sender Boards

NodeMCU and Nano Board: The Perimeter control is provided by a Arduino Nano. This sneds the encoded signal to the perimeter wire. It has the ability to manage two perimeters (not simultaneously)

The perimeter can be turned on or OFF and select the perimeter needed by Robo Grazer. The NodeMCU provides a UDP connection for Robo Grazer to collect current and charging data.


Power and Current monitoring Board: 12V from the PSU is converted to 5V for the Arduino boards



Step 6: Web Page

You will have to alter the SSID and Password in the NodeMCU(s) for your router to enable the web page and the Sender UDP. It is also best to set up your router up so the Mac addresses are associated with a fixed ip address. You will then be able to use your local browser to see what Robo Grazer is doing.

The web displays the rules as they execute and a full status of the Flags indicating the status of the system. Any errors detected are displayed as ERR XX. The format works well on your mobile display. Will need to ensure the working area has a WiFi signal.