All Robots - Arduino Software to Upload
The Arduino code used is the same for all of the Robot types (Little Monster, 220, 330, LAM & Aerator).
The code for each Arduino board as shown below needs to be uploaded using the Arduino IDE software which can be downloaded for free from the Arduino website.
The Arduino code to be uploaded to the boards can be found below or on my Github site using the following links. Always use the latest version of the software. (Please see the included txt document to see the changes in the code)
ARDUINO ROBOT CODE Latest Versions: (Includes GPS and FPV CAM Code)
Latest Released.
Robot V9.751 (09.05.2023)
Archive
Robot V9.75 (17.01.2023)
Robot 9.731 (01.06.2022)
Robot 9.72 (25.10.2021)
Robot V9.7 (11.09.2021)
Robot V9.61 (23.06.2021)
Mower V9.5 (24.04.2021)
Mower V9.4 (27.03.2021)
Mower V9.3 (23.03.2021)
Mower V9.2 (10.01.2021)
Mower V9.1 (04.01.2021)
ARDUINO Library Files:
Libraries (Updated Sept 2022) Includes MAVLINK
Archive
Perimeter Wire Transmitter Files:
Perimeter Wire Code V2 (includes updated PCB wire controller for Blynk2.0)
Experimental Code - Only use if an expert.
Mower V9.752 (18.07.24)
Which Code to Which Board?
Various Arduino boards are used to control the robot motion, the TFT Screen, wire transmitter, cameras and GPS module. Here is a complete overview of where the code should be uploaded.
Native and none Native Arduino Boards
Native Arduino boards have all the settings required to upload code built into the Arduino IDE. You can select the board type and upload the code easily.
None-Native Boards (boards not supported as standard by the Arduino IDE require extra plug ins to be installed to work with these boards in the Arduino IDE. These include the NodeNMCU, ESP32 and ESPCAM boards.
See here about installing the NodeMCU compatibility in the Arduino IDE
See here about installing ESP32 compatibility in the Arduino IDE
If your not experienced with uploading code to the Arduino boards see the detailed instructions below.
Also see my basic Arduino skills tutorial here
Installing the Arduino Libraries
Before uploading the Arduino code to the boards you will need to install the library files.
Some of the commands used in the Arduino sketches require special "libraries" to execute these commands. A library is an expansion of the command structure to include new commands not native to the Arduino language.
All the libraries used in the robot code can be found above in the Arduino Library Files section
Once the "Libraries.zip" file is unzipped it will create a new folder called "Libraries Used __ ____". Now you have all the library folders which I used in the project.:
Uploading the Arduino Code.
1. Open the folder "Mower Arduino Code" (in the extracted folder)
2. The codes for each board are in separate folders. In this case we will install the code to the MEGA board. Open the MEGA_VX.X folder (in this case 7.0 but as the code develops this number will change)
3. Open the main MEGAVX.X file. This will open the Arduino IDE.
Select Your Robot Type
From software version V6.1 onwards, before uploading the code to the main MEGA board you will need to define:
This is done by removing the // from the line of code and adding a // to the type not required
The below example shows the ROBOT_MOWER code is activated (for use with the Little Monster, 220, 330 and LAM Models) using a Arduino MEGA board. The LCD keypad is deactivated as the TFT touchscreen is being used.
This shows the code activated for the Robot_Aerator
5. Connect the Arduino MEGA board to the computer using the USB cable. In the Arduino IDE select the MEGA board and the correct port.
6. Now upload the code to the board using the compile and upload button (Arrow in the top left hand corner)
This same procedure needs to be done for the NANO board (selecting of course the Nano board as the board type in the Arduno IDE.)
Loading the Arduino TFT Code.
The TFT code is in the TFT_VX.X Folder. Using the same procedure as on the main MEGA, upload the TFT Code to the TFT MEGA Board (The MEGA underneath the TFT shield).
Before uploading From Code V9.61 onwards you need to select the Robot Type the TFT is controlling
Robot_Type = 1 Mowers
Robot_Type = 2 Aerator
Approximately around line 464 on the first tab of the code you will find the settings. change the number to 1 or 2 before uploading the code
The Robot Type selection can also be done in the TFT menu (Code V6.1 or later) after upload by selecting SETUP --> NEXT --> ROBOT then select the Robot Type as Mower. This method will also save this selection to EEPROM so the setting is remembered every time.
TFT Picture Files
You will need to copy the BMP files onto an SD Micro card and insert this into the TFT Touchscreen shield.
Touchscreen not responding?
If the TFT touchscreen does not respond to touch then probably the pin assignment is different for the screen being used. First you can try and use one of the pin setups I found to work. Activate the code for the different pin assignments (V9.5 code and higher) by removing the //.
Remember to deactivate the code by re-entering the // to the part of code not required. (Pin assignments shown in red, the lower part is the touch calibration part)
// Screen Setup 1
//const int XP = 8, XM = A2, YP = A3, YM = 9; //ID=0x9341
//const int TS_LEFT = 960, TS_RT = 94, TS_TOP = 910, TS_BOT = 108;
// Screen Setup 2
const int XP = 6, XM = A2, YP = A1, YM = 7; //ID=0x9486
const int TS_LEFT = 960, TS_RT = 94, TS_TOP = 108, TS_BOT = 910;
If these 2 pin assignment options do not work then do the following:
1. first check that the screen really is a touch screen. It should say TOUCH = YES on the package.
2. Load the sketch file diagnose_Touchpins to the TFT MEGA. Once the sketch is loaded open the serial monitor (BAUD Rate 9600).
3. Note the Pins given in the sketch. In this case YP = A1 / YM = 7 / XM = A2 and XP = 6
4. Re-Open the TFT Sketch and update the pins in the sketch
The TFT Screen should now have the correct pin calibration and respond to touch commands.
Touch Area not calibrated.
If the touch doesn't respond to the correct area of the screen try one of the following setups which are included in the sketch (Software V9.5 and above)
// Screen Setup 1
//const int XP = 8, XM = A2, YP = A3, YM = 9; //ID=0x9341
//const int TS_LEFT = 960, TS_RT = 94, TS_TOP = 910, TS_BOT = 108;
// Screen Setup 2
const int XP = 6, XM = A2, YP = A1, YM = 7; //ID=0x9486
const int TS_LEFT = 960, TS_RT = 94, TS_TOP = 108, TS_BOT = 910;
You can activate the setup by removing the // before the code. Ensure the // is re-entered on the code not used. (in the example above Setup 2 is active).
If these setups dont work then run the sketch TouchScreen_Calibr_native.ino (in the Examples folder) .
Ensure at the #define code at the very top that LANDSCAPE 3 is used.
and copy the values given after the calibration from the serial monitor (BAUD 9600) to the TFT sketch
TFT Sketch updated
NODEMCU Board
This board will give the Mower WIFI capability and communicate with the Smartphone APP.
For the NODEMCU board you will need to follow some extra instructions.
The NODEMCU is not supported by the Arduino IDE. This board type needs to be installed in the Arduino IDE. See here about installing the NodeMCU compatibility in the Arduino IDE
Uploading the Perimeter Transmitter Code.
The code for the perimeter transmitter is in the "Perimeter Wire Transmitter" folder.
Upload this code to the UNO/Nano on your perimeter transmitter being sure to select UNO or Nano as the board type in the Ardunio IDE.
If you are building a PCB version of the perimeter wire transmitter you will also need top upload the WIFI code to the WEMOS board.