DTMF Dialer for an Old Pulse Phone

When I inherited an old black wall-mounted phone, I simply had to get it working and hung on my own wall.  Unfortunately our cable-based VoIP phone line doesn't support pulse dialing so I would need to add DTMF support.

Fortunately, I'm not the only one with an odd sense of decor:

http://boris0.blogspot.ro/2013/09/rotary-dial-for-digital-age.html

I did need to modify the circuit a bit, though:

  • The polarity on my line is opposite of the author's for whatever reason so the wires to F / RR and L2 are swapped.  Polarity doesn't really matter with phone lines so there's no consistent standard saying which way is "correct" and which isn't.  It would probably help to add a diode bridge to the circuit.
  • The resistor setup was completely changed:
    • R3 was completely removed.  The tones it was producing were so quiet that the VoIP device wasn't even registering them as attempts to dial.
    • R1 was reduced to 330 to provide more voltage to the ATTiny45 microcontroller.  It works as-is but the voltage to the MCU was just barely enough and I wanted plenty of wiggle room.  D1 is still there and should prevent it from going over 5V.
      • Note: This appears to be draining the line too much as I'm told my voice sounds "too quiet" and "far away" - may want to bump the resistance value back up a bit
    • R2 was reduced to 220 so it would still be the path of least resistance when the MCU opened the Q1 path.
  • I increased the length of the tones in the MCU code from 100ms to 200ms. (Because I liked the way it sounded better)

Other than those, everything is as he presents and it works great!

There is, however, an unfortunate lack of instructions on how to get his code onto an ATTiny45 so I'll fill some of those in here.

First thing you do is get an Arduino and load a sketch onto it that turns it into a bit-banging programmer.  Mine is an Uno but I'm sure others will work as well.  The sketch is one of the examples included with recent versions of the software. (See graphic to the left)  Upload this sketch to the Arduino before going any further.

Next you need to rig up the circuit around the MCU.  This should only be necessary once - if you need to repeatedly reprogram your MCU then you either need a new one or your circuit is doing something that it should not be.  Instructions can be found at:

http://www.kobakant.at/DIY/?p=3742

Also, the Github link on that page is broken - try this one instead: https://github.com/damellis/attiny/

One extra step, though - as the circuit uses an external 4Mhz resonator instead of the internal clock, you need to go through the extra step of burning a new bootloader onto it.  Unfortunately, there is no option for an external 4Mhz clock in the boards.txt file they provide in the Github repo above so we need to add one.  Open boards.txt and add the following:

attiny45-4.name=ATtiny45 (external 4 MHz clock)
attiny45-4.bootloader.low_fuses=0xfe
attiny45-4.bootloader.high_fuses=0xdf
attiny45-4.bootloader.extended_fuses=0xff
attiny45-4.upload.maximum_size=4096
attiny45-4.build.mcu=attiny45
attiny45-4.build.f_cpu=4000000L
attiny45-4.build.core=arduino:arduino
attiny45-4.build.variant=tiny8

Once you burn on a bootloader that expects an external clock, you won't be able to communicate with the chip without one.  It is safe to burn on the new bootloader only after you have hooked the resonator up to the MCU as you see it in the final circuit schematic. (outside leads to pins 2 & 3, center lead grounded)

The last step is to actually compile the code and burn it to the MCU.  For this you'll need Eclipse and the AVR plugins:

http://eclipse.org/

http://avr-eclipse.sourceforge.net/user%20manual/home.html

Just follow the instructions in that 2nd link - there is no need to reproduce everything here.  Create a new project and add main.c and main.h to it.  In the Eclipse preferences, the programmer hardware you want is "Atmel STK500 Version 1.x firmware" and you'll need to force the port appropriately and baudrate to 19200.  Exercise your Google-Fu if you need more.