Libraries for recording analog input data on Teensy 3.2/3.5/3.6/4.0/4.1 microcontrollers.
Recording from the Teensy's internal ADCs (InputADC) is based on Pedro Villanueva's ADC library, Paul Stoffregen's DMAChannel, Bill Greiman's SdFat library, and on Stefan Mucha's first EOD logger sketch with contributions by Lydia Federman (simultaneous recordings from both ADCs) and Sebastian Volkmer (multiplexing).
Recording a TDM data stream (InputTDM) is based on the Teensy Audio library and the setI2SFreq() function introduced by Frank B on the Teensy forum.
- Flexible producer/consumer data model based on a single multiplexed circular buffer.
- Multiplexed acquisition from multiple channels, from one or both ADCs or TDM streams.
- Conversion of data to signed 16bit for direct storage into wave files.
- Continuous storing of recorded data as wave files on SD cards.
- Detailed metadata in wave file header: sampling rate, number of channels and pin IDs, bit resolution, gain, date and time, Teensy board version, and its unique MAC address.
- Filenames based on date and/or time of the real-time-clock or incremental.
- Analysis chain on top of data buffer.
- Audio monitor.
- Display recorded data on a monitor.
- Generate test signals.
- React to push buttons.
- Feedback by blinking the LED.
For slow acquisition of environmental sensor readings see ESensors library.
- Installation instructions
- Performance of Teensy ADC
- Audio output: hardware for audio output.
- Audio input: hardware for audio input (microphones).
- Data rates: data rates for a range of sampling rates and channels.
The features provided by TeeRec are provided by many C++ classes,
defined in the following libraries. You can include them all at once
via the TeeRec.h header.
- DataBuffer: A single cyclic, multiplexed buffer holding acquired data.
- DataWorker: Producer/consumer working on a DataBuffer.
- Input: Base class for all input streams.
- InputADC: Sample from multiple analog pins into a DataBuffer. Also see Performance of Teensy ADC.
- InputTDM: Streaming TDM data into a single cyclic buffer.
- Device: General device infos.
- ControlPCM186x: Control a TI PCM186x chip.
- SDCard: Oparate on SD cards.
- SDWriter: Write data from a DataWorker to SD card.
- WaveHeader: Setting up wave file header with metadata.
- Settings: Common configurable settings (file name, path, etc.)
- InputSettings: Configuration settings for any Input class.
- InputADCSettings: Configuration settings for InputADC.
- InputTDMSettings: Configuration settings for InputTDM.
- InputMenu: Actions and menu for checking and reading analog input data.
- RTClockMenu: Actions and menu for reading and setting the real-time clock.
- SDCardMenu: Actions and menu for dealing with SD cards.
- DiagnosticMenu: Actions and menu for diagnostics of the Teensy board, PSRAM memory, and devices.
- BlinkMenu: Menu for reporting and testing Blink pins.
- AudioPlayBuffer: Make the DataBuffer available as an input for the Audio library.
- AudioMonitor: Play recorded data with optional feedback signals on speaker.
- AnalysisChain: Coordinate analysis of data snippets via Analyzer.
- Analyzer: Base class for analyzers called by AnalysisChain.
- RTClock: Time and date strings from the onboard real time clock.
- RTClockDS1307: Use external DS1307, DS1337, DS3231, and MAX31328 chips real time clock.
- DigitalIODevice: Base class for operating a digital input/output devices.
- DigitalIOPCA9536: Controling the PCA9536 digital input/output device.
- Blink: Blinking LEDs.
- PushButtons: Manage and query push buttons with callback functions.
- Display: Display data on a TFT monitor.
- AllDisplays: Include selected TFT library for the examples.
- TestSignals: Generate test signals on pulse-width modulation and DAC pins.
- TeensyBoard: Find out which Teensy board we are running on.
- TeeRecBanner: ASCII art banner and TeeRec version for output streams.
In examples/ you find sketches demonstrating the use of the TeeRec libraries.
These examples could be used as the basis for you data acquisition application.
- scope: Show acquired data on a display.
- logger: Continuously store data on SD card.
- recorder: Show acquired data on a display and store data on SD card upon user request.
- audioscope: Play acquired data on speaker and display them on a monitor.
- audiorecorder: Play acquired data on speaker and store data on SD card upon user request.
Useful sketches for checking out the performance of the data acquisition.
- zero: Report mean and standard deviation of recorded signal.
- maxrate: Test for maximum possible sampling rate.
- averaging: Test various averaging settings for acquisition.
Some useful utilities.
- sinegen: Sine-wave generator.
- teensyboard: Print Teensy board version, serial number and MAC adress.
- writeconfig: Write a default configuration file on SD card.
- sdtools: Inspect, test, and format SD cards.
Demonstrate the usage of some of the provided libraries.
- blink: Demonstrate usage of Blink class.
- pushbuttons: Demonstrate usage of PushButtons class.
In utils/ you find some useful python scripts.
- viewwave: display the traces in a wave file.
- spectra: power spectra of traces in wave files.
- noise: plot and analyse baseline noise levels from wave files.
- continuity: check whether pulse signals recorded into wave file have consistent periods over many wave files.
- mergechannels: take from each provided wave file one channel and merge them into a single wav file.
- cycles: plot failures in pulse traces? - needs update.
For allowing these script to use metadata contained in the wav files generated via the TeeRec library (pin names for channels, settings of the ADC), install audioio.
TeeRec is used in:
-
EOD-Logger: A 2-electrode logger for recording electric-organ discharges of electric fish.
-
TeeGrid: Electrode arrays based on 8-16channel recording devices for recording electric fish behavior in natural habitats (see Henninger et al. 2018 and Henninger et al. 2020).
-
FishFinder: Smart fishfinders for better EOD recordings of electric fish in the field.
- Teensy Audio library
- microSoundRecorder - Environmental Sound Recorder for Teensy 3.6: [github] [wiki] [forum]
- Frank's bat detector
- Teensy Batdetector