Let's Design and Build a (mostly) Digital Theremin!

Posted: 5/2/2025 5:45:39 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017


[dewster] I had the idea that quadrature phase delay could be introduced by the 6800pF caps rather than a single capacitor at the output.  The motivation here was to keep the current mirror gain as high as possible, and indeed you can see from the above that it provides a pretty good square wave going into the Vsense inverter input, and the phase is good.  The delay of course varies with inductor value, unlike the integrating approach.

I believe this 90 degrees shift is similar to RC filter.
Not only changing of inductor, but as well hand movement would change the phase delay introduced by it.
Probably it makes sense to try improving integrator approach which always provide 90 degrees shift?

[dewster] The thing is, tapping off of the antenna with a capacitive divider is really pure, and the LC gain (i.e. Q) at that point is enormous, so by intuition alone it's rather easy to see why it is likely the most optimal solution so far, and for this approach - i.e. squaring up the sine wave and using that edge timing digitally.  The most optimal in an absolute sense would likely be high speed AD conversion and some sort of best fit procedure in the FPGA.

Don't you consider using of comparator convert low amplitude sine to square?

Posted: 5/3/2025 11:07:09 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"I believe this 90 degrees shift is similar to RC filter.  Not only changing of inductor, but as well hand movement would change the phase delay introduced by it.  Probably it makes sense to try improving integrator approach which always provide 90 degrees shift?"  - Buggins

I agree, though the integrator approach has a lot of gain associated with it, while the C divider is generally knocking things down.  On my breadboard it looks on the scope like there's a lot of Vcc and ground noise injected into the sensing side from the drive side, which is likely the source of a lot of the phase noise and bobble.  Having a lot of gain probably exacerbates this.  It's too bad higher voltages aren't easily available on the AFE, that would make higher voltage drive easier and would give more headroom for the analog sensing.

"Don't you consider using of comparator convert low amplitude sine to square?"

You have a point, AHC, LVU, and LVCU threshold voltages tend to be fairly well centered for the batches I've purchased, but this perhaps too much of an ill-specified parameter to rely too heavily.  Though there are other issues, such as input capacitance temperature dependence, which is never specified for things like op-amps and perhaps comparators as well.

A circuit I've been thinking about from the very beginning would be one that doesn't attenuate the antenna voltage, but only "looks at" a the small window of 0 to 3.3V, and doesn't significantly load the antenna or otherwise introduce phase shift at the sense output.  This would give a really sharp edge by employing the full LC voltage gain.  But a small capacitor tied to diodes (could be ESD diodes) unfortunately gives almost 90 degrees of phase shift here.

Posted: 5/5/2025 8:57:23 AM
Buggins

From: Porto, Portugal

Joined: 3/16/2017


[dewster] You have a point, AHC, LVU, and LVCU threshold voltages tend to be fairly well centered for the batches I've purchased, but this perhaps too much of an ill-specified parameter to rely too heavily.  Though there are other issues, such as input capacitance temperature dependence, which is never specified for things like op-amps and perhaps comparators as well.

A circuit I've been thinking about from the very beginning would be one that doesn't attenuate the antenna voltage, but only "looks at" a the small window of 0 to 3.3V, and doesn't significantly load the antenna or otherwise introduce phase shift at the sense output.  This would give a really sharp edge by employing the full LC voltage gain.  But a small capacitor tied to diodes (could be ESD diodes) unfortunately gives almost 90 degrees of phase shift here.


For self-biasing inverter inaccurate center point is probably not a problem.

Current sensing integrated value could be preconditioned - using limiting amplifier - e.g. provide output with amplitude about 1V for further squaring using unbuffered inverter (for lower input amplitude it will give more sine-like output, for higher - more squarish).
Now I'm playing with LTSpice models based on LT13700 OTAs. They can be powered from 4.5 as well as from 3.3V (with limiting of working range, and completely useless darlington buffer).
OTA13700 is cheap, and available in different packages, including breadboaed friendly DIP16.
Two OTAs of LT13700 package might form two stages of limiting amplifier - almost the same output amplitude for wide input range, just a waveform is being changed.

Posted: 5/5/2025 6:34:00 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Another AFE

Played with this sim some today:

R5 and R6 are just there to improve the waveforms - and instead of sensing current via resistors in the legs of the current mirror, the current through diodes Q5 and Q6 is sensed directly.  As before, Q7 and Q8 form current sources, integrated by C3.  R7 & R8 weaken the integration current so a smaller capacitor can be used.  The output swing to the coil is unfortunately limited to within a diode drop of the rails, rather than rail-to-rail, but that's the limit of the kit AFE too.  Integrator would likely need centering resistors too.  No idea where this is all going, but thought this was an interesting variation.

A lot of what makes the AFE a super difficult design space is the 5V supply constraint, which is probably stupid / crazy.  A charge pump or similar operating synchronously to the field frequency might be a good thing to investigate in order to boost the supply voltage.

"Two OTAs of LT13700 package might form two stages of limiting amplifier - almost the same output amplitude for wide input range, just a waveform is being changed." - Buggins

I think your pursuit of AGC to keep integration linear is good intuition.  Reducing gain when it isn't needed is perhaps an opportunity to keep noise to a minimum when operating in the far field, but the gain is there for start-up, and when the hand is near the antenna, damping things.

Posted: 5/26/2025 4:53:56 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Linearity Demo

A short video demonstrating the near field linearity of the D-Lev pitch field from the antenna out to 200mm.  Each division on the cardboard tube is 25mm, and the sensitivity has been adjusted to give 2 half steps per 25mm on the tuner.

The near field is where you want to be playing, mainly because it has the least dependence on the calibration of the field, so oscillator drift and the placement of your body doesn't matter nearly as much as the mid field and particularly the far field.  I imagine many players avoid this "sweet spot" because it tends to be non-linear, and accidentally touching the antenna can be rather surprising.  Linearizing and positioning the field mathematically, as well as insulating the antennas, opens up this prime real estate.

Posted: 6/4/2025 1:05:38 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Pod People

I was approached recently by UK podcaster Richard Lipman, who was interested in the D-Lev.  From his YouTube channel:

A Fish out of Water Podcast
A fish out of water always seeks the truth and fresh air. I interview artists and creatives from all walks of life. 99% unedited and uncensored!!

https://afishoutofwaterpodcast.substack.com/
https://www.youtube.com/@afishoutofwaterpodcast

Me:
https://www.youtube.com/watch?v=FJKANE-V-qU
https://www.youtube.com/watch?v=Fhw6JdpPVbw

Kip Rosser:
https://www.youtube.com/watch?v=2NeV53qFCMc
https://www.youtube.com/watch?v=DA9YCLiYZS4
https://www.youtube.com/watch?v=Pno-OLPIlSo

Lydia Kavina:
https://www.youtube.com/watch?v=z4_GSPhZvTM

Posted: 6/14/2025 6:37:36 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Buffer Oscillator

Thought maybe my rail-to-rail buffer could be used as an oscillator:

The input impedance is roughly 1k, this and the 5 x 10pF in series (=2pF) form a high pass filter that drastically attenuates the antenna voltage and imparts a 90 degree phase lead, which compensates for the inductor phase lag, and then closing the loop you get oscillation.

I'm measuring 190Vpp at the antenna plate.  There is very little phase noise, and the circuit is quite stable with supply voltage fluctuation.  It operates down to ~1.5V VCC.  Main downside is it stalls easily, with my finger just a few mm above the plate.  It works better with a larger plate, like auto license plate size.

Instead of high pass phase lead, it might be better to use low pass lag and an inverting buffer, which might help filter out oscillator and environmental noise?

Posted: 6/20/2025 1:22:11 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Operating Points & Coils & Grounding

Most Theremins operate below the AM broadcast band (530kHz to 1.7MHz).  I'm not an analog Theremin designer, but I believe the main reason for this is to comfortably position the resulting heterodyned pitch range within the pitch field.  A digital Theremin doesn't employ heterodyning for direct musical pitch generation, so it can operate below or above the AM band.  It can also operate within the AM band, but there is the obvious danger of RF interference on a performance - I've seen a bit of strange behavior every here and there for which RF interference couldn't definitely be ruled in or out (chasing ghosts here).  Operating below AM requires high value field coils, which ideally (like Theremin's own designs) would be large air-core solenoid types which are very stable with temperature - but they're bulky and fairly painful to wind, and necessarily lead to larger, heavier cabinetry, which can be difficult to transport.  Or (like most of Bob Moog's designs) they can be substantially miniaturized by employing ferrite to concentrate the coil's magnetic field - but the higher the ferrite concentration factor the more they are subject to thermal drift.  In any case drift isn't entirely avoidable, but ferrite drift is usually an order of magnitude higher than drift associated with the electrical properties of the air surrounding the antennas.  Magnetization losses in the ferrite itself limits the maximum Q to somewhat below that of a well designed air core solenoid, but they can still reach respectable and useful levels of resonance (around 130 for a good 50mH RF choke).  Q is an indication of how well off-resonance interference is rejected, as well as a direct magnification factor for the voltage drive - the higher the better, indeed the symbol Q stands for "quality factor".

Fairly physically small air core solenoids can enable digital Theremin operation within and above the AM band.  For example, the 1mH & 2mH coils in the D-lev resonate around 1.2MHz and 800kHz respectively, and are wound on 38mm diameter formers that are 100mm and 110mm respectively, and the Q is around 180.  My t-coil program isn't super good at predicting Q, but I believe it is accurately reporting the influence of skin effect and proximity effect on Q, if only relatively.  Skin effect is when an AC current within a wire flows mostly at the outer surface of the wire, which is caused by opposing eddy currents produced by the changing magnetic field around the wire.  Because the core of the wire isn't substantially involved in conduction, the effective resistance of the wire is increased over the nominal DCR (DC resistance).  Proximity effect is very similar, a given winding on a coil is surrounded by other windings generating their own magnetic fields, and this further reduces the effective conduction of the wire.  Both skin and proximity effect are a function of frequency, and start kicking in around 100kHz for reasonable diameter wire.  You want to place the coil wires close together to magnify the magnetic field, but this also increases the proximity effect - it's a balancing act with no path to perfection, only optimization.

Here is the formula for RLC Q:

  Q = 1/R * sqrt(L/C)

1. Q increases as the inverse of R (the DC resistance of the coil winding).  So maybe we use larger diameter wire, but this directly increases the length of the wire needed, as well as the physical dimensions of the coil.
2. Q increases as the square root of inductance, so making the inductance 4x larger doubles Q.  But the increase in windings also increases R.
3. Q increases as the inverse square root of antenna capacitance, something we don't have a lot of room to change.  And oscillators tend to be more stable with larger area antennas (i.e. larger C).

To evaluate the above directly conflicting optimizations, one needs to do a certain amount of tedious physical experimentation, and simulator software can provide build details and guidance.  It seems to be the case that for coils with a given aspect ratio (winding length / form diameter) and given wire diameter, Q is fairly constant across a wide range of inductance values.  However, my software is telling me that for coils with a given aspect ratio and inductance value, Q should increase with wire diameter.  For example, constructing a 0.5mH coil with 2:1 aspect ratio, going from AWG 30 to AWG 24 lowers DCR from 6.23 to 1.94 Ohms.  But the ACR (AC resistance = DCR & skin & proximity) reduces this change from 19.2 to 12.4 Ohms.  Still, the Q improvement promises to be around 50%, which is something I need to check experimentally.

So assuming that pans out, why not make the move to 0.5mH and 0.25mH coils on the D-Lev?  If wound with heavier wire they would likely have not insignificantly higher Q.  They would resonate around 2Mhz and 2.9MHz, respectively, which would position them more safely above the AM band.  They would still be air-core, and not too different dimensionally from the current coil set.  And fewer windings with heavier gauge wire would be a snap to hand wind.

But there are several things to consider.  The most immediate is the FPGA timing resolution to both generate the coil stimulus and sample the result for phase lock.  Currently the clock used here is almost 400MHz, which gives a resolution of 2.5ns.  For the 0.25mH coil: 400 / 2.9 = 140 clocks per cycle, or 0.72% unit interval.  That would probably work OK, but I worry that the increased quantizing and sampling might be a source of increased oscillator noise / instability.

And there's grounding to ponder.  I was told of an instance where the EPro worked OK but the D-Lev didn't, which made me wonder if this could be due to the vagaries of grounding with respect to operating frequency.  Does anyone really understand Theremin grounding?  It's an elephant in the room lacking formal treatment.  It's really obvious that Theremins need proper grounding: when ungrounded, the fields are shrunken and often noisy / unstable.  The hand and antenna form a capacitor, but there must be a return path, an electrical loop for current to flow.  Is Theremin grounding perhaps easier / more positive at lower or higher operating frequencies?

Hams discuss antenna and radio shack grounding in very practical terms.  A ground isn't something that just magically absorbs all RF current dumped into it.  So anyway I've been messing around with this in a spreadsheet, trying to get some kind of qualitative handle on the various aspects of grounding. 

Grounding of the Theremin via AC house wiring
A 2mm diameter copper wire 20m long  has a DCR of 0.43 Ohms, and an inductance of 41uH, which at 300kHz has an inductive reactance of 53 Ohms and a skin factor of 43%.  At 3MHz the inductive reactance shoots up to 776 Ohms and the skin factor drops to 14%, which is directionally incorrect for improving things, but how bad is this actually? 

Grounding of the human body
The rest of the body is coupled into the current loop mainly via capacitance and resistance.  Connecting one probe of my RLC meter to AC ground and gripping the other probe with my hand, my DCR at 100Hz is around 2Meg Ohms and my capacitance is around 330pF.  The capacitive reactance of 330pF at 300kHz is 1.6K Ohms, at 3MHz is 1/10 this or 160 Ohms.  Body capacitance is always going to swamp hand & antenna capacitance, but both of these capacitive paths, which are in series, will have lower impedance at higher operating frequencies.

It's my feeling that the grounding of the Theremin itself is the most important aspect for field stability.  One could perhaps enhance the AC ground by electrically including the metal of the stand, turning this into a capacitive connection much like the human body.  Testing a metal microphone stand with my RLC meter to AC ground, I'm seeing around 50pF @ 100Hz.  A while back I inserted a capacitor in series with the ground lead on my lab D-Lev and found that (IIRC) 0.01uF was sufficient to behave like a short, and 0.01uF at 1MHz gives a capacitive reactance of 16 Ohms.  For the lower operating points of analog Theremins I would guess that 0.1uF would work here.

[EDIT] The big problem with all of this is the usual: how do you do lab type adversarial testing of a Theremin?  They're so sensitive they respond to just about everything, ruling very little out.

Also, it was re-reading Livio's posts [LINK] on this thread got me thinking about going above the AM band.  Livio had a lot of good advice, and I very much appreciate his involvement in this project.

Link to my spreadsheet: https://d-lev.com/research/wire_inductance_2025-06-18.ods

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