Teensy 4.0 600MHz ARM Cortex M-7 MCU - ideal for digital MCU based theremin?

Posted: 3/9/2022 12:48:17 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

Idea: make desktop app for editing/capturing/playback of theremin score (pitch + volume track).
I've tried to create separate topic, but it looks like it did not pass moderation.

Prototype screenshot (Qt cross platform open source app):


Planned functionality:

* Allow "drawing" of pitch and volume. Should support limitation of velocity/acceleration and higher derivatives of value transitions (simulate hand movement limitations). Pitch correction (snap to center of halfnote), custom transitions between notes, vibrato...

* "Pitch preview" for drawing tools - to hear pitch for moving pointer over pitch track, or pitch+volume when moving over volume track.

* Playback / synthesis of whole track or selected loop, including live reaction on editing.

* Different synthesizers / presets - allow to experiment with synthesis. If algorithms from real digital theremin (like D-lev) implemented, could be used as preset editor.

* Render / audio file export - to save synthesized audio into file.

* Capture track from recorded audio

* Capture track from digital theremin device (e.g. via USB Serial connection)

* Playback track on digital theremin (e.g. send pitch + volume flow via USB Serial to theremin device)


Current state: prototype.
Track is represented by 1200 pitch+volume floating point "sampes" per second.
Zoom / scrolling of pitch and volume panes is working.
127 midi notes range for pitch, 20..-100dB range for gain.
Meter marks are fixed
Drawing tool can be selected (currently, 3 "pens" with different max velocity / acceleration settings).

Currently working on smooth drawing implementation. It's actually not an easy task...

GitHub link


Posted: 2/17/2023 10:27:05 AM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

Idea for FPGA-less MCU based sensor implementation.

Analog frontend may use DDS sine wave generator (AD9833).
MCU will measure phase shift between drive and sense signals.
Phase shift based approach with fixed drive frequency (tuning drive signal frequency near resonance with hand far from antenna during calibration) unlike PLL approach, would not require frequent update of drive parameters.
MCU will just set proper drive frequency once, during calibration.
With current sensing approach (which I like very much), drive signal is passed to inductor via current sensing resistor. Other side of inductor is connected to antenna.
Comparator will sense current direction by comparing of voltage on both sides of resistor.
Second sensor output signal should reflect drive signal zero crossing (e.g. by comparator).
With current sensing approach, phase shift is zero for drive signal frequency equal to LC resonant frequency (tuned for far hand distance).
Phase shift will be changed in a reaction of antenna capacity changes (hand movement) - depending on difference between drive frequency and changed LC resonant frequency.
Sensitivity is zoomed in for far hand distance range.


MCU (e.g. Teensy 4.x) may capture position of both edges for both Sense and Drive signals, and store to buffers using DMA.
Teensy with 800MHz frequency has timer resolution 200MHz. It should be enough for precise phase shift measurement - after averaging.
Drive signal frequency is independent from bus frequency, so there should not be aliasing problems.


Posted: 2/20/2023 4:25:49 PM
ekahn

Joined: 11/2/2022

I forget if I mentioned this in another thread, but have you seen the PIO 'asynchronous state machine' blocks in the $1 RP2040 chip? They each have their own tiny co-processor with its own assembly language, and you can use them to implement custom high-speed peripherals.
https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython
I was thinking it might be possible to use those to capture the Sense edges and perform some simple filtering / averaging, then condense the input data down enough to pass to the main core for the capacitance calculations. Core clock at 133mhz, maybe it could replace something like the TinyFPGA.

Posted: 3/1/2023 5:17:30 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

We have checked rp2040 when it became available.
It seems like a good solution for relatively slow interfaces like SPI, but not for high resolution signal edge position measurement.

You must be logged in to post a reply. Please log in or register for a new account.