Shop OBEX P1 Docs P2 Docs Learn Events
how does goertzel work — Parallax Forums

how does goertzel work

Are there any simple descriptions about how the Goertzel works on the P2? I saw a video awhile back of Chip moving is finger over a board with four quadrants and an oscilloscope display was tracking his finger. I have no idea how that worked or how precise it can track items. I mean, could it track multiple steel tip darts on a dart board for electronic scoring…could it be used as a gamepad device? I would like to find out more about the possibilities and I'm not sure where to look or if I would understand it.

Comments

  • Well, the technical description is included in the silicon docs:

    DDS/Goertzel

    This mode is unique, in that it outputs and inputs on every clock in which the command is active. Its purpose is to perform direct digital
    synthesis (DDS) on up to four DAC channels and/or to perform simultaneous Goertzel analysis on up to four ADC bit streams summed
    together.

    On each clock, the upper bits of the NCO are used as an index to read a long containing four signed bytes from lookup RAM. The four bytes
    are output to X3, X2, X1, and X0 with their MSBs inverted, so that they may drive the unsigned DACs. The top two bytes from lookup RAM
    are also used as sine and cosine inputs to the Goertzel analyzer, where they are each multiplied by the sum of up to four ADC bitstreams
    and then separately accumulated.

    Goertzel analysis can be thought of as a single slice of a Fourier transform, in which energy of a single frequency is measured amid
    potential noise for some number of NCO cycles. Goertzel analysis returns sine and cosine accumulations which can be converted into polar
    coordinates using the QVECTOR instruction, yielding power and phase information.

    By incorporating DDS output with simultaneous Goertzel input, many interactive real-world measurements can be made to determine things
    like time-of-flight and resonance.

    However, you need some idea about how digital arithmetic works to really understand it. Basically, it's a kind of correlation analysis that tells how the input signal matches a sine and cosine signal of a given frequency. The Goertzel demo board acts like a 2-dimensional potentiometer that mixes four signals (+sin, +cos, -sin and -cos) together at the center electrode. The position of the finger tip determines how the four signals are weighted.

    It could surely be used as replacement for mechanical joysticks/gamepads because there you don't need very high precision. There is visual feedback through the reaction of the game and you intuitively re-adjust the finger position if there's a slight gain or offset error.

    @ti85 said:
    ... how precise it can track items. I mean, could it track multiple steel tip darts on a dart board for electronic scoring?

    You play steel darts? Cool. B) But I fear using the Goertzel engine for darts scoring would be very hard. If a dart hits just above a wire but with the tip facing downward its position would be (by average) lower then a hit just below the wire but facing upward. But according to the rules the hole on the surface is what counts, not the average position of the tip inside the board. That's why I think the best way to do electronic scoring is still with a camera, or even better multiple cameras to avoid mutual obscuring.

    Do you know this solutuion?

    If you want to use Goertzel for precision measurements you need well defined conditions (surface area, air gap...) for the electrodes. Soft fingertips or dart tips with unknown penetration depth and angle are not optimal. But with clever arrangement of the electrodes you can achieve more than 16 bits of angular resolution. Check out this.

  • ti85ti85 Posts: 44
    edited 2021-11-12 13:37

    @ManAtWork

    Thank you so much for the info...I learned a lot. The info about the darts makes perfect sense. Thank you for the help

Sign In or Register to comment.