Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing with phone line. — Parallax Forums

Interfacing with phone line.

CODERCODER Posts: 5
edited 2008-06-27 20:34 in BASIC Stamp
HI,

·I want to make or get made the following project.

·From a PC I want to dial a phone number and from the other side
·I need a device that answer this call and send the data accumulated.

·The remote device will be counting 3 different pulse during the day.
·And at night I want to make the call and get these count.

·I can make the code in the PC and place the call using a modem.

·My·problem is with the remote modem and the microcontroller.

·Can someone help me?


·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-20 14:32
    You need what's called an "embedded modem" like this: www.cermetek.com/05/607-0019.pdf. This one is low speed, but fast enough for your purpose (which makes it inexpensive). On the PC side, you'll need a modem as well. Pretty much any will work and, because of modem standards, should work with any standard embedded modem. Your remote device can check for ringing and, if present, go to a routine to answer the telephone and initiate a connection. For the actual data transfer, the SERIN / SEROUT statements would work and the PC would see serial characters. You'd have to work out some simple scheme for the data exchange. Since you only have a limited amount of data, maybe sending it twice would be enough for error checking and the PC could send a reply that indicates that both copies were identical and were otherwise valid (not too big, not too small, etc.)
  • CODERCODER Posts: 5
    edited 2008-05-20 14:48
    Thank you Mike for answer.

    ·This Cermetek is only the modem so I will need
    ·a microcrotroller to control the modem and supplies the
    ·Data.

    ·Do you know a product that has this Cermetek and a microcontroller
    ·build in a sigle board?


    ·
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-20 14:52
    I think you need one (or two) of these: http://www.microcenter.com/single_product_results.phtml?product_id=0255033

    Which is "an RS-232 external modem". These have an "auto-answer" mode, which would let the modem pick up the phone, and generate an "off-hook" signal for your 'remote' BS2. The remote BS2 (mounted on an RS-232 BOE) uses that signal then to know that somebody is "calling" it, and begins its part of the data transfer hand-shake.

    You can connect "in-bound" RS-232 status signals (like 'Ring' and 'off-hook') to the BS2 by simply using a 22 Kohm resistor in-line to 'clip' the signal to zero to +5 volts. If you then use the programming port as the modem connection, everything coming to it from the Modem will be 'echoed' back to the modem by the BS2 hardware, so your 'local' PC program will need to 'filter' those out. But that keeps the hardware simple.

    For a few dollars more, you can buy one of these for your remote BS2: http://www.kronosrobotics.com/xcart/product.php?productid=16167&cat=287&page=2

    For $13 or so, this gives you a true RS-232 +- 10 volt to TTL converter, so you could then use ANY of your I/O pins on the BS2 to monitor the Modem signals, recieve data from the modem, and send data back.

    Oh, and for testing, where you want to connect your modems back-to-back in the same room, you can use this: http://www.jagshouse.com/modem.html


    Post Edited (allanlane5) : 5/20/2008 2:58:45 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-20 14:57
    I thought you were asking what you needed to allow a Stamp to connect to a phone line and supply the data to the PC over the phone.

    A Parallax Stamp is more than capable of counting pulses and controlling a Cermetek modem. If the pulses are shorter than maybe 20 milliseconds or occur more often than 50 times a second, you may need a little external logic to make sure you don't miss them, particularly if they can occur at the same time.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-20 15:01
    Note the BS2 in a BOE board may be all the "microprocessor" you need. This depends on the signal you're trying to read on the "far end".
  • CODERCODER Posts: 5
    edited 2008-05-20 15:22
    · The signal I need to read are simple pulse that

    · increment a mechanical counter and has long duration.

    · The BS2 will get this pulse and increment a var in Memory

    · and this var will be send using the modem.

    · But I will need 3 port to get this pulse.

    ··Do you know a board that can hold the BS2 and the Cermetek modem?
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-20 15:29
    Why, if it's a "single pulse", do you need "3 ports" to get it? There's something going on that I don't understand yet.

    Regarding the "Cermetek" -- Parallax USED to make a "Cermetek" based modem App-Mod, which would plug directly into the App-Mod header on the BOE-board -- which I agree made a very nice package.

    Parallax doesn't make the Cermetek App-Mod anymore.· I'm not sure Cermetek makes their chip any more -- but interfacing to it was NOT 'trivial', the phone-line interface requires a device registered with the phone company before you plug it in.· "Stand-alone" modems like the one indicated above have done all this work for you, and all you need is an RS-232 port to talk to them (using the Hayes compatible command set).

    RS-232 interfacing is very easy, compared to wiring in a board to carry the Cermetek modem chip, IF you can find a Cermetek modem chip.

    Then all you'll need will be a BOE with BS2 chip, and some RS-232 cables (null-modem on the BS2 end, since you'll have a Modem device (the BOE) talking to a Modem device (the Modem) ).· And maybe a box to put the BOE in if necessary.· And the wall-wart supply for the BOE.


    Post Edited (allanlane5) : 5/20/2008 3:38:16 PM GMT
  • CODERCODER Posts: 5
    edited 2008-05-20 16:04
    No, I apologize. With sigle pulse I mean that this pulse will be present occasional
    and there are 3 lines that generate different pulse so the 3 port.

    You suggest a standard external modem controlled by the BS2 using RS-232?
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-20 16:07
    "A standard external modem controlled by the BS2 using RS-232" is correct.
  • CelticLordCelticLord Posts: 50
    edited 2008-06-10 03:37
    This circuit will allow you to make a call and send DTMF tone with DTMFOUT. This circuit also has a ring detector. With a DTMF Decoder, (If anyone knows of a simple one around please let me know) you could send data to it from a phone keypad or other device.

    Note: Use the TT7-DTMF receiver from Ramsey Electronics http://www.ramseyelectronics.com/cgi-bin/commerce.exe?preadd=action&key=TT7.
    ·········Leave out·the large IC (SN74154) and.........
    ········1.·Solder a lead from its pin 19 on·it's pad·to·jumper P3 on the·BS2.
    ········2. Solder·4 leads from it's pin 23-20 to jumpers P8-P11 on the BS2.
    ······· 3. Solder J1 to GRD. and TALK on phone com circuit board·below
    Modified code·added for this circuit.

    ' Security_Alarm.bs2 
    ' {$STAMP BS2} 
    ' {$PBASIC 2.5} 
    ' ___________________________________________ 
    ' | Security Alarm & DTMF Phone Communcation | 
    ' -------------------------------------------- 
    ' | 06/01/2008 © Braun                       | 
    ' -------------------------------------------- 
    'Pins 
    TmAdj CON $100 ' X 1.0 (time adjust) 
    Hook CON 0 ' Hook Off/On 
    Talk CON 2 ' DTMF Communication on pin 13 
    'Varables 
    Switch VAR Nib ' Security switches 
    RingCount VAR Byte ' Ring counter 
    RingPulse VAR Word ' Ring Pulses 
    eeLoc VAR Byte ' EEPROM address of stored number 
    eeByte VAR Byte ' Byte containing two DTMF digits 
    dtDig VAR eeByte.NIB1 ' Digit to dial 
    Table VAR Nib ' Pick a phone # 
    hiLo VAR Bit ' Bit to select upper and lower nib 
    DTMFDV VAR Bit ' DTMF Data Valid HT9170B pin 15 
    'I/O 
    INPUT 1 'Pin 1 Is Ringer 
    INPUT 4 'BS2 Pin 4 = HT9170B DV Pin 15 
    INPUT 8 'BS2 Pin 8 = HT9170B D0 Pin 11 
    INPUT 9 'BS2 Pin 9 = HT9170B D1 Pin 12 
    INPUT 10 'BS2 Pin 10 = HT9170B D2 Pin 13 
    INPUT 11 'BS2 Pin 11 = HT9170B D3 Pin 14 
    INPUT 12 'Pin 12 Alarm Switch 
    INPUT 13 'Pin 13 Alarm Switch 
    INPUT 14 'Pin 14 Alarm Switch 
    INPUT 15 'Pin 15 Alarm Switch 
    'Data 
    Phone1 DATA $00,$00,$00,$0F ' Phone: 1-000-000-0000 
    Phone2 DATA $00,$00,$00,$0F ' Phone: 1-000-000-0000 
    Phone3 DATA $00,$00,$00,$0F ' Phone: 1-000-000-0000 
    Phone4 DATA $00,$00,$00,$0F ' Phone: 1-000-000-0000 
    Phone5 DATA $00,$00,$00,$0F ' Phone: 1-000-000-0000 
    'OUTPUT DTMFcs 
    
    Main: 
    'DEBUG CLS, "Main" 
    'Check for open Switch Inputs (+) = open switch 
    IF (IN12 = 1) THEN Switch = 1: GOSUB MakeCall 
    ' IF (IN13 = 1) THEN Switch = 2: GOSUB MakeCall 
    ' IF (IN14 = 1) THEN Switch = 3: GOSUB MakeCall 
    ' IF (IN15 = 1) THEN Switch = 4: GOSUB MakeCall 
    'Check Ring Of Incoming Call 
    IF (IN1 = 0) THEN Ringer 
    GOTO Main 
    Ringer: 
    RingPulse = 0 
    RingCount = 0 
    Cont: 
    COUNT 1, 4500, RingPulse 
    IF RingPulse > 20 THEN RingCount = RingCount + 1 ' Add to ring count 
    IF RingPulse < 21 THEN RETURN ' Caller Hung Up 
    IF RingCount > 4 THEN PickUpCall ' Get Call 
    GOTO Cont 
    PickUpCall: 
    HIGH Hook ' Off Hook 
    PAUSE 1000 ' Pause 10 sec 
    FREQOUT 2, 200, 2500 ' Sync Tone 
    FREQOUT 2, 500, 3500 ' Sync Tone 
    RingCount = 0 
    ' MC145436AP programing 
    DO WHILE (RingPulse < 8000) ' Loop until Timeout 
    DTMFDV = IN3 
    IF (DTMFDV = 0) THEN GOSUB Command ' Valid Chr HT9170B DV Pin 15 
    RingPulse = RingPulse + 1 ' Inc Timeout 
    'DEBUG CRSRXY, 1, 2, BIN DTMFDV 
    LOOP 
    LOW Hook ' On Hook 
    GOTO Main 
    
    MakeCall: 
    HIGH Hook 'Off Hook 
    PAUSE 2000 'pause 10 sec 
    FOR Table = 0 TO 0 
    ' retrieve address 
    LOOKUP Table, [noparse][[/noparse]Phone1, Phone2, Phone3, Phone4, Phone5], eeLoc 
    Dial_Number: 
    DO 
    READ eeLoc, eeByte ' Retrieve byte from EEPROM 
    eeLoc = eeLoc + 1 ' point to next pair of digits 
    FOR hiLo = 0 TO 1 ' Dial upper and lower digits 
    IF (dtDig = $F) THEN EXIT ' Hex $F is end-of-number flag 
    DTMFOUT Talk, 150 */ TmAdj, 25, [noparse][[/noparse]dtDig] ' dial digit 150 ms on, 25 ms off 
    eeByte = eeByte << 4 ' Shift in next digit 
    NEXT 
    LOOP UNTIL (dtDig = $F) 
    PAUSE 2000 
    'Beep x times for switch 
    PAUSE 24000 ' Pause 1 min 
    LOW Hook ' On Hook 
    NEXT 
    RETURN 
    Command: 
    RingCount = INC ' Read Key From HT9170B PIN 11,12,13,14 
    SELECT RingCount 
    CASE 0 
    FREQOUT 2, 500, 1600 ' KEY D 
    CASE 1 
    FREQOUT 2, 500, 100 ' KEY 1 
    CASE 2 
    FREQOUT 2, 500, 200 ' KEY 2 
    CASE 3 
    FREQOUT 2, 500, 300 ' KEY 3 
    CASE 4 
    FREQOUT 2, 500, 400 ' KEY 4 
    CASE 5 
    FREQOUT 2, 500, 500 ' KEY 5 
    CASE 6 
    FREQOUT 2, 500, 600 ' KEY 6 
    CASE 7 
    FREQOUT 2, 500, 700 ' KEY 7 
    CASE 8 
    FREQOUT 2, 500, 800 ' KEY 8 
    CASE 9 
    FREQOUT 2, 500, 900 ' KEY 9 
    CASE 10 
    FREQOUT 2, 500, 1000 ' KEY 0 
    CASE 11 
    FREQOUT 2, 500, 1100 ' KEY * 
    CASE 12 
    FREQOUT 2, 500, 1200 ' KEY # 
    CASE 13 
    FREQOUT 2, 500, 1300 ' KEY A 
    CASE 14 
    FREQOUT 2, 500, 1400 ' KEY B 
    CASE 15 
    FREQOUT 2, 500, 1500 ' KEY C 
    ENDSELECT 
    RingPulse = 0 
    RETURN 
    END 
    

    Conect the unused·BS2 Pins P4·- P6 to a·74164·(serial in / paralel out) shift register and you can control up to·8·devices.

    Post Edited (CelticLord) : 6/26/2008 5:53:23 AM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-06-10 14:26
    1. Okay, that's half the problem -- getting a BS2 to dial out.

    2. It does not solve the data transfer problem.

    3. I strongly suspect it's not using an approved phone company interface, so there may be legal troubles there.

    4. Simply attaching a stand-alone modem to an RS-232 port solves all three problems at the same time, for $70, legally.
  • stamptrolstamptrol Posts: 1,731
    edited 2008-06-10 14:39
    allan has hit all the key points:

    1. use a "real" modem on each end to be legally connected to the phone system.
    Available for almost nothing at yard sales, office equipment clearance sales, e-bay. Almost any speed capability will work fine with the Stamp.
    2. the modem will give easily implemented auto answer for the remote end.
    3. the stamp can easily store the data, detect that the modem has gone on-line and then download the data.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • CODERCODER Posts: 5
    edited 2008-06-11 02:49
    I'll try the external modem and the BS2.
  • FUE ToolsFUE Tools Posts: 2
    edited 2008-06-27 20:34
    The "legal" connection to the PSTN or phone line is called a DAA. Cermetek has a set here ( http://www.cermetek.com/data.htm) that works with their components, but I agree with the above post's to use an external RS-232 modem. We previously used their DAA and had some difficulty related to circuit layout and noise injected into the audio.
Sign In or Register to comment.