PDA

View Full Version : dtmfout problem



lerameur
- 7th May 2008, 02:25
Hello,

I finally got my circuit working... well almost.
I use a pic chip with picbasic pro, I output DTMF and this goes through a filter shown in picbasic manual:
http://www.melabs.com/resources/pbpmanual/5_17-5_21.htm
From my scope I can see some 40v spike at the pin output and after the filter I do not see much maybe a few volts.
This goes directly to an audio transformer.
Is it normal to have 40v spike (the signal looks pretty nice). WHen I put a modem speaker at the pin output I can hear the dialing and maybe a third in strenght (sound) after the filter. At the output of the transformer I have an AC 250v capacitor. The pichip dials my phone, and I receive maybe 50% of the calls.
Should I be using the filter? (I am not using an amplifier as mentionned in the manual)
Is the 40v good to put directly on the transformer?
Also from the speaker I hear a lot of background noise

thanks
k

mister_e
- 7th May 2008, 04:04
Any real circuit and code of that? Are you using 20MHz crystal?

The noise is always there?

Acetronics2
- 7th May 2008, 08:14
Hi,

From the data I have here,...

I see a damping 680 Ohm res. on the Pic side of the line trafo. ( // with the winding !!! )

On the line side :

in series with the primary :

750 Ohms 2W // 1µF // TPJ ( to limit current to ~ 35 mA )

Alain

lerameur
- 7th May 2008, 13:33
Hi,
I am using 20Mz
I think the problem is more hardware than software..



code:/
'*************************
'* Alarm system dialer *
'*************************


'//////////////////////////////
'// Pic chip configuration //
'//////////////////////////////

INCLUDE "modedefs.bas" 'Includes supoprt for PicBasic language
@ DEVICE pic16F88,CCPMX_ON

' Setup Crystal oscillator Frequency to be used by PIC chip in MHz
DEFINE OSC 20 'use external 20mhz crystal

ANSEL = 1
CMCON = 7 ' Turn OFF the comparators so pins can be used as digital I/O-pins

'///////////////////////////////////////
'// Screen initialization //
'///////////////////////////////////////


DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTA ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD

DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 2000
pause 2000


'/////////////////////////
'// PIN configuration //
'/////////////////////////

TRISA = %00011000 ' Set PORTA to all input
TRISB = %11111111 ' Set PORTB to all output
PortA = 0


'///////////////////////////////////////////////
'// Variable Declaration and initialization //
'///////////////////////////////////////////////


counter var byte
i var byte
counter=0


'//////////////////////////
'// Program starts here //
'//////////////////////////

Main:
lcdout $FE,1, "Counter:",dec counter
Pause 500

if PortA.4=1 then
counter=counter +1 'Counter at 1 dials phone number
goto Dial
endif

if PortA.4=0 then
counter=0
goto Main
endif

'//////////////////////////
'// End of program here //
'//////////////////////////

Dial:
'Determine which number to dial and dials it

lcdout $FE,1, "Dial:",dec counter
Pause 500

if counter =1 then 'begin counter loop
if PortB.0 = 1 then GOSUB Dial1760 'cel
if PortB.1 = 1 then GOSUB Dial4392 'Ken
if PortB.2 = 1 then GOSUB Dial9130 'Donald
if PortB.3 = 1 then GOSUB Dial758 'Lyne
Else
counter =1
goto Main
endif 'end counter loop

Pause 1000 'pause for 1 seconds
if (counter > 1) or (counter =0) then counter =1

'Keep counter to 1 after dialing, otherwise the program will keep dialing the number
' Will only redial if counter goes back to 0, that is alarm siren off

goto Main



'*************** subroutine here ********************
Dial1760: 'cel
lcdout $FE,1, "dialing1760 ",dec counter
Pause 500
PortA.1 = 1
pause 3000
DTMFOUT PortA.0, [5,1,4,4,4,4,4,4,4,2]
pause 4000 'Pause 4 seconds
DTMFOUT PortA.0, 20000,0, [5]
pause 2000 'Pause 2 seconds
PortA.1 = 0
return

end

/end code

lerameur
- 7th May 2008, 13:36
I think I might got the probe switch to 10x instead of 1x.. that would explain the 40v. I will check it once I get home...
if so I guess I would have would have something like 3.7v output peaks on the pin.

lerameur
- 8th May 2008, 00:05
Ok , the scoipe was set at 100x. now I read 4v at the output, but still a lot of noise after the filter, and only dials 50% of the times

k

skimask
- 8th May 2008, 00:42
but still a lot of noise after the filter, and only dials 50% of the times
k

Well, the PBP manual does say that any 'sound' output from the PIC, being 1-bit analog, is going to be 'noisy', a lot of harmonic content. And I would think that even if it's filtered well, it would still have a load of 'noise' in it. A low-pass 'brick wall' filter, with a steep 'slope/cutoff', with the -3db point set just above your highest frequency might handle that.
I guess I'm not really sure. I haven't relied on the PIC to do much sound (other than moving MP3 data back and forth for a player).

lerameur
- 8th May 2008, 01:39
I was initially thinking of going with a specialized DTMF chip. They are hard to get around here

skimask
- 8th May 2008, 01:52
I was initially thinking of going with a specialized DTMF chip. They are hard to get around here

I wouldn't think you'd need a special chip...just maybe brush up on some filter design techniques. After all, what you're trying to do has been done probably hundreds of times before. No reason why you can't do the same thing...

And also...

Here == ???????????????

Darrel Taylor
- 8th May 2008, 03:00
I'm not sure what affect it will have on DTMFOUT, but you have ....

ANSEL = 1

Which puts PORTA.0 in Analog mode.
And that's the DTMF pin.

Might try ...

ANSEL = 0
<br>

lerameur
- 8th May 2008, 03:14
that did not work,
everytime a DTMF comes out, its like someone was blowing air at the same time.. from what I can hear from the speaker.
if I choose to do a low pass filter, what would you suggest my cut off frequency be?

skimask
- 8th May 2008, 03:27
if I choose to do a low pass filter, what would you suggest my cut off frequency be?
Well, since DTMF freq's run from 697Hz to 1633Hz (reference Wikipedia), shooting for 1634 would be a good bet, but probably not practical. I'd tend to think that a 'brick wall' above 2KHz would do it.
And I'd also be willing to bet that the 'air' you are hearing is in fact aliasing of the fundamental tone due to the numerous harmonics caused by the square wave output of the PIC.

Jumper
- 8th May 2008, 09:46
Hi,

What do you plan to design the filter? RC? OP-amps? LC? go for a filter chip?

lerameur
- 8th May 2008, 12:54
I dont know yet, but I remember some chip requires +15 and 15- supply , I only have about 6 or 7v supply.
I tried a single stage RC, with 0.2uF and 400ohms, that did not do anything..

skimask
- 8th May 2008, 15:01
I dont know yet, but I remember some chip requires +15 and 15- supply , I only have about 6 or 7v supply.
I tried a single stage RC, with 0.2uF and 400ohms, that did not do anything..
.2uF & 400 ohm gives you an RC time constant of 12.5Khz. (.2/1000000 * 400 = .00008, 1/.00008 = 12,500)
It might work a bit better if you had a bit more cap's and a bit less resistor, say 40 ohms instead of 400, which would give you an RC time constant of 1.25Khz. And since you're trying a single stage RC filter, the roll-off would be fairly shallow, so 1.25Khz may work out fairly decent.
My suggestion...get a copy of 'The Art of Electronics'. It's one of my 'Good Books', take it with me on every trip I take, page thru it all the time. A few good sections on filters, op-amps, etc.etc.etc.

lerameur
- 8th May 2008, 15:43
ok look at this pdf:
AN6_DTMF_gen.pdf
search for it on google, last page shows the calculation i did.

aslo, when I used my 0.2uF cap. I decided to switch to a variable 2k pot, went through all the resistance values pretty quicky. The only thing this did is to increase or decrease the overall sound level, kind of a volume control.

Jumper
- 9th May 2008, 02:46
Hi,

The things you have seen is just what I have seen too. RC filters are not that successful in making Low Pass filters since they dont this nice sudden cutoff FQ.

these links will get you some help designing an active filter.

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010007

http://www.national.com/appinfo/amps/webench_filters.html

There are many Op-amps that can be used with a single 5V supply. This way you get an active filter with very sharp cutoff FQ.

/me

lerameur
- 10th May 2008, 03:01
that is pretty cool software from microchip.
One thing though, they show all parts excepts for the op amp, can I use 741 op amd or any similar amp with a 5v supply?

lerameur
- 19th May 2008, 04:38
I finished my low pass filter but I realized one other thing wrong with my circuit.
I do not read good frequencies with my scope, maybe it is because of DTMF, this is the first time working with this this. I posted a screen capture of my scope while the dtmfout id dialing 5 constantly.
http://www3.sympatico.ca/lerameur/LPF/
The scope shows under 10hz... is this a good output for dtmf ?
is this good for dtmf, I do not get any better result with my low pass filter added..

Jumper
- 19th May 2008, 07:06
Try to connect a small speaker to the pin... I usually use normal external PC-speakers with built in amplifier and just connect GND straight and a capacitor in serie with the pin for the signal wire. Then you can compare 5 5 5 5 5 5 5 5 5 5 from the PIC with the beginning of Homer Simpson's phone number 555- dialed on your normal phone.

Some signals is really hard to measure with a scope.... plan B which I also tend to use alot is to take a normal windows audio sampling program and use the PC microfon to sample it. Most softwares allows the wave to be shown and you can also zoom in and out... here you can try to call Homer again to get a reference.

Who will go crazy first? You or your neighbour?

Don't call Moe......


/me

skimask
- 19th May 2008, 13:58
I do not read good frequencies with my scope, maybe it is because of DTMF, this is the first time working with this this. I posted a screen capture of my scope while the dtmfout id dialing 5 constantly.
Are you set for AC or DC coupling on the 'scope?

lerameur
- 19th May 2008, 14:32
I tried both DC and Ac and I get the same result, ground coupling gives me nothing.
ken

Dave
- 20th May 2008, 11:36
lerameur, Attached is the DTMF filter I use on the remote links I have designed and the repeater controller as well as the 6 channel voter for an amateur radio system here in detroit. Try it....

Dave Purola,
N8NTA