Perimeter wire: Unterschied zwischen den Versionen
(→ADC calibration) |
(→Perimeter) |
||
(506 dazwischenliegende Versionen von 5 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
=Abstract= | =Abstract= | ||
− | A perimeter wire (or buried wire fence, BWF) is like a 'virtual fence': it stopps the robot when it reaches its boundaries. A perimeter is not always necessary for all surroundings | + | A perimeter wire (or buried wire fence, BWF) is like a 'virtual fence': it stopps the robot when it reaches its boundaries. A perimeter is not always necessary for all surroundings. |
Principle idea: You will install a perimeter loop (a wire) in your garden through which a signal is sent and this signal is detected by the robot. So, you'll need: a sender (to transmit the on the wire) and a receiver (to detect the signal in the robot). | Principle idea: You will install a perimeter loop (a wire) in your garden through which a signal is sent and this signal is detected by the robot. So, you'll need: a sender (to transmit the on the wire) and a receiver (to detect the signal in the robot). | ||
− | How is the signal detected? The signal is detected by one | + | How is the signal detected? The signal is detected by one receiver coils. The closer the distance between coil and perimeter loop, the higher the signal strength. Also, something interesting happens when the robot crosses the perimeter loop: the signal changes its polarity, that means positive and negative voltages reverse each other. |
<gallery> | <gallery> | ||
− | File: | + | File: Ardumower_perimeter.jpg | Perimeter wire |
+ | File: Perimeter_signal_strength.jpg | Signal strength | ||
+ | File: Perimeter_gradient.png | Perimeter gradient | ||
+ | File: Perimeter_excluding_objects.png | Excluding objects | ||
+ | File: Perimeter_divide.png | Dividing areas | ||
</gallery> | </gallery> | ||
− | =Perimeter | + | =Perimeter= |
− | == | + | [[Image:Yt-brand-standard-logo-95x40.png|thumb|180px|https://www.youtube.com/watch?v=NIer_kITelc&feature=youtu.be]] |
− | + | ||
− | + | This is the new version of the perimeter sender and receiver (that can be purchased via the [https://www.marotronics.de/index.php?k=7 shop] [[File: shopping.png|link=https://www.marotronics.de/index.php?k=7]]). | |
− | + | The perimeter sender outputs a digital code sequence (a 'pseudo-noise' code), and the receiver will detect that code using a software-based digital matched filter. Depending on wheter the match result peak is positive or negative, the robot is inside or outside of the perimeter wire. | |
− | + | Sender principle: | |
− | + | # Sender PCB generates an output signal using an Arduino Nano (about 3 Khz) | |
− | + | # The generated signal is amplified using a motor driver (MC33926), the motor driver output is connected to the perimeter wire (instead of a motor) | |
− | + | Receiver principle: | |
− | + | # A coil receives the signal | |
− | + | # The signal is amplified using an operational amplifier (LM386) | |
+ | # The Arduino Mega samples the signal using its analog-to-digital converter (ADC) at 9615 Hz | ||
+ | # The digital signal is filtered using a digital filter (matched filter algorithmn) | ||
+ | # The matched filter output is evaluated (for perimeter inside/ouside detection, tracking etc.) | ||
− | + | The images below explain why the polarity of the received coil signal changes between inside and outside of the perimeter wire. The image shows the direction of the electric flux lines sent out from the perimeter wire and how they hit the coil for both inside and outside position. | |
− | + | ||
− | + | For a better understanding of the perimeter filter, see the [http://www.grauonline.de/alexwww/ardumower/filter/filter.html Matched filter simulation]. For more details about the filter, also see the [https://www.youtube.com/watch?v=NIer_kITelc Matched filter video]. Using a simple symmetric signal (which looks equal on positive and negative side of the zero point), you cannot differentiate between an 'inside perimeter' and 'outside perimeter' signal. When the mower is traversing the perimeter loop, the signal polarity changes (positive becomes negative and negative becomes positive). We want to detect this polarity change of the signal. Using an unsymmetrical signal, you can do this. You can see the difference in the simulator. The default signal (slider 'example signal') is a symmetric signal - press the 'Invert' button to invert the signal (change its polarity). In the correlation result (graph 'Matched filter') the polarity can not be detected. Now use an asymmetrical signal ('pseudonoise5_pw'). Press again 'Invert' to change signal polarity. Now you can see polarity of the signal in the filter output (graph 'Matched filter'). It's the sign of the peak (positive or negative sign). | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<gallery> | <gallery> | ||
− | File: | + | File: Ardumower_perimeter2.jpg| Inside/outside detection using polarity change |
− | File: | + | File: Fluxdirections.png| Flux directions |
− | File: | + | File: Perimeter_signal_steps.png | Perimeter signal at sender and receiver coil |
+ | File: Matched_filter_principle.png| Matched filter | ||
+ | File: Perimeter_signal_good_bad.png|What makes a good/bad signal | ||
</gallery> | </gallery> | ||
− | + | ==Sender== | |
+ | [[Image:Ina169_marotronics.jpg|thumb|200px| Note for Marotronics INA169: Short pads for 5A operation]] | ||
+ | [[File: Ardumower_perimeter_overview.jpg|600px]] | ||
− | + | We use a motor driver as output amplifier and an Arduino Nano to generate the signal. The motor driver is driven by 3.2 Khz (two pulse widths 4808 Hz and 2404 Hz). We use a motor driver with integrated current limiting and thermal switch-off (e.g. MC33926). | |
− | + | [[File:warning.png]] The perimeter wire length should be in the range 20m - 450m and must be at least 5 Ohm and not more than 12 Ohm. The maximum perimeter area is 1000 m2. | |
− | File: | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | MC33926 wiring: The perimeter wire is connected between MC33926 M1OUT1 and M1OUT2. | |
− | The | + | |
− | + | * [https://www.marotronics.de/Perimeter-Sender-Board-Prototyp-mit-Platinen-Zubehoer sender PCB in the shop] | |
− | + | * [https://github.com/Ardumower/ardumower/blob/master/pcb/Produzierte_Platinen/sender_v2_geschlossen/Perimeter%20sender%20v2.pdf sender PCB schematics] | |
− | + | * [https://github.com/Ardumower/ardumower/tree/master/pcb/Produzierte_Platinen/sender_v2_geschlossen/Platinenbilder sender PCB pictures] | |
− | + | ||
− | + | ===Sender software=== | |
− | + | <b>NOTE</b>: If you have never worked with Arduino before or if your Arduino Nano does not seem to respond, please read our <b>[http://wiki.ardumower.de/index.php?title=Arduino_first_steps 'Arduino first steps' introduction]</b>. | |
− | < | + | <b>Download</b>: You can find the sender code in the 'sender' folder of the [http://wiki.ardumower.de/index.php?title=Ardumower_PCB#Download_and_flash_Arduino_code Ardumower Download] |
− | + | ||
− | </ | + | |
− | + | [[File:warning.png]] Note: Always verify that the pin configuration in your Arduino code (sender.ino) matches your actual circuit! | |
− | + | ||
− | |||
− | + | ===Sender power control=== | |
− | File: | + | [[File:warning.png]] The perimeter wire resistance (R) must be at least 5 Ohm and not more than 12 Ohm. Ideally, a 12 ohms (50W) power resistor is placed in series with the perimeter wire, so you get a total resistance of the perimeter wire at 12-15 ohms. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | To change the power (current/voltage) of the sender, proceed like this: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | The motor driver output voltage can be changed between 6.5-12V via the potentiometer on the DC/DC converter. Adjust the potentiometer so that not more than 1 Ampere current flows. | |
− | + | Example: | |
− | + | Your perimeter wire resistance (R): 12 Ohm | |
− | + | Your adjusted voltage at the DC/DC converter: 8 Volt | |
− | + | ||
− | + | ||
− | === | + | The consumed current and power is then: |
− | + | Current: I = U / R = 8 Volt / 12 Ohm => 0.7 Ampere | |
+ | Power: P = U * I = 8 Volt * 0.7 Ampere => 5.6 Watt | ||
− | + | Power resistor: If your perimeter wire resistance (R) is below 5 Ohms, you will not be able to further reduce voltage below 6.5v (otherwise the motor driver will not work properly). Then you have to increase the perimeter wire resistance (R) by using a power resistor in series with your perimeter wire. Important: your power resistor must be suitable for the power! In the example above usng a 12 Ohm power resistor, it should be a 10 Watt type. | |
− | + | ||
− | + | ||
− | + | ===Sender automatic standby=== | |
+ | The sender can be switched off during the time the robot is in the charging station. To detect the robot, a current sensor (INA169, 5A) is connected between the charger and the charging pins. | ||
− | + | ===Sender diagnostics=== | |
+ | The perimeter sender status is indicated by the sender LED (Arduino Nano LED): | ||
+ | * ON: perimeter wire loop is closed and working | ||
+ | * OFF: perimeter wire loop is opened and not working | ||
+ | * blinking: robot is charging and perimeter will be switched OFF (energy saving) | ||
− | + | To find errors (or to better understand the sender), open the serial console via Arduino IDE (CTRL+SHIFT+M) at 19200 baud. Now you can see the possible states (robot in charging station, robot outside charging station etc.): | |
− | + | ||
− | + | ||
− | |||
− | |||
<gallery> | <gallery> | ||
− | File: | + | File:Perimeter_sender_console.png | Perimeter sender console output |
− | + | ||
− | + | ||
</gallery> | </gallery> | ||
− | === | + | ==Receiver== |
− | + | ||
− | <gallery> | + | [[File:Perimeter_v2_receiver_circuit.png |400px]] |
− | File: | + | |
+ | For receiving the signal, we use a coil (100 mH or 150 mH) in upright position (centered at front in robot) connected to an LM386 operational amplifier (to amplify the received signal). When using the [https://www.marotronics.de/Schleifenempfaenger-Kit-perimeter-receiver-Kit LM386 module], capacitor C3 on the LM386 module should be bypassed (which is needed so that the LM386 generates a signal between 0..5V and not the default range -5V..+5V). The LM386 output pin should be connected to an analog Arduino pin ('pinPerimeterLeft'). | ||
+ | |||
+ | <gallery> | ||
+ | File: Ardumower_chassis_components.png | Perimeter coil position | ||
+ | File: Ardumower_coil_position.jpg | One centered, upright coil | ||
+ | File: Ardumower_lm386_circuit.png | LM386 module schematics | ||
+ | File: Dcdc_noise.jpg | NOTE: Keep away coil/pre-amplifier from DC/DC converters | ||
+ | File: Tire_coil_distance.jpg | Tire-coil distance effecting rotation angle | ||
</gallery> | </gallery> | ||
− | |||
− | + | [https://www.marotronics.de/Schleifenempfaenger-Kit-perimeter-receiver-Kit You can get the receiver kit in the shop] | |
− | |||
− | |||
− | |||
− | |||
− | + | '''NOTE''': It's recommended to directly mount the coil on the amplifier module. This ensures the 'small signal' of the coil is not distorted by other components (motors, DC/DC converters etc.). | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | '''Note''': Leave out capacitor 4.7nF in latest software versions ('using differential signal'). | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ===Settings=== | ||
<gallery> | <gallery> | ||
− | File: | + | File:Cheat_sheet.png | Perimeter settings |
− | + | ||
− | + | ||
</gallery> | </gallery> | ||
− | + | 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 | ||
− | + | ===Coil/amplifier-to-motor distances=== | |
+ | Ensure all minimum distances to the following components: | ||
+ | * Coil to gear motor: > 15cm | ||
+ | * Coil to mower motor: > 10cm | ||
+ | * Coil to DC/DC converter: > 10cm | ||
− | < | + | <gallery> |
− | + | File: Dcdc_noise.jpg | NOTE: Keep away coil/pre-amplifier from DC/DC converters and motors! | |
− | + | </gallery> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | </ | + | |
− | + | ===Signal measurements=== | |
− | + | The sender / coil / LM386 amplifier outputs should look like this: (for more details about the signal, see section signal above) | |
+ | <gallery> | ||
+ | File: Perimeter_signal_steps.png | Perimeter signal at sender, receiver coil, and LM386 (principle) | ||
+ | File: coil_signal_without_capacitor.png | sender signal, coil signal (5V sender, 5 ohm loop - blue: perimeter, yellow: coil, gray: LM386 amplifier out) | ||
+ | File: Perimeter2_sender_open.jpg| Sender signal (6.5V, open perimeter) | ||
+ | File: Lm_output_dc_noise.jpg | LM386 output, with DC noise | ||
+ | </gallery> | ||
− | + | ===Receiver ADC calibration=== | |
+ | [[File:warning.png]] 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'). | |
− | + | ||
− | + | ||
<gallery> | <gallery> | ||
− | File: | + | File: perimeter_v2_sig_symmetric.jpg | symmetric signal when sender is on (after ADC calibration) |
+ | File: perimeter_v2_sender_off.jpg | zero signal when sender is off (after ADC calibration) | ||
</gallery> | </gallery> | ||
− | ==Receiver== | + | ===Receiver diagnostics/troubleshooting=== |
− | + | The receiver signal, filter result and signal quality can be monitored via Android phone (pfodApp->Plot->Perimeter): | |
− | + | <gallery> | |
− | + | File: Perimeter_snr.png | Signal-to-noise ratio (SNR) | |
− | <gallery> | + | File: Perimeter_signal_38khz.png | signal, filter result, LP filter result, inside/outside, counter, on/off, quality |
− | File: | + | File: Perimeter_plot_moving_from_inside_to_outside.png | Moving from inside to outside |
− | File: | + | File: Perimeter_plot_signal_strength.png |
− | File: | + | File: Perimeter_v2_plot_new.png |
+ | File: Ardumower_perimeter2_test.jpg | ||
</gallery> | </gallery> | ||
− | + | 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 <b>perimeter tracking</b> | ||
+ | smag: filter result, low-pass filtered, without sign (smooth mag) - this is used for <b>'sender-off' detection</b> | ||
+ | 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 <b>perimeter boundary detection</b> | ||
+ | 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: <b>signal quality</b> (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 | ||
− | == | + | ==Broken perimeter wire== |
− | + | Once in a while your perimeter wire may get broken, and your perimeter loop resistance will probably increase to a few Megaohms (MOhm). If that is the case, you can find the location of the break like this: | |
− | + | ||
− | + | # Using a metal plate, plug one wire of the perimeter sender output into earth ground (the other wire of the sender output is still connected to the perimeter wire) | |
− | + | # Optional: increase your sender output voltage to 20 Volts (NOTE: the MC33926 driver can NOT operate higher than 28v, and your sender Arduino Nano may not operate higher than 20v) | |
− | + | # Method 1 (using two LM386 amplifiers and earphone): Connect 1st LM386 amplifier (NOTE: do NOT remove capacitor C3!) signal output to a 2nd LM386 input. Connect 2nd LM386 output to an earphone. | |
− | + | # Method 2 (using one LM386 amplifier and a PC): Connect the LM386 amplifier (NOTE: do NOT remove capacitor C3!) signal output (signal and GND) to your PC's microphone input, launch the [http://www.grauonline.de/alexwww/ardumower/oscilloscope/oscilloscope.html web oscilloscope], and switch into frequency view (choose visualization 'frequency spectrum') | |
− | + | # Turn on the perimeter sender - while traversing the perimeter wire, you will notice a peak frequency of 3.2 Khz in the Web oscilloscope | |
− | + | # Now start at the side of the perimeter wire (the side that is still connected to the perimeter wire), and walk along the perimeter wire - the peak frequency of 3.2 Khz should always be there (and hearable) | |
− | + | # At the location where the wire is broken, the 3.2 Khz frequency is gone (and no longer hearable)! [https://youtu.be/J6X_dktw4ZE Demonstration video] | |
− | + | ||
<gallery> | <gallery> | ||
− | File: | + | File: Peri_broken2.jpg | Plug one wire into ground (earth) |
− | File: | + | File: Peri_broken4.jpg | Method 1: Connect 1st LM386 amplifier output to 2nd LM386 input, 2nd output to earphone |
+ | File: Peri_broken1.jpg | Method 2: Connect LM386 amplifier output to your PC's microphone input | ||
+ | File: Peri_broken3.jpg | Method 2: Launch the web oscilloscope, and set frequency view | ||
</gallery> | </gallery> | ||
Zeile 260: | Zeile 239: | ||
#[http://www.youtube.com/watch?v=FL6K98B2Zsk&feature=player_detailpage#t=265 Perimeter2 demo] | #[http://www.youtube.com/watch?v=FL6K98B2Zsk&feature=player_detailpage#t=265 Perimeter2 demo] | ||
#[https://www.youtube.com/watch?v=QCA6Dm3rs3M 120m perimeter wire test] | #[https://www.youtube.com/watch?v=QCA6Dm3rs3M 120m perimeter wire test] | ||
+ | #[https://www.youtube.com/watch?v=NIer_kITelc Perimeter wire and matched filter theory (German)] | ||
+ | #[https://www.youtube.com/watch?v=VxJN2xb55dU&feature=youtu.be Sender PCB] | ||
+ | #[http://www.youtube.com/watch?v=FGaUSg-uUxk Perimeter stop test] | ||
+ | #[http://www.youtube.com/watch?v=8R8QaffNlJw Perimeter tracking test] | ||
+ | #[http://www.youtube.com/watch?v=CftrnetFVYc&feature=youtu.be Finding and tracking test L50] | ||
+ | #[http://www.youtube.com/watch?feature=player_embedded&v=fjuQViS2rHM Finding and tracking test Rotenbach] | ||
+ | #[http://youtu.be/r4ZMgasMkH0 Magnetic field demonstration video] | ||
=Tracking of perimeter= | =Tracking of perimeter= | ||
Zeile 275: | Zeile 261: | ||
#[http://www.ardumower.de/index.php/en/forum/schleifensensoren-generator/83-ir-bake-generator-empfaenger-diy Another idea for navigation are infrared landmarks] | #[http://www.ardumower.de/index.php/en/forum/schleifensensoren-generator/83-ir-bake-generator-empfaenger-diy Another idea for navigation are infrared landmarks] | ||
#[http://grauonline.de/wordpress/?page_id=364 More details about the matched filter] | #[http://grauonline.de/wordpress/?page_id=364 More details about the matched filter] | ||
+ | #[http://www.grauonline.de/alexwww/ardumower/oscilloscope/oscilloscope.html Sound card oscilloscope including matched filter] |
Aktuelle Version vom 2. Juli 2016, 15:24 Uhr
Inhaltsverzeichnis
Abstract
A perimeter wire (or buried wire fence, BWF) is like a 'virtual fence': it stopps the robot when it reaches its boundaries. A perimeter is not always necessary for all surroundings.
Principle idea: You will install a perimeter loop (a wire) in your garden through which a signal is sent and this signal is detected by the robot. So, you'll need: a sender (to transmit the on the wire) and a receiver (to detect the signal in the robot).
How is the signal detected? The signal is detected by one receiver coils. The closer the distance between coil and perimeter loop, the higher the signal strength. Also, something interesting happens when the robot crosses the perimeter loop: the signal changes its polarity, that means positive and negative voltages reverse each other.
Perimeter
This is the new version of the perimeter sender and receiver (that can be purchased via the shop ).
The perimeter sender outputs a digital code sequence (a 'pseudo-noise' code), and the receiver will detect that code using a software-based digital matched filter. Depending on wheter the match result peak is positive or negative, the robot is inside or outside of the perimeter wire.
Sender principle:
- Sender PCB generates an output signal using an Arduino Nano (about 3 Khz)
- The generated signal is amplified using a motor driver (MC33926), the motor driver output is connected to the perimeter wire (instead of a motor)
Receiver principle:
- A coil receives the signal
- The signal is amplified using an operational amplifier (LM386)
- The Arduino Mega samples the signal using its analog-to-digital converter (ADC) at 9615 Hz
- The digital signal is filtered using a digital filter (matched filter algorithmn)
- The matched filter output is evaluated (for perimeter inside/ouside detection, tracking etc.)
The images below explain why the polarity of the received coil signal changes between inside and outside of the perimeter wire. The image shows the direction of the electric flux lines sent out from the perimeter wire and how they hit the coil for both inside and outside position.
For a better understanding of the perimeter filter, see the Matched filter simulation. For more details about the filter, also see the Matched filter video. Using a simple symmetric signal (which looks equal on positive and negative side of the zero point), you cannot differentiate between an 'inside perimeter' and 'outside perimeter' signal. When the mower is traversing the perimeter loop, the signal polarity changes (positive becomes negative and negative becomes positive). We want to detect this polarity change of the signal. Using an unsymmetrical signal, you can do this. You can see the difference in the simulator. The default signal (slider 'example signal') is a symmetric signal - press the 'Invert' button to invert the signal (change its polarity). In the correlation result (graph 'Matched filter') the polarity can not be detected. Now use an asymmetrical signal ('pseudonoise5_pw'). Press again 'Invert' to change signal polarity. Now you can see polarity of the signal in the filter output (graph 'Matched filter'). It's the sign of the peak (positive or negative sign).
Sender
We use a motor driver as output amplifier and an Arduino Nano to generate the signal. The motor driver is driven by 3.2 Khz (two pulse widths 4808 Hz and 2404 Hz). We use a motor driver with integrated current limiting and thermal switch-off (e.g. MC33926).
The perimeter wire length should be in the range 20m - 450m and must be at least 5 Ohm and not more than 12 Ohm. The maximum perimeter area is 1000 m2.
MC33926 wiring: The perimeter wire is connected between MC33926 M1OUT1 and M1OUT2.
Sender software
NOTE: If you have never worked with Arduino before or if your Arduino Nano does not seem to respond, please read our 'Arduino first steps' introduction.
Download: You can find the sender code in the 'sender' folder of the Ardumower Download
Note: Always verify that the pin configuration in your Arduino code (sender.ino) matches your actual circuit!
Sender power control
The perimeter wire resistance (R) must be at least 5 Ohm and not more than 12 Ohm. Ideally, a 12 ohms (50W) power resistor is placed in series with the perimeter wire, so you get a total resistance of the perimeter wire at 12-15 ohms.
To change the power (current/voltage) of the sender, proceed like this:
The motor driver output voltage can be changed between 6.5-12V via the potentiometer on the DC/DC converter. Adjust the potentiometer so that not more than 1 Ampere current flows.
Example:
Your perimeter wire resistance (R): 12 Ohm Your adjusted voltage at the DC/DC converter: 8 Volt
The consumed current and power is then:
Current: I = U / R = 8 Volt / 12 Ohm => 0.7 Ampere Power: P = U * I = 8 Volt * 0.7 Ampere => 5.6 Watt
Power resistor: If your perimeter wire resistance (R) is below 5 Ohms, you will not be able to further reduce voltage below 6.5v (otherwise the motor driver will not work properly). Then you have to increase the perimeter wire resistance (R) by using a power resistor in series with your perimeter wire. Important: your power resistor must be suitable for the power! In the example above usng a 12 Ohm power resistor, it should be a 10 Watt type.
Sender automatic standby
The sender can be switched off during the time the robot is in the charging station. To detect the robot, a current sensor (INA169, 5A) is connected between the charger and the charging pins.
Sender diagnostics
The perimeter sender status is indicated by the sender LED (Arduino Nano LED):
- ON: perimeter wire loop is closed and working
- OFF: perimeter wire loop is opened and not working
- blinking: robot is charging and perimeter will be switched OFF (energy saving)
To find errors (or to better understand the sender), open the serial console via Arduino IDE (CTRL+SHIFT+M) at 19200 baud. Now you can see the possible states (robot in charging station, robot outside charging station etc.):
Receiver
For receiving the signal, we use a coil (100 mH or 150 mH) in upright position (centered at front in robot) connected to an LM386 operational amplifier (to amplify the received signal). When using the LM386 module, capacitor C3 on the LM386 module should be bypassed (which is needed so that the LM386 generates a signal between 0..5V and not the default range -5V..+5V). The LM386 output pin should be connected to an analog Arduino pin ('pinPerimeterLeft').
You can get the receiver kit in the shop
NOTE: It's recommended to directly mount the coil on the amplifier module. This ensures the 'small signal' of the coil is not distorted by other components (motors, DC/DC converters etc.).
Note: Leave out capacitor 4.7nF in latest software versions ('using differential signal').
Settings
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
Coil/amplifier-to-motor distances
Ensure all minimum distances to the following components:
* Coil to gear motor: > 15cm * Coil to mower motor: > 10cm * Coil to DC/DC converter: > 10cm
Signal measurements
The sender / coil / LM386 amplifier outputs should look like this: (for more details about the signal, see section signal above)
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
Broken perimeter wire
Once in a while your perimeter wire may get broken, and your perimeter loop resistance will probably increase to a few Megaohms (MOhm). If that is the case, you can find the location of the break like this:
- Using a metal plate, plug one wire of the perimeter sender output into earth ground (the other wire of the sender output is still connected to the perimeter wire)
- Optional: increase your sender output voltage to 20 Volts (NOTE: the MC33926 driver can NOT operate higher than 28v, and your sender Arduino Nano may not operate higher than 20v)
- Method 1 (using two LM386 amplifiers and earphone): Connect 1st LM386 amplifier (NOTE: do NOT remove capacitor C3!) signal output to a 2nd LM386 input. Connect 2nd LM386 output to an earphone.
- Method 2 (using one LM386 amplifier and a PC): Connect the LM386 amplifier (NOTE: do NOT remove capacitor C3!) signal output (signal and GND) to your PC's microphone input, launch the web oscilloscope, and switch into frequency view (choose visualization 'frequency spectrum')
- Turn on the perimeter sender - while traversing the perimeter wire, you will notice a peak frequency of 3.2 Khz in the Web oscilloscope
- Now start at the side of the perimeter wire (the side that is still connected to the perimeter wire), and walk along the perimeter wire - the peak frequency of 3.2 Khz should always be there (and hearable)
- At the location where the wire is broken, the 3.2 Khz frequency is gone (and no longer hearable)! Demonstration video
Videos
- Perimeter2 demo
- 120m perimeter wire test
- Perimeter wire and matched filter theory (German)
- Sender PCB
- Perimeter stop test
- Perimeter tracking test
- Finding and tracking test L50
- Finding and tracking test Rotenbach
- Magnetic field demonstration video
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.