Azurit Firmware (English)
Inhaltsverzeichnis
Download and flash Arduino code
NOTE: If you have never worked with Arduino before, read our 'Arduino first steps' introduction.
You have two options:
- Download github code (recommended) OR
- Download v0.9.3 code (old, not recommended)
Finally, download and start the Arduino IDE to flash the code to your Arduino.
Arduino Version: It is very Importent that you use the Arduino IDE version 1.6.3 or above AND select the right Board (Mega 2560 or Due).
Important for Arduino IDE 1.6 or higher: if you see any folders inside the code folder (e.g. 'unused'), please delete them before compilation! Note: Always verify that the pin configuration in your Arduino code (config.h/mower.cpp) matches your actual circuit!
Settings
The robot uses settings that you can adjust for your own robot and environment (via pfodApp or directly in the code). The default settings (factory settings) are stored in the config file 'mower.cpp'. In this file you can find a description of all settings.
The settings can be adjusted via Android phone (pfodApp).
Important: If you uploaded a new version into your robot, reset all settings via pfodApp once (Settings->Factory reset). This will delete all existing settings. Old settings can produce malfunction if the internal settings format has changed.
First-time usage
1. At first, deactivate all sensors - In 'mower.cpp' set the robot settings like this:
bumperUse = 0; dropUse = 0; rainUse = 0; sonarUse = 0; perimeterUse = 0; lawnSensorUse = 0; imuUse = 0; batMonitor = 0; odometryUse = 0; gpsUse = 0; buttonUse = 1; timerUse = 0;
2. The software offers a serial console mode. Open the serial console in the Arduino IDE (CTRL+SHIFT+M) and set the baudrate to 19200. The motor and sensor values should appear constantly. First let's delete any existing error. Send the letter 'd' to the Arduino.
Console: press... d for menu e=delete all errors
3. Run the ADC calibration, so that the ADC signals are symmetric around zero.
pres... 8=ADC calib (perimeter sender, charger must be off)
4. Save user settings
press... 9=saver user settings
5. Test motors:
press... 1=test motors Security note: For security reasons, always remove mower blades in your first tests!
You should verify that the wheel motors are controlled correctly and in the right direction. Increase 'motorAccel' in 'mega.cpp' if the motors are not accelerating quickly enough.
Starting the mower
To start the mower, you need to add a button and a buzzer:
pinButton —o Button o— GND (button for ON/OFF)
pinBuzzer —o Buzzer o— GND (Piezo buzzer)
Now, press the button as long as you hear the beeps:
Mode (press button for x beeps):
1 beeps : Normal mowing (using blade modulation if available) 2 beeps : Normal mowing (without blade modulation) 3 beeps : Drive by model remote control (RC) 4 beeps : Drive without mowing 5 beeps : Find perimeter and track it
Console output
When the robot starts, it outputs something like this in the serial console:
START Ardumower rXXXX press... d for menu v to change console output (sensor counters, values, perimeter etc.)
t 0 l177 v0 FORW spd 33 33 0 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 20.8 chg 21.7 0.0 imu 0 adc 0 Ardumower t 1 l177 v0 FORW spd 33 33 0 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 20.8 chg 21.7 0.0 imu 0 adc 0 Ardumower t 3 l177 v0 FORW spd 33 33 0 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 20.8 chg 21.7 0.0 imu 0 adc 0 Ardumower
Once a sensor triggers, its counter increases.
Example (mower motor current overflow triggered):
t 4 l177 v0 FORW spd 33 33 0 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 20.8 chg 21.7 0.0 imu 0 adc 0 Ardumower t 5 l177 v0 REV spd -26 -26 0 sen 0 0 1 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 20.8 chg 21.7 0.0 imu 0 adc 1 Ardumower
Here is a description of each column:
t - time of current machine state (ms) l - loop () - cycles per second v - Verbose mode selected sensor (0 = counts / 1 = sensor values / 2 = sensor values) - Current machine status (FORW, REV, ROLL etc.) - After-home-drive? (1/0) spd - control / speed motor: left (PWM), right (PWM), mower (speed) sen - motor current overflow counter: left, right, mower bum - bumper counter: left, right son - ultrasonic distance-below: counter pit, roll - inclination (calculated with Accel sensor) yaw - compass course bat - battery voltage chg - charger voltage sensor
--- commands ---
'd': menu for testing, adjust IMU, Bluetooth 'v': monitorMode (show Value not Counter 'h': drive home 'p': track perimeter 'l': simulate left bumper 'r': simulate right bumper 's': simulate lawn sensor 'm': toggle mower motor 'c': simulate charging '+': rotate 90 degrees '-': rotate 90 degrees '3': activate model RC '0': OFF '1': Automode motorMowEnable
Bluetooth module
The Ardumower can be monitored and controlled wirelessly:
- via phone/tablet (Android App)
- via USB Bluetooth dongle (PC serial console)
On the phone, you'll need the App 'ArduRemote'. Alternatively, you can use the App 'pfodApp'.
The phone menu includes:
- Status information (battery voltage, charging current etc.)
- Settings (Timer etc.)
- Calibration (Motor, IMU etc.)
- Remote control (Start/Stop, Switching on/off mower motor, blade modulation etc.)
Bluetooth module
On the robot, you'll need a Bluetooth HC-05 module supporting Bluetooth Serial Port Profile (SPP). SPP uses Bluetooth Service Discovery Protocol (SDP) and the RFCOMM protocol.
Bluetooth HC-05
For Programming the Module, you must connect the Key Pin from the BT Module to the 3.3 V from the PCB and disconnect after programming.
Bluetooth module configuration steps
- Configuration mode: The Bluetooth module must be in configuration mode for the next step:
- for HC05: Connect KEY pin to 3.3V after powering on the module
- for HC06/linvor: Do NOT pair/connect (LED must be blinking)
- for FBT06/MBTV4: First you have to solder the PIO11 pin to VCC (PIN 12) which is 3.3 Volts using a thin wire.
- Baud rate: Blueooth module and Arduino Mega must use the same baud rate (19200) - The baud rate of the BT module can be changed via Ardumower serial console. Connect Ardumower Mega board to your PC (USB), enter the serial console in the Arduino IDE (CTRL+M), and choose baud rate 19200, then choose 'd' to enter the Ardumower menu, '3' for communications menu, and '3' to configure the module to the correct baud rate.
- Restart: After your BT module is configured successfully, remove KEY pin connection again (HC05), and restart module.
- Pairing: The BT module must be 'paired' with your Android device once (via Android device settings). On the Android device, choose symbol "Settings" (via Android menu). Now choose "Wirless and Networks->Bluetooth Settings" and "Find device". Finally, choose "pair with this device" and enter your pin (very often "1234"). The Bluetooth module should now appear as "paired".
- pfodApp: Now you can start pfodApp/ArduRemote to connect to the Ardumower.
PC/Mac remote control application
In addition to the Android App, we have developed a remote control application for PC/Mac/Linux (developed in Processing/Java). The Mac standalone version has to be created within Processing, the Windows version is already available as standalone version:
- Download Windows 64 bit executable and extract it:
https://drive.google.com/uc?export=download&confirm=EYiA&id=0B90Bcwohn5_HRFFMUUFYWF9OdW8
- Download and install Java runtime (version 8 or higher): https://java.com/de/download/
- Plug-in an USB bluetooth dongle on your PC
- In Windows, pair the USB bluetooth dongle with the Ardumower bluetooth module - two new serial ports will be created on your PC (the first for incoming bluetooth connections, the 2nd one for outgoing bluetoth connections)
- Run 'processing_remote.exe', all available serial ports will be shown - select the serial port for outgoing connections
The code for Processing can be found here: https://github.com/Ardumower/ardumower/tree/master/code/Test_und_Entwicklung/processing_remote
Processing can be downloaded here: https://processing.org/
Communication protocol
You can log the communication to a file (folder 'pfodAppRawData' or 'ArduRemote') on your Android device. For the ArduRemote, press the 'Android menu button' on your device and choose 'Enable logging'.
Sensor logging
For PC data analysis, algorithm modelling and optimization, you can collect robot sensor data using pfodApp like this:
- Using your Android pfodApp, connect to your robot and choose 'Log sensors'. The logged sensor data will be displayed. Click 'Back' to stop logging (NOTE: for ArduRemote, press Android menu button before and choose 'Enable logging' to enable file logging).
- Connect your Android phone to the PC, if being asked on the phone choose 'Enable as USB device', so you phone shows as a new Windows drive on your PC.
- On your PC, launch Windows Explorer and choose the new Android drive, browse to the 'pfodAppRawData' folder (for ArduRemote: 'ArduRemote' folder), and copy the data file to your PC (you can identify files by their Bluetooth name and date).
Videos
Diagnostics/troubleshooting
Each time a sensor triggers, its corresponding sensor counter increases. The sensor trigger counters as well as the current sensor values can be viewed on the serial console. The following values are shown for the trigger counters in the serial console:
- Time of state machine's state (ms)
- loop()-counts per second
- choosen Verbose-Mode (0=counter readings/1=current values/2=current values)
- current state machine state (FORW, REV, ROLL etc.)
- drive home? (1/0)
- "spd" - Control/speed motors: left (PWM), right (PWM), mower (RPM)
- "sen" - Current limit exceeded counter motors: left, right, mower
- "bum" - bumper counter: left, right
- "son" - Ultrasonic-distance threshold exceeded (counter)
- "pit/roll" - Tilt (computed by acceleration sensor)
- "com" - compass course
- "per" - Perimeter loop detected: counter
- "bat" - Battery voltage
- "chg" - Charging current
Using the key 'v', you can toggle between sensor trigger counters and current sensor values.
Additionally, you can use pfodApp (Android) to plot the sensors (trigger counters and current values) over time. This allows you to wirelessly monitor your robot mower for error diagnostics. It is highly recommended.
Hardware measurements
For detecting failures in the assembly or electronic parts, it is highly recommended to use an oscillscope (e.g. pocket oscillscope DSO201) for your measurements. An Oscilloscope allows you to detect short-time failures in power signals, perimeter sender and receiver signals, odometry signals and more.
Tutorial for pocket oscilloscopes: http://www.ardumower.de/index.php/de/forum/anleitungen-hilfe/142-bedienung-oszilloskop-dso201
Error codes
If your robot beeps periodically, it is in ERROR state. Either run the serial console or 'pfodApp->Error Counters' to find out the detailed error. The possible solutions for each error are given below. For details about your robot settings, see Settings.
ERR_CPU_SPEED CPU speed error * Check I2C cables (e.g. reduce wire length) ERR_MOTOR_LEFT Left gear motor error * Check gear motor driver module and left gear motor (supply voltage, signal lines) * MC33926: ensure SLEW jumper is not set * Tracking: reduce Motor-Max-PWM and Tracking-P to reduce EMF ERR_MOTOR_RIGHT Right gear motor error * Check gear motor driver module and right gear motor (supply voltage, signal lines) * MC33926: ensure SLEW jumper is not set * Tracking: reduce Motor-Max-PWM and Tracking-P to reduce EMF ERR_MOTOR_MOW Mower motor error * Check mower motor driver module and mower motor (supply voltage, signal lines) * MC33926: ensure SLEW jumper is not set * Reduce Motor-Max-Power, so over-current is detected earlier ERR_MOW_SENSE Mower motor over-current * Check mower motor driver module and mower motor * Increase Motor-Max-Power, so over-current is detected later ERR_IMU_COMM IMU communication error * Check IMU module connections ERR_IMU_CALIB IMU calibration error * Start IMU calibration (either via Console or pfodApp->Settings->IMU) ERR_IMU_TILT IMU tilt error * Check IMU module and robot orientation ERR_RTC_COMM RTC communication error * Check RTC module connections, RTC battery etc. ERR_RTC_DATA RTC corrupt data error * Set and save RTC date and time ERR_PERIMETER_TIMEOUT Perimeter signal timeout * Check perimeter sender, wire etc. * Check coil polarity * Reduce Perimeter-smag, so timeout is higher * Increase Perimeter-timeout-seconds, so timeout is higher * Check your signal-to-noise ratio is higher than 1.0 ERR_TRACKING Perimeter tracking error * Check perimeter sender, wire etc. * Increase Perimeter-tracking-timeout, so timeout is higher ERR_ODOMETRY_LEFT Left motor odometry error * Check left odometry cable * Check left motor direction ERR_ODOMETRY_RIGHT Right motor odometry error * Check right odometry cable * Check right motor direction ERR_BATTERY Battery error * Check battery connections ERR_CHARGER Charger error * Check charger connections ERR_GPS_COMM GPS communication error * Check GPS cables ERR_GPS_DATA GPS data error * Check GPS antenna and cable ERR_ADC_CALIB ADC calibration error * Start ADC calibration (either via Console or pfodApp->ADC calibration) ERR_EEPROM_DATA EEPROM data error * Save user settings (either via Console or pfodApp->Settings-Save)
After fixing the error, you can delete errors:
Console: press... d for menu e=delete all errors
I2C errors
Ensure the I2C bus is working correctly. A console stucked at line 'initL3G4200D' indicates I2C is not working correctly. If there's a communication problem or another serious problem, the error counter increases. The error counter can be monitored via pfodApp. Additionally, the robot mower will beep when started.
Several components (Arduino Nano, RTC, IMU, etc.) are communicating via the I2C bus (SDA/SCL wires). These wires should be very short (maybe even twisted) and they should be far away from DC converter and motor drivers. If there's a communication problem, the error counter will increase and robot will beep when started. The error counter can be monitored via pfodApp.
Disable all pins not connected
Ensure that you have disabled all features and pins in the robot configuration that are not connected (not used).
Example: If you do not have connected odometry pins, disable them in the robot config (robot.cpp):
odometryUse = 0; // use odometry?
Motors working correctly
Run the serial console (Arduino IDE: CTRL+SHIFT+M, 19200 Baud) and press 'd' and ENTER for menu. Then press '1' and ENTER to run the motor test.
Any unexpected sensor triggering
If your robot does something unexpected, it might be a sensor that is incorrectly triggering. Check this via the serial console:
Run the serial console (Arduino IDE: CTRL+SHIFT+M, 19200 Baud), and start the robot. Each time a sensor triggers, the counter of that sensor will increase. See description of each sensor below. Now when your robot does something unexpected, have a look which of the sensor counters increased to locate the problem.
Some sensor not triggering?
...
Bluetooth not connecting?
- Verify that BT module baudrate is configured properly (using Ardumower Console) - activate programming button on BT module for programming procedure.
- Verify that BT module is 'paired' on your Android phone
- Verify that Arduino Mega is not powered via USB (but DC/DC instead)
Robot not stopping to rotate when reaching perimeter (home mode)
At first, verify that the perimeter tracking itself is working: Manually put the robot on the perimeter wire, and via ArduRemote App, choose 'Commands->Track' and verify the robot is tracking the perimeter. If it does not, adjusting the tracking PID parameters may help.
The position of the coil should be as indicated here:
If the robot runs over the perimeter wire (coil is then "outside" of perimeter loop) it will try to get "inside" the loop again by rotating. If getting the coil "inside" the loop by rotating is not possible, the robot will rotate endless.
The more the robot runs over the perimeter, the more difficult it is to get "inside" again by rotation. The robot speed should be reduced as well as moving the coil further outside.
NOTE: It's always a good idea to manually place the robot at the position where you saw the robot detecting the perimeter. The perimeter plot should change from "in" to "out" at that position (http://wiki.ardumower.de/index.php?title=Perimeter_wire#Receiver_diagnostics.2Ftroubleshooting). Then manually rotate the robot (without motor) at that position and verify that "out" changes again to "in". If that is not the case, the position of the coil is not OK or the robot drives too quickly and detects the perimeter too late.
Sensor logging
For PC data analysis, algorithm modelling and optimization, you can collect robot sensor data using pfodApp like this:
- Using your Android pfodApp, connect to your robot and choose 'Log sensors'. The logged sensor data will be displayed. Click 'Back' to stop logging (NOTE: for ArduRemote, press Android menu button before and choose 'Enable logging' to enable file logging).
- Connect your Android phone to the PC, if being asked on the phone choose 'Enable as USB device', so you phone shows as a new Windows drive on your PC.
- On your PC, launch Windows Explorer and choose the new Android drive, browse to the 'pfodAppRawData' folder (for ArduRemote: 'ArduRemote' folder), and copy the data file to your PC (you can identify files by their Bluetooth name and date).
How to report a new bug/new feature/new code
Click on 'this link' and create a new issue - Please let us know:
Your platform version (Arduino Mega 2560, Arduino Due) Your Arduino IDE version (latest code requires 1.6.3) Your exact operating system (Windows 8, Linux etc.) Your Ardumower code version (for a list of releases see https://github.com/Ardumower/ardumower/releases) Any other information that may be useful...
IMU
An IMU (Intertia Measurement Unit) is a key component of an inertia navigation system. We use it to:
- detect if the robot is in tilt orientation
- keep the robot on track for the 'lane-by-lane' mowing pattern
Acceleration sensor
An acceleration sensor measures earth gravity force (m*s^2) in all 3 robot axes (x/y/z) allowing you to calculate the orientation towards earth center of the robot (Roll, Pitch). However, it cannot detect movement around Yaw - this requires a gyro.
Gyro
A gyro measures rotational speed (degree/second) in all 3 robot axes (Roll, Pitch, Yaw). This allows us to correct the robot if it is driving 'off-course' due to wet conditions or slope. When integrating (adding) gyro values over time, the actual course (yaw) can be calculated. However, because each sensor reading has a small error, the course will 'drift' over time. This needs to be corrected via an absolute heading sensor (compass).
Typical gyro measurement errors:
noise dps/sqrt(Hz) L3G4200D 0.03 ITG3200 0.03 L3GD20 0.03 BMG160/BNO055 0.014 MPU9250 0.01 L3GD20H 0.011 LSM9DS0 0.00875 BMI160 0.007 MAX21003 0.007 L2G2IS/L2G3IS 0.006 MPU9150/MPU6050 0.005 ADXRS290 0.004 CRM100/200 0.003 GYPRO2300 0.00277
Compass
If a robot drives on a wet lawn, you'll notice quickly that it will not drive straight forward, but instead tends to drive into the direction of the slope. Reading a compass heading can solve this problem and the robot will drive straight forward again .
However, a compass has two problems:
- If tilting the robot, the compass measurements (x,y,z) relate to the tilted robot. So, you need to correct them using knowing the tilt angles. This requires the use of the accerlation sensor (x,y).
- The compass measurements are influenced by motors. So you may need to switch of the motor to get an accurate measurement.
Typical compass measurement errors:
sensitivity (uT) typical heading error (degree) AK8975 (MPU9150) 0.3 5 BNO055 0.3 2.5 CMPS11 (9S0 2413 530BS) 2.0 HMC5883L (GY-80) 0.2 1.5 AK8963 (MPU9250) 0.15 not tested LIS3MDL 0.14 not tested LSM303DLM MAG3110/FXOS8700CQ 0.1 not tested
IMU sensor fusion
To eliminate the issues of all sensor, they are merged to compute the course (degree) and pitch/roll angles.
We use a complementary filter to fusion all sensor values.
IMU module
GY-80
- Acceleration sensor: ADXL345B
- Compass sensor: HMC5883L
- Gyro: L3G4200D
- Pressure sensor: BMP085 (not used here)
Assembly
This photo shows how the IMU module is placed in the driving position (the red arrow shows the driving position). Ensure a minimum distance of 30cm from all motors. This minimum distance seems to be needed to ensure the compass is not disturbed by dynamically disturbing sources (like motors).
IMU calibration steps
Acceleration sensor
This calibration can be performed outside of the robot. Place each of the 6 module sides exactly upright, do not move and choose 'next side calibration':
- Via serial console "IMU acc calibration next side" OR
- Via pfodApp "Settings->IMU->acc calibration next side"
Do not move the module during the measurement of each side! During measurement you will hear a short beep tone.
Repeat this step for all 6 sides. After all 6 sides are calibrated, you will hear a short melody.
Compass sensor
This calibration can only be performed inside of the robot (IMU in its final position). Start the compass calibration:
- Via serial console "IMU com calibration start/stop" OR
- Via pfodApp "Settings->IMU->com calibration start/stop"
Hold each of the 6 module sides to North direction and tilt the module until minimum and maximum of the axis does not change anymore (until no tone is outputted anymore):
Calibration quality test
For a quality test, you can plot the calibration results (Yaw, Pitch, Roll) via pfodApp. Place the robot on a flat ground and let it rotate (pfodApp: click on "Commands->Auto rotate" until robot rotates). Alternatively, you can let the robot drive a circle (pfodApp: click "Manual->Right" until it drives the desired radius). Finally, choose 'Plot->IMU' to see the calibration result.
For the yaw plot, the curve should be a straight line when the robot is rotating with a constant speed.
Perimeter receiver
At first, activate the perimeter in the Ardumower software (pfodApp->Options->Perimeter Use: YES). It is recommended to keep the default perimeter settings.
The perimeter settings are:
- Timed-out if below smag (timedOutIfBelowSmag) - default setting: 300 | If smag below this value, sender is considered as off (perimeter timeout appears)
- Timeout (s) if not inside (timeOutSecIfNotInside) - default setting: 8
- Trigger timeout (perimeterTriggerTimeout) - default setting: 0 | Perimeter outside trigger timeout when escaping from inside (ms)
- Perimeter out roll time max (perimeterOutRollTimeMax) - default setting: 2000 | Max (random generator) roll time after perimeter out (ms)
- Perimeter out roll time min (perimeterOutRollTimeMin) - default setting: 750 | Min (random generator) roll time after perimeter out (ms)
- Perimeter out reverse time (perimeterOutRevTime) - default setting: 2200 | Time to drive reverse after perimeter out (ms)
- Perimeter tracking roll time (perimeterTrackRollTime) - default setting: 1500 | Hit obstacle while tracking: roll time
- Perimeter tracking reverse time (perimeterTrackRevTime) - default setting: 2200 | Hit obstacle while tracking: reverse time
- Transition timeout (trackingPerimeterTransitionTimeOut) - default setting: 2000 | Max. time required for a in/out transition during tracking, robot will start rotating after this timeout
- Track error timeout (trackingErrorTimeOut) - default setting: 10000 | Max. time required for a in/out transition during tracking, robot will go into error after this time
- Track_P (perimeterPID.Kp) - default setting:51 | Perimeter PID "P" setting
- Track_I (perimeterPID.Ki) - default setting:12.5 | Perimeter PID "I" setting
- Track_D (perimeterPID.Kd) - default setting:0.8 | Perimeter PID "D" setting
- Use differential signal (useDifferentialPerimeterSignal) - default setting: YES | Use differential signal (see signal section)
- Swap coil polarity (swapCoilPolarity) - default setting:NO
- Block inner wheel (trackingBlockInnerWheelWhilePerimeterStruggling) - default setting: YES | robot is wheel-spinning while tracking => roll to get ground again
Receiver ADC calibration
The ADC calibration ensures that the zero point (silence) is detected correctly, and so later the received signal is symmetric around zero.
- The perimeter sender and robot motors must be switched off during calibration!
- If you cannot avoid that another sender is disturbing during calibration, remove the coil during calibration (connect LM386 input line to GND)
- Run the ADC calibration once ("pfodApp->ADC Calibration")
When calibrated correctly, the signal in the pfodApp plot ('sig') should be around zero (0) when the perimeter sender is switched off. When the perimeter sender is switched on, the plotted signal ('sig') should have the same maximum amplitude for both positive and negative axis (is 'symmetric around zero').
Receiver diagnostics/troubleshooting
The receiver signal, filter result and signal quality can be monitored via Android phone (pfodApp->Plot->Perimeter):
Plot signal description:
sig: coil signal (raw pulse sequence after ADC) - it's a short snapshot (32 samples), and it's taken every 20 seconds (so you need to wait 20 seconds for the next snapshot) mag: filter result: inside (negative) or outside (positive), magnitude: distance to perimeter wire/magnetic signal strength (RSSI) - this is used for perimeter tracking smag: filter result, low-pass filtered, without sign (smooth mag) - this is used for 'sender-off' detection The threshold can bet set via pfodApp (Settings->Perimeter->Timed-out if below smag) in: binary result, low-pass filtered: inside (1) oder outside (0) - this is used for perimeter boundary detection If the robot is not inisde for a certain time, it will go into error. The threshold can bet set via pfodApp (Settings->Perimeter->Timeout (s) if not inside) cnt: number of "inside-outside" transitions (counter) on: perimeter sender active, robot is inside and smag is high enough (1) or inactive/outside/smag too low (0) qty: signal quality (how distinguisable inside and outside were in filter result computes ratio: match score with template signal / match score with inverse template signal 1.0 means poor quality, you should get 1.5 or higher)
The 'mag' plot should be clear (without spikes): Inside the perimeter loop, the signal should be a clear negative curve, outside it should be a clear positive curve. If your 'mag' curve is not clear (and has spikes), try to troubleshoot/optimize:
- Verify, your coil is connected correctly at 'pinPerimeterLeft' (you still may get a poor signal when connected at a wrong Arduino pin!)
- Decrease the threshold for a smag timeout via 'pfodApp->Options->Perimeter->Timed-out if below smag'
- Reverse coil if the in/out is inverted or reverse the perimeter wire
- Minimize cable length between coil and LM386-pre-amplifier (directly mount coil onto pre-amplifier)
- Increase distance between coil and mower motor/DC converter (move away coil 30cm or more from any motors or DC converters)
- Add some magnetic shield (e.g. your battery) between coil and motors/DC converter
Tracking of perimeter
The tracking of the perimeter wire is performed using a (software) digital PID controller. The controller's parameters (P,I,D) can be configured via the phone (pfodApp).
You can find more information about PID controllers here: Forum.
Finite state machine
This section describes some internals of the Ardumower software architecture. Kurz zum Ablauf der Software: In der Hauptschleife (loop) werden periodisch:
- Die Sensoren eingelesen (readSensors)
- Der Zustandsautomat durchlaufen und abhängig vom aktuellen Zustand die Sensorwerte überprüft (CheckXXXXX) und von den Sensorwerten in neue Zustände gewechselt (setNextState) - beim Wechsel werden ggf. neue Soll-Werte für die Motoren gesetzt (Beispiel: motorLeftSpeedRpmSet).
- Die Motoren mit den Soll-Werten angesteuert (motorControl)
Die möglichen Zustände und Ergebnisse für die Übergänge des Zustands-Automaten sind hier unten alle grafisch darsgstellt.
Wenn der Mower also im Zustand FORWARD ist, fährt er nach vorn. Man schaut also in der loop() nach was alles in diesem Zustand FORWARD gemacht wird (case FORWARD). Dort hätte man die Möglichkeit weitere Aktionen einzufügen.
Main component of the software is a so called 'finite state machine', that means there exists a set of states ("OFF", "FORWARD", "ROLL", etc.) that the robot can be in. Depending on events (sensor is triggering etc.), the robot will enter a new state.
State diagram (Note: The drawing has been created using draw.io)
Implemented updates:
- If obstacle during reverse => roll
- If obstacle during roll => forward