I am planning to design a digital theremin.
At this first stage of the project I only look at it as a problem of constructing a good sensor which converts capacitance to digits.
Reading this forum I can’t find the answer to the main designer question: what parameter is to be optimized?
And how can we compare different designs?
I am not interested in how many octaves an instrument has, how long is its neck, how good is its linearity, how bright is its sound etc.
I believe that having a good capacitance sensor it is not a problem to make your own setup.
But what does it mean – a good capacitance sensor?
Can we compare different capacitance sensors using one quantity?
The first thing that comes to mind is the ratio E^2/F where E is the standard deviation of measurement error and F is the sample rate.
Here we have E squared because it is possible to do averaging.
If we average for example 4 measurements, F becomes 4 times smaller and E becomes 2 times smaller.
So we have to sqare E to obtain "frequency-independent" quantity. The smallest ratio = the best sensor.
Please correct me if I am wrong. I want to evaluate something theoretically before I start to build an instrument.
To build theremin, you need to measure capacity of antenna.
Typically, capacity of rod antenna when there is no hand nearby is 8-10pF (let's call this value C_ant).
When hand is close to antenna, capacity increases by 1.5-2pF (let's call this value C_hand).
Increasing of hand to antenna distance by 10cm decreases C_hand by 3.5 times. So, each 10cm of playable distance requires 2 more bits of sensor output.
E.g. at 20cm from antenna, C_hand=0.122pF, on 70cm C_hand=0.000233139 (log scale, decreased exponentially).
To be usable, sensor should measure capacitance changes 0.00001pF or even 0.000001pF of 10pF in realtime.
To measure C, you can use either RC (f ~ 1/(R*C)) or LC (f ~ 1/sqrt(L*C)) approach.
However, RC sensitivity is too low - suitable for 10-20 cm ranges only.
All theremins are based on LC sensor - it is sensitive enough for theremin playable hand ranges.
LC tank resonance frequency is being changed with change of C as 1/sqrt(L*C).
We can measure resonant frequency and use it as sensor value.
Theremin sensor requires good inductor, usually 1..5mH. Air core inductors have better stability.
It makes sense to keep most of LC capacity in antenna (otherwise, e.g. having additional caps in oscillator affecting LC, it would reduce relative sensitivity).
LC frequency is decreased by ~8% when hand approaches antenna - higher 4 bits of measured LC frequency from sensor will be constant.
2 bits per 10 cm * 8 = 16 base bits for 80cm
To sense small movement on max range, add at least 4 bits : 20 meaningful bits needed.
Total number of bits from sensor, including non-changing higher 4 bits becomes 24.
There are two methods to measure LC resonance:
1) build LC oscillator and measure its frequency
2) pass some reference frequency to LC and measure it's response (phase shift), optionally - correct reference frequency according to measured phase shift to drive signal near to resonance (phase locked loop).
It's a good idea to simulate oscillator in LTSpice before building of real hardware.
In digital theremin, oscillator board (analog part) can be connected to digital part (MCU or FPGA) with 3 wires - GND, Vcc, OSC_OUT.
Separate oscillator board would allow you to test different schematics of oscillators.
Approach with PLL needs 5 pins for connecting of analog part: GND, Vcc, Drive, Ref_out, Shift_out
Digital part of sensor requires measure of signal frequency with high precision.
If you are going to use microcontroller board, choose one with highest available CPU and BUS frequency.
I've tried Teensy 4.0/4.1 with 800MHz CPU and 200 MHz bus allowing to capture frequency with 200MHz sampling precision timer, and DMA to transfer data from timer.
You can find some results of MCU based sensor testing in thread Teensy 4.1 MCU based theremin
Averaging is working fine. I've got enough bits from sensor. But after 40-60cm, main hum noise becomes more visible than hand movements.
Additional averaging of sensor output using 50Hz or 60Hz period (moving average) reduces this noise good enough. (See last posts in this thread).
Averaging by 50Hz actually introduces 10ms (100Hz) delay between hand movement and filtered sensor data.
This 50/60Hz noise signal is highly periodic. Probably, we can predict its waveform and subtract it from sensor data in advance, w/o introducing of high latency.
With FPGA, it's possible to sample sensor signal with higher frequency (e.g. 1.2GHz on my Zynq FPGA, or even more with subsampling).
As well, with FPGA it's easy to implement phase-locked-loop (PLL) LC sensor.
It's expected that PLL has smaller noise level.
Now I'm working on Zynq Z7020 based FPGA theremin
Schematic is ready, I've designed and ordered PCBs. So far, unsoldered.
I hope my digital theremin design would be most powerful theremin ever.
Phase locked loop analog front end is connected to FPGA via differential pairs (assuming it could reduce noise).
FPGA part in Zynq 7020 has A LOT of resources. Dual 600MHz ARM cores and 512MB sdram - for GUI and non-critical code.
Controls board with 4.3inch LCD with resistive touch, 8 encoders, 8 pots.
On board, there is an audio codec providing line in / out, and phones out. As well, there is S/PDIF optical out.
Would you like to join this project?