Shop OBEX P1 Docs P2 Docs Learn Events
Polaroid Camera Sonar hack — Parallax Forums

Polaroid Camera Sonar hack

LouisLouis Posts: 2
edited 2006-12-29 17:48 in BASIC Stamp
I have a sonar system·extracted from a Polaroid One Step(http://www.seattlerobotics.org/encoder/200010/dlcsonar.html).
I made the mods to the Polaroid board, wired a breadboard (http://www.seattlerobotics.org/encoder/200010/onestpg.jpg), added the required additional power source with a common ground, added an OEM BASIC Stamp 2sx, and ran the code provided (http://www.seattlerobotics.org/encoder/200010/sonar.bs2).

The debug window consistently reports time to be '1'. I have tried using multiple distances but the reported value never changes. I can hear the transducer clicking.·I have tried the same mod on a separate Polaroid board with the same results. Any help would be appreciated.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2006-12-29 17:31
    Did you comment out the appropriate lines in the program for the non used board? Could you attach you exact code?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • LouisLouis Posts: 2
    edited 2006-12-29 17:48
    The code is below. The only change I made from the·website is add the Stamp Directive and·comment out the math for calculating inches.·I am using a One Step so I·won't need to comment out the camera selection. Thanks for the help

    ' {$STAMP BS2sx}
    'Polaroid SONAR programs for the Parallax Stamp II
    'Copywrite Dennis Clark 9/2000, more or less.
    SPKR· CON· 1
    'Polaroid SONAR one-step program
    PWR· CON· 13
    XLOG· CON· 14
    MFLOG· CON· 15
    'Polaroid SUN 660 (6500 board) SONAR
    INIT· CON· 15
    ECHO660· CON· 14
    BINH660· CON· 13
    time· VAR· Word
    feet· VAR· Word
    inches· VAR· Word
    start:
    FREQOUT SPKR,200,2000
    PAUSE 2000
    GOTO onestep· 'comment this line out to use the 660 routine below
    'Polaroid 660· routine
    OUTPUT PWR
    OUTPUT INIT
    INPUT ECHO660
    LOW INIT····· 'turn init off
    HIGH PWR····· 'turn power off
    trdng:
    LOW PWR······· 'turn on power
    PAUSE 5······· 'wait a little
    HIGH INIT
    PULSOUT 0,600····· 'wait 1.2ms (dummy line)
    RCTIME ECHO660,0,time··· 'Now,wait for ping pulse
    time = time*2
    inches = time/148+11··· '1.78ms per foot round trip
    ······· 'with a little fudge for Stamp latency
    DEBUG DEC time,"uS ",DEC inches," in",CR
    LOW INIT····· 'turn init off
    HIGH PWR····· 'turn power off
    PAUSE 1000····· 'let us catch our breath
    GOTO trdng····· 'do it again
    onestep:
    'Polaroid One-Step routine
    INPUT XLOG
    INPUT MFLOG
    HIGH PWR····· 'turn power off
    srdng:
    LOW PWR······· 'turn power on
    PULSIN XLOG,0,time··· 'wait for XLOG (pulse started)
    RCTIME MFLOG,1,time··· 'wait for MFLOG (ping returned)
    'time = time*2····· 'actually 2us per count
    'inches = time/148··· '1.78ms per foot transit time
    'inches=inches+2····· 'occasional hack needed.
    HIGH PWR····· 'turn power off
    DEBUG DEC time,"uS ",DEC inches," in",CR
    PAUSE 1000····· 'seems to take a while to recharge...
    GOTO srdng
    END
Sign In or Register to comment.