Silicon ChipPhonome: Call, Listen In & Switch Devices On & Off - June 2001 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Silicon Chip: on the upward path
  4. Feature: A PC To Die For - And You Can Build It For Yourself by Greg Swain
  5. Feature: Weird & Wonderful: New Generation Pilotless Aircraft by Bob Young
  6. Feature: Win Two Uniden Mini 2-Way Radios by Silicon Chip
  7. Project: A Fast Universal Battery Charger by John Clarke
  8. Project: Phonome: Call, Listen In & Switch Devices On & Off by Leon Williams
  9. Book Store
  10. Feature: Using Linux To Share An Internet Connection; Pt.2 by Greg Swain
  11. Project: Li'l Snooper: A Low Cost Camera Switcher by Jim Rowe
  12. Project: A PC Games Port Tester by Trent Jackson
  13. Order Form
  14. Product Showcase
  15. Back Issues
  16. Vintage Radio: The miniature STC A-141 mantel radio by Rodney Champness
  17. Notes & Errata: PowerPack, AA-cell White LED Torch, LP Doctor, 4-digit Counter
  18. Market Centre
  19. Advertising Index
  20. Outer Back Cover

This is only a preview of the June 2001 issue of Silicon Chip.

You can view 33 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • A PC To Die For - And You Can Build It For Yourself (June 2001)
  • A PC To Die For - And You Can Build It For Yourself (June 2001)
  • A PC To Die For; Pt.2 - You Can Build It Yourself (July 2001)
  • A PC To Die For; Pt.2 - You Can Build It Yourself (July 2001)
  • A PC To Die For; Pt.3 - You Can Build It Yourself (August 2001)
  • A PC To Die For; Pt.3 - You Can Build It Yourself (August 2001)
Articles in this series:
  • Unmanned Air Vehicles: A Force To Be Reckoned With (April 2001)
  • Unmanned Air Vehicles: A Force To Be Reckoned With (April 2001)
  • Global Hawk: America's Advanced Unmanned Aircraft (May 2001)
  • Global Hawk: America's Advanced Unmanned Aircraft (May 2001)
  • Weird & Wonderful: New Generation Pilotless Aircraft (June 2001)
  • Weird & Wonderful: New Generation Pilotless Aircraft (June 2001)
Items relevant to "A Fast Universal Battery Charger":
  • ETD29 transformer components (AUD $15.00)
  • Wiring diagram for the Multi-Purpose Fast Battery Charger II (Software, Free)
  • Multi-Purpose Fast Battery Charger II PCB patterns (PDF download) [14106011, 14302982] (Free)
  • Panel artwork for the Multi-Purpose Fast Battery Charger II (PDF download) (Free)
Articles in this series:
  • A Fast Universal Battery Charger (June 2001)
  • A Fast Universal Battery Charger (June 2001)
  • A Fast Universal Battery Charger; Pt.2 (July 2001)
  • A Fast Universal Battery Charger; Pt.2 (July 2001)
Items relevant to "Phonome: Call, Listen In & Switch Devices On & Off":
  • PIC16F84(A)-04/P programmed for the Phonome [DIALUP.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Phonome [DIALUP.HEX] (Software, Free)
  • Phonome PCB pattern (PDF download) [12106011] (Free)
  • Panel artwork for the Phonome (PDF download) (Free)
Items relevant to "Using Linux To Share An Internet Connection; Pt.2":
  • Linux script files for Internet Connection Sharing (Software, Free)
Articles in this series:
  • Using Linux To Share An Internet Connection; Pt.1 (May 2001)
  • Using Linux To Share An Internet Connection; Pt.1 (May 2001)
  • Using Linux To Share An Internet Connection; Pt.2 (June 2001)
  • Using Linux To Share An Internet Connection; Pt.2 (June 2001)
  • Using Linux To Share An Internet Connection; Pt.3 (August 2001)
  • Using Linux To Share An Internet Connection; Pt.3 (August 2001)
  • Using Linux To Share An Internet Connection; Pt.4 (September 2001)
  • Using Linux To Share An Internet Connection; Pt.4 (September 2001)
Items relevant to "Li'l Snooper: A Low Cost Camera Switcher":
  • Li'l Snooper PCB pattern (PDF download) [02106011] (Free)
  • Panel artwork for the Li'l Snooper (PDF download) (Free)
Items relevant to "A PC Games Port Tester":
  • Games Port Tester software and labels (Free)

Purchase a printed copy of this issue for $10.00.

Just like ET, with this project you can phonome from anywhere in the universe. Unlike ET, when you phonome, you’ll be able to do lots of things, like turn devices on and off, monitor things, listen to sounds in your home and much more. Best of all, it’s completely legal because no connection is required to your phone or line. No alien visitors here! Phonome by Leon Williams 34  Silicon Chip I Phonome Feature s transmitted down the ’m sure there have telephone line when been many times ! PIC microcontroller based you press the keys on when you have been ! Independently control any modern telephone away from home – perhaps 2 relay outputs ! Monitor 2 opto-co keypad. on holidays – and wonupled inputs ! No direct connectio dered if you’ve forgotten to A normal telephone n to telephone line turn something on or off. keypad has only 12 but! Controlled by a ton e telephone anywhere in the world Or perhaps you would tons - 0-9, # and *. But ! Dial in and listen to any sounds in your ho have liked to monitor the there are actually 16 us e ! Easy to recognise multiple frequency ton alarm system or feed the tones that can be genere res ponses ! 6 digit password pro tection goldfish or wondered if ated because one tone is ! EEPROM stores pa the dog is barking. Maybe made from a bank of four ssword in case of powe r failure ! Intelligent ring detectio the next-door-neighbour low tones and one from a n ! Powered from low has called your mobile bank of four high tones. power 12V plug pack to say there are noises DTMF tones are used all ! Cheap and easy to build coming from your home. over the world, so no matYou’d love to be able to ter where you are, whether “listen in” to home before using a pay phone, a house couple of relay outputs and calling the Police. phone or even a mobile some opto-isolated signal inputs for With the Phonome you can do all phone you will be able to access the you to do or control anything you wish. this and much more. Phonome. Of course old-style decadic or pulse-dialing telephones are not The Phonome (phone home, geddit?) Not every phone will do suitable – but these are fairly rare these is a PIC-microcontroller-based unit For the Phonome to work you will days anyway. that sits alongside your hands-free teleneed to have a telephone that has a phone or speaker-phone. No connections speaker button that when pressed anIt listens for a ring from the teleswers the call, enables hands free operphone and when that ring is detected, The unique feature of the Phonome ation, and when pressed again releases it operates a solenoid that presses the is the way it interacts with the telethe call. There is a large range of these speaker button on the telephone to phone, without actually connecting to telephones on the market and many of answer the call. The Phonome then the telephone line. By not connecting the cordless telephone base stations listens for a DTMF password from directly to the telephone line we avoid also incorporate these features. the speaker. the expense and complexity of having We use this push button and the to comply with the normal regulatory If it gets that password, it maintains speaker to avoid having to connect rules. the call, allowing you to control things anything to the phone or line. by pressing keys on your telephone, To answer and release calls, a leThe Phonome accepts DTMF tones. or simply to listen in via the speakver operated by a solenoid is used to DTMF stands for Dual Tone Multiple er-phone. When you are finished, you press down the speaker button on the Frequency, a universal system used for enter a command that operates the telephone for about one second. An signaling over telephone lines. DTMF solenoid again releasing the call. electret microphone in the Phonome tones are made up from two separate box then acoustically receives DTMF What things can you control? That’s tones, generated simultaneously and tones from the telephone speaker. entirely up to you. We simply provide a The “Phonome” control box, showing the holes drilled in the side for the speaker and also the electret microphone glued in position. June 2001  35 Table 1:Key Commands 1 2 3 4 5 6 * # Turn ON relay 1 Turn OFF relay 1 Turn ON relay 2 Turn OFF relay 2 Read Input 1 Read Input 2 Change Password End the call Conversely, tone responses from the Phonome are generated by an internal speaker which are picked up by the telephone’s microphone. To detect an incoming call, the Phonome uses the microphone to listen for bursts of sound and decides if it is a valid call or if it is spurious noises, which it rejects. Normal ring signal is comprised of a 400ms burst, 200ms silence, 400ms burst and a 2-second silence, which can easily be distinguished from noise. To allow us to do all these things simply and reliably, a PIC 16F84 microcontroller is used to perform all the control functions. By using a microcontroller we can also have nice features such as password checking, idle time protection, informative tone responses and ring training. Ring training is used to train the Phonome to the particular ring cadence that your telephone emits. More about this and the other special features later. Apart from the solenoid assembly the project is constructed on a single PC board and housed in a plastic box. Power is supplied from an unregulated 12V DC 500mA plugpack. Commands The Phonome responds to DTMF tones that are sent each time you press a key on the telephone. Table 1 shows the possible commands, with the corresponding telephone key. Note that there must be two # key presses in a row to end the call. If any key not shown in Table 1 is pressed, it is ignored and an error tone is returned. Tones Various audible responses are generated by the loudspeaker. Because this is the only communication between the Phonome and you, the responses have been chosen to be informative and easy to recognise. The responses range from a single burst of tone (called a beep) to a multiple combination of different frequency tones, ranging from 500Hz to 2100Hz. Once you hear the responses a couple of times you will quickly become familiar with them. Table 2 describes the responses and the associated tones. Circuit description The circuit is shown in Fig.1. As Table 2:Phonome Beep Translation Tone name When tone heard Tone (beep) description Power When the unit is powered up 1 long medium frequency Answer After ring is detected and the solenoid is operated to answer the call. 20 short high frequency Connected When a correct password is decoded. 3 short rising frequency Password At the start and end of changing a password. Also heard after programming default values has finished 6 short medium frequency Off When a tested input is off, or a relay is turned off. 1 long low frequency On When a tested input is on, or a relay is turned on 2 short rising frequency One Indicates relay 1 or input 1. 1 short medium frequency Also heard at the start of DTMF testing. Two Indicates relay 2 or input 2. Also heard at the start of ring training. 2 short medium frequency Error When an unknown key is pressed, or the first password attempt is wrong. 4 long low frequency Finished When the call is about to be terminated. 4 long descending frequency 36  Silicon Chip you can see the heart of the design is the PIC chip (IC1) which does all the hard work. The PIC chip used here is a 16F84 and has been used in many Silicon Chip projects. It has 1K of ROM, 68 bytes of user RAM and 64 bytes of non-volatile EEPROM. The EEPROM holds the password and other data in case of a power failure. When power is restored, the data is read from the EEPROM into RAM for program use. Like all microcontrollers it needs to be programmed with the correct instructions. These instructions come in a file called DIALUP.HEX, and more details about this and how you get it are at the end of the article. Firstly, let’s have a look at the analog input circuit (see Fig.1). DTMF tones are received by the electret microphone, which obtains DC bias via a 10kΩ resistor. The small audio signals from the microphone are capacitively coupled to amplifier IC1b, an inverting op amp. Here the signal is amplified about 4 times. A .001µF capacitor provides low pass filtering in an effort to eliminate high frequency noise so that the DTMF detector has an easier time decoding the digits. From IC1b the signal goes in two directions. The first path is to IC1a, another op amp which provides a variable gain up to about 25. The variable gain is accomplished by adjusting trimpot VR1, and is included to raise the level of the DTMF signals to suit the following DTMF decoder. Once again a .001µF capacitor provides low pass filtering. The output signal is coupled by a .01µF capacitor into the DTMF detector IC2. Note also that the inter stage coupling capacitors are reduced in value to help keep out low frequency signals such as 50Hz hum. Although the DTMF signals pass through the telephone network, get reproduced by a speaker, are picked up by a microphone and amplified, the DTMF decoding has proved to be very reliable. The second path for the microphone signal is on to op amp IC1c. IC1c provides a variable gain up to about 25, made adjustable by trimpot VR2. This adjustment sets the detection level for the ring bursts. From IC1c, the signal passes to IC1d which is configured as a comparator. The output of a comparator rests at ei- Fig. 1: the Phonome circuit diagram. June 2001  37 ther rail until the input signal exceeds the threshold level. The threshold level is determined by the ratio of the 47kΩ and 470kΩ resistors connected to pin 12. When this level is exceeded the output of IC1d swings between the rails, so IC1d is acting like a very high gain amplifier. This high level signal is then passed to a charge pump rectifier (D1 and D2) which charges the 1µF capacitor. The rectifier capacitor values are deliberately small so that the voltage on the 1uF capacitor closely follows the ring cadence. Transistor Q1 inverts the voltage to logic levels for the PIC input, such that a burst of ring is a low and silence is a high. Transistor Q2 lights LED1 when the ring burst is active, and provides a visual aid when setting trimpot VR2. A 15kΩ and a 10kΩ resistor supply a 2V reference point for the op amps, while the 10µF capacitor provides filtering. IC2 is a MC145436 DTMF detector and accepts audio signals from IC1a via pin 7. This chip is quite popular, and here it is used in its basic form. The outputs are permanently enabled by taking the Tri-state enable pin high, and the internal oscillator function Fig.2: component overlay of the Phonone. Only the microphone, speaker and jacks mount off the PC board. 38  Silicon Chip is used. When a valid DTMF tone is received on pin 7, it takes pin 12 (Data Valid) high and the hexadecimal value of the tone is output on the data pins 1, 2, 13 and 14. Transistor Q3 turns on LED2 when Data Valid goes high and is used while setting the correct position of trimpot VR1. Pins 9 and 10 are the oscillator pins and a common 3.5795MHz crystal is used. To save the cost of using another crystal, a divide-by-8 clock output (447kHz) at pin 11 is used for the PIC clock. So much for the input circuit. Now let’s look at the main circuit incorporating the PIC chip. Pin 4 is the reset pin and is simply tied to +5 volts by a 100Ω resistor. The PIC has a built-in intelligent reset circuit and this should prove to be adequate in this application. As discussed above, the PIC uses an external clock input provided by the DTMF decoder. This is input on pin 16, while the other clock pin (pin 15) is not used and left open. While 447kHz is a relatively low frequency for a microcontroller, the PIC still has plenty of time to complete its functions. However, the software must on occasions take into consideration the slow clock rate (instruction cycle time about 8.94µS). An example is the tone generation routines that turn on and off the output pin at the tone frequency rate. Port A has five pins associated with it and all are programmed as inputs. RA0 to RA3 accept the hexadecimal DTMF code, while RA4 monitors the Data Valid line. Port B is configured so that pins RB0 to RB3 are inputs while RB4 to RB7 are outputs. The ring signal waveform is monitored on RB0. The software monitors this pin and measures the time the input is low and the time it is high over a 6-second period. If the low and high times fall within the programmed values held in the internal EEPROM, then the signal is considered valid ring. Pin RB1 is checked at power up. If it is low (by shorting the password pins together on the PC board) the PIC goes into the special features mode. More about this later. Under a normal power up RB1 is read high because of the 10kΩ pull up resistor and normal operation continues. RB2 and RB3 are connected to opto couplers. They are normally held high by the 10kΩ pull resistors but are pulled low when current flows in the opto-coupler LEDs. A diode and a resistor provide polarity and over current protection for each opto-coupler input. When current flows into the opto-coupler LED, the PIC pin is pulled low and the PIC reads this as ON. Pin RB4 drives a power Mosfet (Q7) that switches the solenoid. When the PIC pin is high, the solenoid is ener- Inside the Phonome control box. The plugpack and solenoid connections are on the left while the right terminal blocks are for inputs and outputs. Note the electret microphone glued in position on the upper case wall with the speaker alongside. gised. Diode D5 is included to limit reverse voltage spikes generated by the inductive solenoid. Pin RB5 is the output that is toggled high and low by the software at the tone audio frequency. This drives transistor Q6 which in turn drives the speaker. A 22Ω resistor limits the current drawn when the transistor is on and consequently determines the volume of the tones. A speaker and the necessary driver software was used rather than a simple piezo buzzer, because it allows tones of different frequencies to be generated. Pins RB6 and RB7 drive transistors that independently operate two SPDT relays (RLY1 and RLY2). Each relay coil has a diode in parallel to limit reverse voltage spikes and a 47Ω resistor is included between the coils and the unregulated supply rail. This rail will probably be greater than 12V and considering that the relays may be energised for long periods, the resistors drop the voltage to limit the heat generated in the coils. The power supply is relatively straightforward, with a 7805 regulator (REG1) providing a regulated +5V to the electronics. Diode D8 provides reverse polarity protection and a 2200µF capacitor smoothes the supply and provides extra capacity when the relays or solenoid are operated. Diode D9 isolates the regulator from input voltage drops during these short peri- ods with the charge on the 1000µF capacitor helping maintain the regulator input voltage. If we didn’t do this, it may be possible that the +5V rail may drop out for brief periods when the relay and solenoids operate causing the PIC chip to reset. Construction Start construction of this project by assembling the PC board. There are four wire links to be installed (one of which is much longer than a resistor pigtail offcut), so do these first. Ensure they are straight and lay flat on the PC board. Follow this with the smaller components, such as the PC stakes, IC socket, trimpots, resistors and diodes. It is a bit difficult to read the value of 1% resistors with the eye, so do as I do and check them with a meter before insertion. Their colour codes are also listed in Table 3. Next, install the capacitors, ensuring that the electrolytics are installed with correct polarity. The relays and terminal strips can be installed next. The holes for these components may need enlarging so that they fit neatly into the PC board. Follow this with the LEDs, transistors and ICs, with the exception of the PIC chip which should be left until later. Note that not all the ICs face the same way, so check the component overlay diagram before soldering them in. The 5V regulator (REG1) runs quite cool and won’t need a heatsink. The transistors are a mixture of different types including PNP and NPN, so check that you have the right one before inserting them in the PC board. Once the PC board is finished you can prepare the case which needs to have a number of holes drilled in it. See the photographs as a guide. Start with holes to mount the DC socket and solenoid socket at the left hand end. At the far end, where the terminal strips are located drill a large (say 10mm) hole to allow cabling to enter. Place the PC board on the bottom of the case locating it so that the edge where the LEDs are mounted is a few millimeters from the side of the case, mark the position of the holes, remove the PC board and drill with a 3mm drill. Mounting the PC board this way gives extra room to mount the speaker on the opposite side. A series of holes needs to be drilled to allow sound to escape from the speaker through the case wall. These are located about mid way along on the other side. On the same side but towards one end is a hole for the mic insert. Once all the holes are drilled and reamed to size, mount the speaker with a bead of silicone adhesive placed around the edge. The mic insert is also glued into position with silicone adhesive. Firstly, push the insert through the hole until the face is flush with the outside of the case. Then run a bead of adhesive June 2001  39 Parts List – Phonome 1 PC board code 12106011 1 Plastic case 197mm x 113mm x 63mm 10 PC board stakes 1 3.579MHz crystal (X1) 1 57mm 8Ω speaker 1 Electret mic insert 1 DC panel-mount socket to match plug pack 1 3.5mm mono phono socket 2 12V SPDT relay (RLY1, 2) 2 3-way PCB terminal strip 2 2-way PCB terminal strip 1 18-pin IC socket 4 10mm x 3mm screws and nuts 4 self adhesive feet Light duty hook up wire Tinned copper wire Light duty figure-8 cable Shielded cable Semiconductors 1 PIC 16F84-04P (programmed with DIALUP.HEX) (IC3) 1 MC145436 DTMF decoder (IC2) 1 LM324 quad op amp (IC1) 2 4N25 opto-coupler (IC4, 5) 3 BC337 NPN transistors (Q4, 5, 6) 2 BC547 NPN transistors (Q1, 3) 1 BC557 PNP transistor (Q2) 1 MTP3055E Power Mosfet (Q7) 4 1N4148 signal diodes (D1, 2, 6, 7) 5 1N4004 power diodes (D3, 4, 5, 8, 9) 1 7805 positive 5V regulator (REG1) 1 5mm Red LED (LED1) 1 5mm Green LED (LED2) Capacitors 1 2200µF 25VW PC electrolytic 1 1000µF 25VW PC electrolytic 3 10µF 16VW PC electrolytic 1 1µF 16VW PC electrolytic 7 0.1µF MKT polyester 1 .01µF MKT polyester 2 .001µF MKT polyester Resistors (0.5W, 1%) 1 1MΩ 1 470kΩ 7 47kΩ 1 15kΩ 15 10kΩ 2 560Ω 2 220Ω 1 100Ω 2 47Ω 1 22Ω 1 10Ω 2 250kΩ horizontal trimpot (VR1, 2) 40  Silicon Chip around the insert on the inside of the case and leave overnight to cure. Once the case has been prepared, install the sockets and mount the PC board in the case with 3mm screws and nuts. An extra nut is placed on the screws between the case and the PC board to act as a spacer. The power socket and the solenoid socket are wired to the PC board stakes with light duty figure-8 cable. The speaker is wired using light duty hookup wire, while the microphone insert should we wired to the PC board with a short piece of shielded audio cable. Ensure that the shield is connected to the mic insert pin that is bonded to the metal body. Apply four self adhesive feet to the bottom of the case when finished. The solenoid The dimensions of your solenoid assembly may need to be adapted to suit the specific speaker-phone you use. Changes may include such things as the height of the solenoid assembly and the length of the lever and extension arm. The design of the successful prototype assembly was arrived at after quite a bit of experimentation with various solenoids and mechanical arrangements. Obviously this assembly is optimised for telephones with the speaker button towards the lower edge of the base. In my small survey, I found this to be the most common type. If the speaker button is in the middle of the base, a different solenoid technique will be required. I’ll leave this to your mechanical construction skills. My experiments with a couple of telephone bases indicated that between 100 and 200 grams of force was needed to depress the speaker button, with a travel of between one and two millimetres. The specified solenoid when operated at 12V is able to supply this force, however a couple of things need to be taken into consideration to ensure that the assembly will work reliably. Firstly, the pulling force with all solenoids is reduced the further the plunger is removed from the coil. To obtain the required force for our application, the plunger throw must be no more than 3-4mm. Secondly, when we connect the plunger to an arm to act as our lever we must ensure that the distance from the button contact point to the pivot is equal to or less than the distance from the pivot to the plunger. If the button side of the lever is too long, the force available to press the button will be reduced, and may not operate reliably. The prototype solenoid assembly was designed and constructed taking into account these considerations and as a result proved to be very successful. It would be useless placing the solenoid on the desk next to the telephone without securing it so that it acts against the speaker button. If it was not anchored the solenoid would simply rise as the lever was moved, and the button would not be pressed. To overcome this problem the solenoid assembly must be screwed to a stand that sits underneath the telephone base. When the solenoid is energised, the arm now works against the button and full pressure is applied. Solenoid assembly The first step therefore is to obtain a piece of 10mm thick timber, such as MDF or particle board and cut it to size so that there is enough space to sit the telephone base and solenoid assembly. The accompanying photographs show the general idea. There are plenty of options here and you could even stain or paint it a matching colour if you wish. The solenoid assembly proper is constructed from scrap double sided PC board. While this may seem unusual, this material is easy to work, can be soldered easily and is quite strong. Fig.3 shows the details of the PC board sections that were used for the prototype. Cut out the sections using a fine tooth hacksaw blade, and file the edges smooth. Drill all the holes and clean away any burrs. To enhance the appearance of the PC board, clean the copper surface with a plastic kitchen scourer and spray with PC board clear lacquer. When drilling the holes in section C, make sure that the hole for the brass spacer pivot bearing is just big enough to allow the spacer to slide through the lever arm. Don’t solder it in place at this stage. A hacksaw mounted with two hacksaw blades should be the right width for the slot in the extension arm (E) so that the lever (C) is a slide fit onto the arm. Solder the vertical section (A) at 90º to the base piece (B), leaving a 1 to 2mm gap from the edge of the base. Solenoid Assembly Two close-up views of the solenoid assembly, made from scraps of PC board (see detail below). Note how the actuator arm can be set to the precise position required for reliable action on your particular phone. This is best done by firstly spot soldering and checking for square, and when satisfied, running a fillet of solder on both sides of the joint. Mount the solenoid with the two 3mm x 4mm long screws, and also install the 4mm x 20mm screw onto the pivot hole in section (A). Tightly screw on a nut to hold the pivot screw in position. Solder the 4mm nut with a spot of solder between two faces of the nut and the PC board to stop it loosening. Slide the spacer into the lever and place onto the pivot screw, with the 3mm hole in the lever closest to the upper edge. Enlarge the plunger hole with a 3mm drill and then slide it into the solenoid housing. Move the lever up into the plunger slot and slide a 3mm screw through the holes in the plunger and lever. Test the lever for free movement. Screw a nut onto the pivot screw to prevent the spacer from moving sideways, but still letting it rotate freely. If the spacer is too long and you are unable to screw on the 4mm nut completely, you will need to file the end of the spacer a little until it fits. Now slide the lever arm along the spacer until it is inline with the plunger slot and parallel with the vertical section. Once this position is found, carefully disassemble and solder the lever to the spacer, being careful not to get solder inside the spacer hole. Reassemble and ensure that the lever and plunger can move freely. You may need to loosen the screws holding the solenoid and rotate it slightly to let 1 12V DC solenoid (Jaycar SS0901) 1 3.5mm mono jack socket 2 3.5mm mono jack plug 1 3mm x 12mm screw and nut 2 3mm x 4mm screws 1 12mm long brass spacer (hole clearance for 4mm screw) 1 4mm x 20mm screw and nuts 3 No 6 x 10mm self-tapping screws Light duty figure 8 cable Scrap double sided PC board, approx 60mm x 160mm 10mm thick stand (Pine, MDF or plywood), size to suit telephone base the plunger move freely. Tighten the screws again, once the correct position is found. When satisfied, spot solder the outer 4mm nut to the pivot screw and a nut onto the plunger/lever screw to stop them unscrewing due to vibration. Solder the stopper section (F) under the lever arm at the plunger end and check that there is 3-4mm of plunger travel available. Solder in the triangular brace section (D) to strengthen the assembly, again with a fillet of solder along each edge. Install a 3.5mm mono jack socket in the remaining hole in the vertical section above the lever. Shorten the Fig.4: detail of the solenoid mounting assembly, using scraps of double-sided PC board. June 2001  41 Use this side-on shot as a guide to drilling the speaker and microphone holes. solenoid coil wires and solder them to the socket with either polarity, so that they are away from the lever. If you temporarily apply 12V DC to the solenoid, the lever arm should move up with a sharp ‘click’ when power is applied and release smoothly when the power is removed. Place your telephone base on the stand and the solenoid in front of the speaker button. Slide the extension arm section (E) onto the lever arm. Move the assembly so that the extension arm is above and almost resting on the speaker button with the lever arm in the normal position (lever resting on stopper section). Mark the position and screw the assembly to the stand with three self-tapping screws. Note the position of the extension arm, move the telephone base aside, and spot solder the extension arm to the lever arm. Place the telephone back into position and using the 12V DC supply operate the solenoid and check that the speaker button operates correctly. That is, when the solenoid is energised, the telephone goes off-hook and you can hear dial tone and when it is operated again the telephone goes on-hook. Adjustments can be made to the extension arm position by melting the spot solder with an iron, moving the arm to the new position and allowing it to cool. Once you are satisfied that all is OK, solder the extension arm permanently to the lever arm. In normal operation, power for the solenoid comes from the main PC board, so you will need to fabricate a cable to connect the solenoid to the socket on the case. This is simply a short length of figure-8 cable fitted with a 3.5mm jack plug on both ends. Initial testing Once construction is complete, it is time to apply power to the circuit. Leave the solenoid unplugged at this stage. Connect the plug pack to the DC socket, and using your multimeter measure the voltage at the power supply socket (between + and 0V). This should be somewhere between 12V and 17V. Leave your black test lead connected to 0V and measure the voltage at the junction of D8 and D9, which should be around 0.6V less and finally at the input to REG1 which should be 0.6V lower again. Next measure the voltage at the output of REG1. You should read close to 5V and you should also read the same voltage at pin 14 of the PIC socket. About 2V should be read at pin 2 of IC1. If you don’t get these readings or Table 3: Resistor Colour Codes                No. Value   4-Band Code (1%)  5-Band Code (1%) 1 1MΩ brown black green brown  brown black black yellow brown 1 470kΩ yellow violet yellow brown  yellow violet black orange brown 7 47kΩ yellow violet orange brown yellow violet black red brown 1 15kΩ brown green orange brown  brown green black red brown 15 10kΩ brown black orange brown  brown black black red brown 2 560Ω green blue brown brown  green blue black black brown 2 220Ω red red brown brown  red red black black brown 1 100Ω brown black brown brown brown black black black brown 2 47Ω yellow violet black brown  yellow violet black gold brown 1 22Ω red red black brown  red red black gold brown 1 10Ω brown black black brown  brown black black gold brown 42  Silicon Chip fairly close to them, remove the power source quickly and look for errors, especially with the power wiring and the installation of the polarised components. When you are satisfied that the power supply is correct, adjust the two trimpots halfway and whistle into the microphone. The ring LED (LED1) should turn on, then go off when you stop whistling. If it doesn’t turn on, there is a problem with the audio input circuit. Note that the DTMF LED (LED2) should not turn on at this stage. You should be able to trace any problems in the audio circuits with a multimeter and an audio monitor amplifier. Once done, remove the power, wait a few seconds and insert the programmed PIC chip into the 18-pin socket. Apply power again and after a second you should hear the power up beep in the speaker. This beep is good news, because the PIC has powered up successfully. The 5V power rail takes some time to fall away after power is removed, so you must wait a few seconds between powering off and on to allow the reset circuit to work properly. If you don’t hear the beep, you have a problem. This may simply be in the speaker circuit or maybe the clock input from IC2. If you suspect the oscillator is at fault, the best approach would be to check for the 447kHz clock signal at pin 16 of IC3 with a frequency counter. If you cannot make a reading, then the DTMF decoder (IC2) or the crystal is probably at fault. Default password When the unit is powered for the first time the password is unknown. Because we can only access the unit by entering in a correct password, we need a backdoor method so that we can get in and program our own. To do this, remove the power, apply a short between the password pins, wait a few seconds and reconnect the power. The power up beep will be heard again and after 10 seconds Table 4: Capacitor Codes   Value    IEC code    EIA code      0.1uF 100n 104  .01uF 10n 103  .001uF 1n 102 remove the short on the pins. The password tone will be then heard indicating that the default password has been set to 123456 and stored in EEPROM. Turn off the power again. If, in the future, you forget your password, you can invoke the default password in the same way. Note that as a security precaution, you can only do this when you are physically at the unit and not from a remote location. On-hook detection Imagine that we make a call to the Phonome and it answers by operating the telephone speaker button but during the call the power goes off. When the power comes back on the Phonome powers up, goes to idle and waits for ring. It does not know that the telephone call is still off-hook. This means that ring will not be heard and in any case no one can call this telephone because it will be busy. To overcome this potential problem, a special process is invoked each time the Phonome powers up to determine whether the telephone is on or off-hook. We can tell when a hands free telephone is on-hook because there is no sound from the speaker, however when we press the speaker button and go off- hook we hear dial tone until the exchange times out. The Phonome uses this method to determine whether the telephone is off or on hook, and also if the telephone and line are working. We will look at the normal situation first. When the Phonome powers up, the solenoid is automatically operated and after a 2 second settling time, the ring output (Q1 collector) is monitored. If dial tone is present and VR2 is adjusted correctly, the ring output will be low. It is monitored for a further two seconds and if it is continuously low for this period the Phonome considers this to be the off -hook state. It then operates the solenoid again to go onohook and wait for a call. There are however, two situations where the ring output may not be low for two seconds after operating the solenoid following a power up. Firstly, the power up of the Phonome may have taken place with the telephone already off-hook, as discussed above. In this situation operating the solenoid at power up will place the telephone on-hook and so no dial tone will be heard. To check if this is the case the Phonome firstly waits five seconds, operates the solenoid and looks for dial tone again. If dial tone is found this time, the telephone must now be off- hook. The Phonome operates the solenoid, returning the telephone to on- hook and waits for ring. The second situation is if there is a line fault. With a line fault we are not going to get dial tone no matter how many times we operate the solenoid. As there is little use in continually cycling the solenoid for extended periods if the line is faulty, the Phonome will only try for dial tone four times in a row. If after four attempts dial tone is still not detected, the Phonome stops and waits for 10 minutes before trying another sequence of four attempts. Note that no calls will be answered until the 10 minute period has elapsed and the next search for dial tone has been successful. Special features Using a microcontroller in a design allows some nice features to be included that would otherwise be difficult to do. In this case two very useful diagnostic features, a DTMF decoder checker and a ring training function are included. Both these features are accessed through shorting the password pins for set periods at power up. DTMF decoder checker The DTMF decoder checker allows you to ensure that the input circuit including the microphone and the DTMF decoder are operating correctly. To access the DTMF decoder checker, apply power with the password pins shorted and release the short within five seconds. A short beep will be heard and each time a DTMF sequence is decoded a sequence of beeps equal to the value of the key will be heard. For example if the key ‘1’ is pressed one beep will be heard and if the ‘7’ key is pressed seven beeps will be heard and so on. Trimpot VR1 varies the sensitivity of the input amplifier and is adjusted while monitoring LED2 so that it turns on when each DTMF digit is heard. Full-size artwork of the Phonome PC board for those who like to make their own. It can also be used to check commercially-made boards for defects June 2001  43 and then quickly short the pins and take the short off before the next ring burst. Another two beeps will be heard indicating that training is now in progress. The PIC waits until it has detected a burst of ring between 400mS and one second before proceeding. It then waits for the start of the following burst of ring and measures the Here's a close-up showing how the solenoid extenon and off ring periods sion arm pushes down on the “speaker” button of the for the next six seconds. phone. Only loudspeaking phones with this type of button can be used. At the completion of the six second period Power must be removed to end continuously repeating beeps DTMF checking. will be heard and the new ring values will be stored in EEPROM. This rather Ring training involved procedure is to try and ensure The input circuit provides a digital that two periods of good ring are stored. You will need to turn off the power to signal to the PIC chip, which is low when a burst of ring is heard by the stop the beeps and exit ring training. microphone, and high when there is Final testing no ring. Perform the default password proThe software within the PIC measures the length of the low and high gramming operation, if you haven’t periods of the ring signal. These are already done so. Place the telephone then compared with reference values base on the stand with the speaker stored in the EEPROM to determine if button under the solenoid lever arm. it is ring or some other repetitive noise The case should be placed so that the microphone is close to the telephone which can be ignored. These EEPROM values are set to speaker and the Phonome speaker is close to the telephone microphone. default values for standard Australian ring when the default password proce- Obviously there are limitations to this, and the unit should still work if you dure is done. cannot get them real close. There may be situations where the Remember that the further they are particular ring that is heard from your telephone is not close enough to the apart, the more echo and noise will be default values to be considered valid picked up by the microphone. It is also important to adjust the volume control ring. This could be due to variations in the exchange you are connected to, on the telephone base to the correct level. It must be set so that the level or the electronics in the telephone etc. To allow the Phonome to detect is above the background noise but not almost any ring signal, we can enter a so loud that the tones are distorted. There is plenty of gain range ad‘training’ state so that the ring on and justment in the input circuit, and off times can be read and stored. This is done by powering on the Pho- the DTMF decoder chip has a large dynamic range, so there is no need nome with the password pins shorted for longer than five seconds but less to have the telephone level too high. If you do have trouble with the than ten seconds, where two beeps detector working reliably, it will probwill be heard. ably be due to distorted DTMF tones Now sit the unit near the telephone and ring your home from your mobile through over driving the telephone or get someone else to ring you. Watch speaker rather than too low a level. Plug the solenoid cable into the LED1 and check that it flashes in time with the bursts of audible ring. If not, solenoid socket and the plug pack into the power supply socket on the adjust trimpot VR2 until it does. When you are ready, wait for a pe- case. Apply power and you will be riod of silence in between ring bursts greeted again with the power up beep. 44  Silicon Chip Following this you should see the solenoid operate searching for dial tone. If everything is OK, dial tone should be heard for two seconds, LED1 should be on and then the solenoid will operate again returning the handset to the on hook state. If the LED does not come on, then you will need to adjust VR2. Using your mobile phone, or obtaining the help of a friendly next door neighbor, call your number and check that LED1 turns on when the bursts of ring can be heard. If the ring detection values in the PIC are correct, the solenoid should operate to answer the call. After the solenoid has operated, you should hear 20 short beeps of tone. From the moment the beeps stop you have three seconds to enter a password digit. If any of the password digits are not entered within three seconds of the last, the call will be cancelled. If you enter 6 digits within time but the password is wrong, an error tone will be sent and one more attempt is allowed. If the second attempt fails the call is cancelled immediately. At this stage enter the default password, 123456. You should see LED2 turn on as each digit is received. If not, you may need to adjust VR1 and try again. You may find it necessary to hold down the keys on the telephone a little longer than normal and enter the digits slowly to obtain reliable DTMF detection under some circumstances. Once the password is accepted you will hear a connected tone of three beeps. At this point you have three minutes to enter a command. If no commands are entered a reminder tone is sent each minute, and if three minutes have elapsed since the last digit was received the call is cancelled. You may at this stage wish to refer to the keys and the corresponding commands in Table 1, and the tones in Table 2. It would be a good idea at this stage to set your own password, so that a level of security is provided. To do this press the ‘*’ key on your handset. You will then hear the password tone sequence. Enter the new password, and after the sixth digit is entered the password tone is sent again and the new password is stored in EEPROM. If you timeout during this process, the error tone is sent and the old password is restored. An added bonus with the Phonome is that you can listen to what is happening inside the room where it is located. If you were, for example turning on a radio or television in the room, you would be able to check that it indeed did come on. will be terminated. Screw the cover onto the box and the Phonome is ready for action. Inputs and outputs Finally Press the ‘1’ key and you should hear a single beep followed by a two-beep rising frequency tone indicating output 1 is on. Relay 1 should have energised at this point. Now press the ‘2’ key. You should now hear a single beep, followed by a single low frequency tone indicating output 1 is off, and relay 1 should now be de-energised. Relay 2 operates the same way using the ‘3’ and ‘4’ keys, except that 2 beeps will initially be heard to indicate relay 2. Press the ‘5’ key. You should hear a single beep followed by a single low frequency tone indicating that input 1 is off. Connect a DC supply of around 5V to the input 1 terminal strip, ensuring correct polarity. Press ‘5’ again and you should hear a single beep followed by a two-beep rising frequency tone indicating output 1 is on. Input 2 operates the same way, except that two beeps will initially be heard indicating input 2. If you now press the ‘9’ key, you should hear the error tone. Anytime an unrecognised digit is received the error tone is returned and no action is taken. To end the call, press the ‘#’ key twice in a row. The end tone will be heard, the solenoid will operate and the call To conclude, here are a few final comments and tips to help you get the most from your Phonome. As mentioned before the mechanical construction of the stand and solenoid assembly will really depend on the telephone base you use and your individual requirements. For example, you may want to include some form of seating for the telephone so that it does not move around, and you may also want to encase the solenoid assembly with a cover to tidy it up a little. The relays (RLY1 and RLY2) are small 12V SPDT types that are only intended to switch low voltages. If you want to operate mains devices, then use these outputs to control larger isolated mains rated relays. The opto-coupler inputs are designed to interface with logic outputs that can supply around 5mA of current. If you intend to interface to high voltage lines, you may need to include an additional external resistor in series with the opto-coupler LED circuit to limit the input current. While higher currents can be tolerated, including the extra resistor to limit the current to around 5 to 10mA would be safe practice. If you want to test your Phonome off-line without making telephone calls, this is simple to do. Instead of the need for ring and dialtone from the telephone, you can simulate these sounds by whistling into the microphone. The ring detector input circuit cannot distinguish the frequency of tones, only audio level, so a constant whistle will suffice. To get the ring detector to work you need to be fairly accurate with your whistle, however the two 400ms bursts can be simply combined into a single 1-second burst. If you unplug the telephone from the wall socket and connect the telephone line plug to a 12V DC supply, you can test the DTMF checker without needing to make telephone calls. After pressing the speaker button, the DTMF tones will be heard from the telephone speaker as the keys are pressed. Software To fully explain how the software works would take an article on is own. The best approach is to download the Phonome files from the SILICON CHIP Web site combined in a zip file DIALUP.ZIP. To program your own PIC chip you will need the file DIALUP. HEX, while you can get a better understanding of how it works by reading SC the DIALUP.ASM file. Full-size artwork for the Phonome fron panel. This suits the zippy box specified in the parts list. June 2001  45