Wire searching tool PDF Print E-mail
Written by Dario Greggio   
Thursday, 14 September 2006

This Articles discusses a rather uncommon PIC solution to a fairly common problem, how to locate wiring inside walls.....A simple solution is presented, allowing an AM transmittor to be built using just a PIC and a few common parts, converting your house wiring into a transmittor. All you then have to do is follow the cabling with a standard AM radio and see where it goes! Be warned only experience  and qualified Electrician's should try this. Please ensure all electricity is turned off to the cabling before using this design! This is intended to be used for searching for unconnected wires.

Please note all code is released AS-IS and should used at the users own risk, no guarantee is made by PICcoder.co.uk or the author with regards to the accuracy of the diagrams or code contained in this article.

Discuss this article on the forums. (5 posts)

zip PIC Source Code 7.22 Kb

pdf Schematic 9.22 Kb


The idea came from a friend who works as Cable Guy, that is he installs telephone wires (subnets) inside offices, computer networks, and sometimes electrical wires (plants) too.
 
He asked: “I’d need a device to look for wires inside the wall passages (pipes, etc)…”

1MHz carrier I answered that such a device already exists. But he replied: “those you find out there, need to be connected on both sides to check for which wire is which: I’d like to have one that only needs to be connected on one side, then you have a (small) receiver to go around and find the other side without connecting!”

I got it. I supposed that a transmitter, probably in a range of around 500 KHz or up to, say, some MHz would have been ok: you connect it on one side (couple of wires, for instance telephone), and you go checking for the signal on the other side. Wires become an antenna, propagating the RF signal down the way, to the other end. A simple analog oscillator (Colpitts, those old things from the CB age) should have done the thing. And, maybe, some whistle was needed to modulate the carrier and making it recognizable. But, then… The idea struck me: why not use a PIC? Will we be able to create a 1MHz signal? Sure. Modulating it with a 1KHz tune? Guess so. And, as for the receiver, a simple old radio in AM (those who are sold in street market for cheap) would have proven perfect.

I decided to use a PIC16F628, for which I had a PCB already done and easily reusable for different devices. In Assembler, I thought that the 1MHz waveform could be generated via interrupt, leaving in the main loop the modulation task. Unfortunately, at 20MHz, we have only 5 cycles per uSec, and even the simplest interrupt handler needs some 8-10 of them, plus the bit-toggle thing. No way.

To tell the truth, we could have been using 100-200KHz… the old Long-Wave range: but such a receiver is harder to find, if any; and building one from scratch was… a waste of time. So, I decided to use a Timer. At the beginning, I was skeptical about this approach, because I’d have found it harder to achieve the modulation. But I realized that it was not difficult at all: use PWM, and turn it on and off as you need.4KHz modulating carrier

Thus, I came up with a 1MHz PWM (CCP2) with a 50% duty-cycle, and in the main loop I wrote a delay-loop schema to modulate that PWM with a hearable tune. To make it more flexible, I wrote a routine that could play 16 small bits, that is, for every “1” value the carrier is on, and for every “0” the carrier is off. Each bit (step) lasts for around 100mSec, and this way a letter in Morse Code-style can be easily generated (in the code, this is a “A”, that is dot-line followed by pause: 1 0 0 0  1 1 1 0  0 0 0 0  0 0 0 0) Of course, this could be extended to more steps than 16: there’s plenty of ROM!

The PWM is switched on and off every 250uSec to generate a 4KHz note, when needed. When silence is desired, the PWM is constantly on. Waveforms are shown in the pictures.
 
The last step was some kind auto-switch off feature. I created a counter that reaches zero after 5 minutes, then the PIC goes into Sleep Mode; despite specifications of data-sheet, the consumption goes to 350uA compared to 15uA, so probably I’m missing something! (maybe somebody can help).

100mSec bits of whistle @ 4KHz The schematic is very easy: just a PIC, a Zener diode plus a resistor for the power supply, an LED to indicate working firmware, some resistors and capacitors, and the crystal.Ah, as I’m a fan of overclocking, the crystal is set at 24MHz: I’ve been using 16F628 at 5Vcc at 24MHz for years, and everything seems ok (to tell the truth, the device operates from 4 NiMh batteries, thus 4.8V). In this case, using a 24MHz timebase allows the generation of a 1MHz PWM with 50% duty-cycle, that could not have been created with a 20MHz (non-integer divider).

The inductor at the output helps getting a better sine-wave, and stop harmonics, but is not mandatory.

Just connect all the parts together, and burn the firmware. Then apply 50cm of wire at the output, and place a AM radio in the range of 50cm from the “antenna”: tune into 1MHz (1000KHz) , and you should hear the “A” code!

Another uncommon use for a PIC: AM transmitter.Cool
 
Feel free to contact me for whatever question!
 
Dario Greggio
 
Last Updated ( Tuesday, 10 October 2006 )