Close

Programming the Attiny85

A project log for Pulse to Tone Converter

Converts pulse dialing of your POTS telephone to DTMF dialing allowing you to use it with your VOIP's FXS-port.

christoph-tackChristoph Tack 01/29/2018 at 19:590 Comments

Arduino

The attiny85 is not supported on Arduino by default.  Download the library from github and install it.

Programming connections

SignalATTINY85AVRISP mkII
MISO61
VCC82
SCK73
MOSI54
RST15
GND46

Programming instructions

Burn the bootloader

Burn the bootloader (which is empty) to make sure fuse settings are correct.

Luckily, the arduino toolchain sets the correct fuse values.  Using the Engbedded Atmel AVR® Fuse Calculator, you can check the fuse settings:

-U lfuse:w:0xff:m -U hfuse:w:0xd5:m -U efuse:w:0xff:m

Upload the application

Be sure to write the bootloader first.  Otherwise, the device will run at 1/8 of the desired CPU frequency.

Verifying CPU clock frequency

The internal RC-oscillator is not accurate enough to generate DTMF correctly over large temperature and voltage specs.  For development purposes, a 12MHz oscillator can be connected to pin 2 of the Attiny85.  Oscillators are quite power hungry.  So, for rotary dial testing, in which the power supply is cut off during dialing, it should be powered from a separate 5V supply.

An 8MHz external clock would is a better choice.  The attiny85V is not specified to work at 12MHz.  When the supply voltage drops below 4V the MCU behaves inpredictably.  With an 8MHz clock, the attiny85V has a much wider supply voltage range.

The MCU frequency can be checked with a timer/counter.  A digital oscilloscope that only samples at 100Ms/s will not yield reliable results.

Verifying DTMF frequencies

The first step is to check the interrupt frequency, which is our PWM-frequency.  This looked ok using the PM6665.  It's more reliable to measure if OCR1A is forced to a fixed value so that a fixed duty cycle is being generated.

Next step is to verify the DTMF frequency.  This signal can be measured at the non-inverting input of the opamp in the current source configuration.  By leaving out one of the two frequencies of the DTMF signal, allows for easier measurement of the frequency of the restored waveform.

A final test was to generate the same DTMF-sequence as had been done before using the ProTrinket3V

The result can be heard here.

Decoding using multimon shows that the generated DTMF-tones are correct.

ctack@ctack-X550LD:~$ multimon -a DTMF -t wav DTMF_0123456789.wav 
multimod  (C) 1996/1997 by Tom Sailer HB9JNX/AE4WA
available demodulators: POCSAG512 POCSAG1200 POCSAG2400 EAS AFSK1200 AFSK2400 AFSK2400_2 HAPN4800 FSK9600 DTMF ZVEI CCIR SCOPE
Enabled demodulators: DTMF
sox WARN sox: Option `-s' is deprecated, use `-e signed-integer' instead.
sox WARN sox: Option `-2' is deprecated, use `-b 16' instead.
DTMF: 0
DTMF: 1
DTMF: 2
DTMF: 3
DTMF: 4
DTMF: 5
DTMF: 6
DTMF: 7
DTMF: 8
DTMF: 9
sox WARN rate: rate clipped 2830 samples; decrease volume?
sox WARN dither: dither clipped 2441 samples; decrease volume?

Discussions