DIY Perimeter Wire Generator and Sensor | RobotShop Community

This tutorial explains in an easy and intuitive way to help you understand the theory, design and implementation to make your own generator and sensor for a perimeter wire. The files (Schematics, Eagle Files, Gerbers, 3D Files and Arduino Sample Code) are also available for download. This way, you can add the wire perimeter detection feature to your favorite robot and keep it within an operating “zone”. How cool is that!


This is a companion discussion topic for the original entry at https://community.robotshop.com/blog/show/diy-perimeter-wire-generator-and-sensor

Thanks for putting this together, gave me a great idea on how to expand an already budding idea? One of the best posts I have read. I loved it. Thanks for sharing with us.

@Anna Thank you for reading and for your nice feedback

Have you tried this setup in actual field use? I have serious doubts on the reliability in a real world situation. Since you did not use any kind of a pilot tone on the transmit side and a PLL like the LM567 on the receiver side, I am afraid normal 60 stray fields would swamp your receiver and render it deaf to the desired signal. Commercial versions of wireless loops always have a pilot tone. PS Where it asks for my website on your reply form, it will not accept my website, (www.salvage-1.com), and keeps asking for my URL

@Gary Yes, we have actually tested this setup outdoor with a 100" 22AWG wire forming a 625 Sq.ft surface area. The receiver (tank circuit) was able to detect a 36kHz square wave generated by the generator circuit at 6 inches from the wire by generating a sine wave with an amplitude of 2V and 36kHz frequency. By further approaching the receiver’s inductors to the wire, the amplitude of the output signal of the receiver becomes higher and saturates at 5V (the in inductors axis should be perpendicular to the loop wire axis).
You are correct, a pilot tone on the transmitter and a tone decoder on the receiver would greatly improve the perimeter wire generator/receiver circuits. However, since our aim for using this setup is only to detect if a wire is present (or at most, how near the wire is to the receiver) to be used in robotic applications and not intended to transmit any data from the generator to the receiver, a simple NE555 generator and tank circuits would suffice.
As for your website, please try to enter it as " http://www.salvage-1.com/ "

Hello M.Daouas,
Thanks you very much for your explication and sharing this great solution, I’m student from France sorry for my english. I have a question, I want to know, How we can program this on Arduino (the real code). I start on Arduino this year and in my project I want to change the direction of motor when he detect peripheral cable. You say, we put analog input on a analog pin of Arduino ?

@BAZEGA Haris Thank you for reading. Correct, the sensor board outputs two analog signals (0-5V) proportional to the distance between the inductor and the perimeter wire. By connecting the sensor board’s analog outputs to 2 analog pins, the Arduino will be able to read this signal and the RAW value will vary from 0 to 1023. Please refer to the analogRead() function for more information and a sample Arduino code.
Depending on how you are controlling your motor from the Arduino (generally a PWM output pin is used for rotation speed and a digital output pin is used for direction, in case you are using a DC Motor driver with the Arduino board), you can reverse the direction of the motor in your code by changing the state of the direction pin based on a threshold from the sensor’s output. For example, if the outputs of the sensor board is connected to analog pin 0 and 1 on the Arduino, you can set a threshold based on the detection distance you want between the perimeter wire and the inductors. As soon as this threshold is reached on one of these pins, you can change the direction of rotation of the motors by changing the state of the direction pin as mentioned above. You can find online a lot of sample codes to help you start coding with Arduino and controlling a DC Motor.

Thanks you for your answer. I have one question.
I want to make your solution on PCB and the question is, the two capacitors on sensor board (LC circuit) have polarisation or not ?

@BAZEGA The capacitors on the sensor board are 2 x 22nF ceramic capacitors and they are not polarized.

Hello M.Daouas where we can buy a 1mH Inductors with a current rating of 420mA and a Q factor of 40 @ 252kHz ?

@Bazega This can be found on Digikey or Mouser.

Can a 1mH Inductors with a current rating of 510mA and a Q factor of 20 @ 252kHz work well ?
Or 1mH Inductors with a current rating of 420mA with a Self resonant frequencyof 1,6MHz Should be better?

1 Like

@Mohamed In theory, both 1mH inductors should work since the only parameters that affect the receiver’s resonance frequency are the capacitance of the capacitor and the inductance of the coil (f0 = 1/(2π√(L*C))).
As indicated in the article, L = 1mH and C = 22nF should provide a resonance frequency of 33 932 Hz which is in the range of the output square wave frequency (32 698Hz to 43 956Hz).
However, for your information, the Q factor (quality factor) of an inductor is the ratio of its inductive reactance to its resistance, therefore, it measures the effeciency of an inductor in a given frequency. The higher the Q factor, the closer it approaches the behavior of an ideal inductor.

Could you share the C code used for this implementation

@Fredo We used an analogread on the sensor board output pins. You can find an Arduino example code for the analogread function through this link.

Is it possible to buy these boards pre-made so I can throw into a project with the code?

@Michael We unfortunately don’t offer the generator and sensor boards. You can send the gerber files to any PCB manufacturer to produce it and assemble the components based on the provided BOM.

I have a ~11 years old Robomow RL-1000 still working fine. Have not found out what signal is being sent by the charging/perimeter station and don’t have access to an oscilloscope, anyone knows the signal type?
Could the sensor in this blog sense the signal from the charging/perimeter station?
If so, I would not need to build the generator, only the sensor. The total length of the wire is by the way ~150 meters.

Hi Thomas,
Unfortunately, the Robomow RL-1000 signal generator is a closed product design. We don’t know what type of signal and at which frequency is being sent from the generator into the perimeter wire. It would, most likely, be a specific signal that will only be detected by the sensors on the Robomow, therefore, it won’t work with the sensor discussed in this blog article.

Hi Brahim,
Could the circuits be tuned to provide sub-millimetre accuracy? I would like to use this for alignment of mechanical components to a stretched conductor acting as a reference.

Thanks!