Shop OBEX P1 Docs P2 Docs Learn Events
Super Clean Goertzel Operation With Ultrasonic Transducers — Parallax Forums

Super Clean Goertzel Operation With Ultrasonic Transducers

cgraceycgracey Posts: 14,152
edited 2021-02-20 03:20 in Propeller 2

Today, I finally got around to trying some ultrasonic transducers with the Goertzel mode in the streamer.

I found a bunch of water-proof 40 kHz ultrasonic transducers in the first box I checked. These are piezo devices, so they don't need any coupling caps for driving or sensing. I connected one as a generator between P0 and P1, which output a differential reference sine at 40 kHz. I connected the other between GND and P8, which was configured as a 100x ADC.

Check out how stable the response is:

All you need is two ultrasonic transducers. No passives needed. Code is attached.

EDIT: Code was updated with improved comments for clarity.

Comments

  • Wow thats way better than I would have expected. So glad you found time for that detour.

    Which Parallax robot was it that had 8 or more pin sensors around its periphery? Looks like it would be easy to upgrade it

  • Looking over the code I saw this line: cos,sin := polxy(127, i << -9). What is Polxy()? I don’t see it in the code and it doesn’t show up on the P2 instructions sheet.

  • evanhevanh Posts: 15,915

    That'll be the Spin2 polar to cartesian conversion. It'll use the cordic QROTATE command.

  • cgraceycgracey Posts: 14,152

    @DiverBob said:
    Looking over the code I saw this line: cos,sin := polxy(127, i << -9). What is Polxy()? I don’t see it in the code and it doesn’t show up on the P2 instructions sheet.

    It's a Spin2 instruction that converts polar coordinates to cartesian coordinates. It uses the QROTATE instruction in PASM.

Sign In or Register to comment.