Shop OBEX P1 Docs P2 Docs Learn Events
P2 Taqoz 2.8: DAC, Comparator and Goertzel. Touch Sense and Reflex Sensor with Modulated Light — Parallax Forums

P2 Taqoz 2.8: DAC, Comparator and Goertzel. Touch Sense and Reflex Sensor with Modulated Light

Christof Eb.Christof Eb. Posts: 1,103
edited 2022-10-31 08:38 in Forth

Hi,
perhaps this is useful for someone. There are routines/words for

For Goertzel:
This code is partly hard coded to things.
Be aware, that the input adc pin-group and pin for Goertzel summation has to be specified for the xcont assembler command in ddsD# and ddsS#. The DAC-channel (one of 4 8 bit busses unique to each cog) of this cog must be activated in ddsD#. In the wrpin command of the DAC the cogid of the streamer used is to be specified.

To use Goertzel for touch sense I connected the dds output at 1MHz, 3.3V via 22k to a plate, which is directly connected to the Goertzel adc pin, gain=1, input. When the plate is touched, the amplitude received will be smaller. I do not know, if this is the best way to do touch input.

To use Goertzel with a reflective infrared light sensor TCRT5000:
DAC is used to generate modulated light. The goal is to reduce effects from ambient sun light.
Direct output from 124Ohms dac to ir emitter diode. Frequency = 40kHz.
Receiver transistor collector via 2k2 to 3.3V and C= 0.1uF coupling to adc input.
Receiver emitter to GND
Adc gain 3.16
I don't understand why, but 40kHz works better than 100kHz for this.

Have fun!
Christof

Comments

  • Picture of the hacked "Line Follower Module" with TCRT5000. The electronics on the module are not used any more. The pcb is handy for mounting. What looks like chewing gum is a "Uhu patafix" removable adhesive pad, which allows adjustment of the position.

Sign In or Register to comment.