J.D. Peiffer, Ziao Chen, Satish Nair, Drew Headley
- testing: contains predefined input vectors (20-110 Hz chirp) for observation and testing.
- matlab: contains matlab application to visualize output of testing script. Sample data is provided. Run "visualization_tool" in matlab.
- main: real time code with serial interface for setting threshold and triggering phase.
- amplifier: information for constructing input buffer circuit.
- Download Arduino IDE
- Download Teensy Loader/Teensyduino
- This is a software add-on to the arduino software. All of the programming is done in Arduino IDE and Teensy Loader helps compile and upload code.
- Most all Arduino functions like Serial.print() and digitalWrite() work with the teensy.
- With any serial input, the algorithm will halt and bring up the serial menu. It should look something like this:
- Type an option to change parameters. Type quit to run the algorithm.
- Teensy reads from pin A6 (labeled 20) at a rate of 2 kHz.
- Sample is inserted to each of the four filter band's (20-50, 40-70, 60-90, 80-110 Hz) amplitude and phase filter.
- Each band calculates its amplitude from amplitude filtered signal and phase from phase filtered signal. These numbers are all reported to the main function.
- The main function determines which band has the highest amplitude and reports the detected phase for that band. (A band must me the strongst band for over 50 samples, 25 ms, to be considered the "strongest". This prevents switching back and forth at the edge of bands.)
- If the desired phase is found in the strongest band, digital pin 2 (labeled 2) will be held at a high voltage for 2 samples (1 ms). This is editable by the user.
- Plug in serial USB to change triggering phase or threshold.
- Analog pin 6 (21 on teensy): input signal (0-3.3 V)
- Digital pin 2 (2 on teensy): written high for triggering
- Digital pin 1 (1 on teensy): set high to supress triggering output
- Ground (G on teensy): ground
- Teensy 4.1 Pinout
- Teensy 4.0 Pinout
Signal in yellow, trigger in blue. 95 Hz
Lower band at 35 Hz.
Detection for zero crossing.
Trough Detection
Frequencies in between filter bands (45,65,85,105) show the most latency.