[Home]DTMF Dabbles

HomePage | RecentChanges | Preferences | My Website home page

Using a Using Holtek HT9170B/HT9170D DTMF Detector

 ;**************************************************************************
 ; dtmf001.asm
 ;
 ; PROGRAM:    Simple Parrallel to Serial to take output from 
 ;			Holtek HT9170B/HT9170D DTMF detector
 ;
 ; AUTHOR:		Doug Rice, 
 ;			doug.h.rice@btinternet.com

http://www.dougrice.plus.com/dev/dtmfCode/

In 2004 , I tried to use a PIC chip to take the outputs from the DTMF detector and output the digits detected.

The chip was popular at the time.

DataSheet: http://www.dougrice.plus.com/dev/dtmfCode/HT9170v120.pdf

PIC Assembler code: http://www.dougrice.plus.com/dev/dtmfCode/dtmf001.asm

The Holtek chip has an analogue input and outputs.

 DV - Goes high when DIGIT is detected, and low when DTMF ends.
 D0 to D3 - outputs DTMF digit code  

In 2004 , I was using PIC chips with 4Mhz, and could not work out how to decode DTMF using the AtoD.

Recently I have recorded the audio using Audacity and decoded the audio samples using a web page.

https://www.dougrice.co.uk/cgi-bin/wiki.pl?WebAudio

http://www.dougrice.plus.com/dev/UART/UART2_DTMF.htm - The webpage decodes the Audio and uses the CANVAS to plot the decode

This demo simulated DTMF detection, and used SVG graphics to plot the output of the simulation:

http://www.dougrice.plus.com/dev/dtmfCode/dtmf1_g.svg

My netbook could capture Audio.

http://www.dougrice.plus.com/dev/dtmfCode/pcm_m.c

http://www.dougrice.plus.com/dev/dtmfCode/pcm_d.c

The programs output data in JavaScript functions calls that can be loaded into a webpage that uses SVG for plotting.

http://www.dougrice.plus.com/dev/dtmfCode/dtmf1_g_c.svg

There are many DTMF detector and generator Apps on smartphones.

It should be possible to use Web Audio in real time now. I have got a BAUDOT detector to work.

https://homepages.plus.net/dougrice./dev/UART/micBaudotDecode.html - decodes BAUDOT, so converting to DTMF should be a few evenings work.

Real Time code

The real time code has to sample the audio and process the samples and generate events

Events are when the audio significantly changes, like the start of tones or end or tones, as in the Holtek chip block diagram.

When converting button presses, I use this code that takes the differential of the buttonInputs

 on timerTick(){ // about 10 times a second
  if ( pressedButtons ^ lastPressedButton){
   lastPressedButton =  pressedButtons
   runOnButtonEvent()
  }
 }

For audio, you need to do this with the energy levels at the output of the filters.

State Machine: - Spec

State Machine: - As the Testers and Windows present it

Sampled Audio:-

http://www.dougrice.plus.com/dtmf/dtmf1.htm

DTMF detetctor

       1209    1336    1477   1633
        |       |       |       |
 697 -- 1 -- -- 2 -- -- 3 -- -- A --
        |       |       |       | 
 770 -- 4 -- -- 5 -- -- 6 -- -- B --
        |       |       |       |
 852 -- 7 -- -- 8 -- -- 9 -- -- C --
        |       |       |       |
 941 -- * -- -- 0 -- -- # -- -- D --
        |       |       |       |

Overview

 1) sample:
	measure input using AtoD

 2) filter:
	Use A=A*M + input
	or walsh

 3) quantify: - every n ms
	scan levels.

   leak values

 4) Logic: -  are any tone detectors above a threshold?
	Which Pair are the largest
	Has pair changes since last poll?
	Output Char?

 5) serial out
	Send the digit to the serial port

Overview Tone generator

The tone generator uses the catch up call generator.

arrays of quadrature square waves using A= A + M

Every gen_ts seconds add M to A and if gen > max/2 subtract max.

  fr[16],fi[16]

SVG simulation

This is a SVG simulation of DTMF generator and simulator. http://www.dougrice.plus.com/dtmf/dtmf1_g.svg

http://www.dougrice.plus.com/dtmf/


HomePage | RecentChanges | Preferences | My Website home page
This page is read-only | View other revisions
Last edited July 28, 2024 7:15 am by dougrice.plus.com
Search: