Shop OBEX P1 Docs P2 Docs Learn Events
Trying to Use A BS2 With a Phone — Parallax Forums

Trying to Use A BS2 With a Phone

RubrChickenRubrChicken Posts: 39
edited 2009-01-31 16:28 in BASIC Stamp
I'm trying to get a BS2 to dial a phone, without destroying a phone. I got a little plug, the same type of the handset. I press one on the phone, and run this code:

out PIN 0

GOSUB dial

dial:
DTMFOUT out,1000,500,[noparse][[/noparse]*,*,*,*,*,*,*,*,*,*]


I can hear the BS2 dialing through the speakerphone, but its really noisy. I hear a loud buzzing sound on top of the dialing. Eventually, I get a "you call could not be completed" or a "if you'd like to make a call, please hand up and try again". I've tried to ground all the other pins, but that actually makes it worse!

Whats wrong?

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-30 02:38
    What's wrong is that you're assuming that you can just connect two things together without thinking about whether they're compatible. Stamp I/O pins produce a +5V signal relative to Vss (ground) when high and a 0V signal (=Vss) when low. If you hook up a small speaker, like a little piezo speaker which is designed to be used this way, you can make DTMF sounds with a Stamp and you can acoustically couple the sound to a telephone handset.

    If you attempt to connect a Stamp directly to some kind of phone, you can destroy the Stamp. You might damage the phone as well. It's very unlikely that you will get it to work. There are devices called a DAA (data access arrangement) which are specifically designed to let a microcontroller connect (through the DAA) to a phone line. These have voltage level conversion circuitry and protective circuitry inside since you can get high voltages on the phone line, particularly during ringing (let alone electrical storms).

    There's a brief article on the Wikipedia about DAAs here: en.wikipedia.org/wiki/Data_access_arrangement
  • JonathanJonathan Posts: 1,023
    edited 2009-01-30 04:56
    The old Stamp manual had (has?) a circuit with the DTMF command. I have used that, just recently in fact, to do the same thing. As Mike said, you can't just connect the Stamp to the phone lines.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • JSWrightOCJSWrightOC Posts: 49
    edited 2009-01-30 19:59
    I would like to suggest that using the acoustic coupler, or perhaps connecting through the hands-free headset jack of a cordless phone may be the simplest and safest solution. Another idea would be to use an old computer modem and send commands to it to make it go off-hook, dial numbers, and hang up. The AT command set is very well documented, and almost all modems support it. This would also give you the benefit of not having to be there to take the phone off-hook.

    If you use the acoustic coupler or the hands-free jack, be sure to include the low-pass filter network as described in the Basic Stamp Manual under the DTMFOUT or FREQOUT commands. If you use the hands-free jack, you will need to attenuate your audio level and use a DC blocking capacitor so it can be properly fed into the mic input.

    It is generally not a good idea to connect your circuit, however it is built, directly to the telephone line, or through a corded handset jack. The buzz you heard is most likely the ground potential difference between your house and the telephone switch - this is why all telephone equipment is internally electrically isolated when it requires electrical power (cordless phones, modems, fax machines, etc.) Not to mention there are dangerous voltages present on the line most of the time, and the potential for surges during electrical storms. There are also regulations regarding the connection of electronic equipment to the phone line to prevent interference to other customers.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-30 20:10
    The Basic Stamp Manual's chapter on the DTMFOUT statement shows how to properly connect a Stamp to a speaker, audio amplifier or telephone line. Note that you are not allowed to connect a homemade DAA to a telephone line. They have to be "type approved". You can buy relatively inexpensive type approved DAAs that look internally much like what is shown in the Stamp Manual.
  • RubrChickenRubrChicken Posts: 39
    edited 2009-01-31 02:47
    By an acoustic coupler, do you mean sticking a speaker and a mic together? There is a headset jack on a phone that I have, I'll try that too. I think there is a dial-up modem lying around somewhere, so I can use that. I hope the FCC doesn't come knocking... that buzz might have been bad.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-31 06:28
    Yes, an acoustic coupler means sticking a speaker from the Stamp together with the microphone in a telephone handset so the sound from the speaker is tightly coupled with the microphone.

    You still can't directly connect the headset jack to the Stamp unless you know what kind of headset is required. I suspect that you could use a small transformer to couple the Stamp to the microphone input of the phone. That would isolate the grounds, yet couple the audio signal. You probably will need a volume control since the signal from the Stamp is probably way higher than a microphone would provide. You don't want to overload the phone.
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-01-31 16:28
    The group responses are correct. It is still a no-no to directly connect to the telephone network and the big brother is watching you!

    Use an external·modem (available on surplus market, baud rate is unimportant for just dialing·)··and connect the Stamp via serial port. Send the proper dialing codes ( ATDT....) to the modem. Look up Hayes modem codes on the web. Than you can monitor the modem progress responses.
    There in no need "fooling around" with Stamps DTMF codes·(and proper digit timing) in this case, unless it is your objective of course.

    You did not elaborate what you want to do after dialing and connection is established.

    Vaclav
Sign In or Register to comment.