Super Clean Goertzel Operation With Ultrasonic Transducers
![cgracey](https://forums.parallax.com/uploads/userpics/492/n3LNWX06A4QTA.png)
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.
That'll be the Spin2 polar to cartesian conversion. It'll use the cordic QROTATE command.
It's a Spin2 instruction that converts polar coordinates to cartesian coordinates. It uses the QROTATE instruction in PASM.