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

Posted: 12/1/2012 5:24:29 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"They actually behave like inductors not temperature controlled parallel resonant circuits!"  - FredM

Now that I'm running it long-term and with the heat fluctuating downstairs I see increasing frequency (at the speaker) with increasing temperature, so the inductor has the expected positive tempco.  I really envy Theremin builders who can employ air core inductors!

"Regarding mode 0 - My failure in comprehension is on the issue of linearization.. I cannot see how an antenna resonant circuit which is maintained at resonance, can do anything to linearize the response of the theremin."

"My problem is that I do not see this "counter-balancing" operation in action with your mode 0 - I am not saying its not there.. I just dont see it!"

You're not seeing it because there's nothing to see! ;-)  The ~2 octaves right at the antenna are cramped up (like most Theremins, which can be alleviated some as you suggested by placing a capacitor in series with the antenna).  The middle octaves are fairly linear (like most well adjusted Theremins).  And the increase in sensitivity far from the antenna is compensated by a decrease in capacitance change as my hand moves closer to my body.  That's pretty much it.  Qualitatively this sideways 'S' shaped response in the logarithmic output frequency is completely explained by the LC resonance changing with antenna/hand capacitance, and the heterodyning subtraction.

I haven't studied mode 1 nearly as much as you or Thierry.  I can imagine how two high Q coupled circuits tuned to nearly the same resonance might give you a somewhat different response, but I kind of wonder if the potential linearizing abilities of that approach are actually all that powerful.  I'd have to see mode 1 do something unusual in reality or simulation to think otherwise, and I suppose I just haven't yet?

I came at the AFE by playing with inductors and capacitors on a breadboard, and I noticing that a large inductance in series with a tiny capacitance would give a huge sine wave voltage swing across both components if the other end of the inductor was driven by a small low impedance square wave.  Adding a second inductor between the LC intersection and the antenna increased the antenna voltage swing and made it more sensitive to environmental capacitance.  I was seeing fairly linear behavior looking at the delayed (so as to magnify it) in-phase (drive) and quadrature (tank) voltages on my scope, which very much encouraged me in those early days.  At first I though it was due to RS Theremin's screen door spring antenna, but the behavior is the same with my aluminum tape covered PEX antennas.

"So often on my "theremin journey" I have run with what seemed to be a great idea, simulated, breadboarded, gone to PCB design and even in some cases fabrication - and by the time I am ready to "roll" I get another idea or find some radical "simplification" which I "cannot" ignore - so I shelve my (perfectly adequate) most recent board, and go the whole process again..."

The more R&D you put into something the higher your expectations for the final result, and so on - which for a pet project can snowball into an iterative trap of massive feature creep.  I've seen first-hand the often geometric complexity of supporting multiple versions of a product, so I'm trying to avoid that too by getting it substantially right (or at least substantially not wrong) the first time.

Posted: 12/1/2012 5:59:24 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

"You're not seeing it because there's nothing to see!" - Dewster

LOL ;-) .. ok .. Thats good! 

It is extremely difficult to see the "mode 1 counter-balancing" operation by simulation - One needs accurate variation of distance/cpacitance relationship, and one cannot use the faster frequency response analysis methods, because the performance is dependent on active loading of the tank - so one needs to actually run the oscillator in the simulation.

But it does work! When one gets the ratios of the tank inductance and capacitance in the right proportion to the antenna inductance and capacitance, and carefully select these tuning components, one gets a linear playable theremin.. When one doesnt get this right, one gets an EPE 2008 (which can be playable, but is never good unless one changes the tuning components dramatically) or a S/C / Theremax or similar which have no compensation and whose linearity and playability are always greatly inferior to a theremin which is correctly compensated.

And the reasons why some designs are better than others is often mysterious - As with Thierry's observations about the difference in performance of Miller vs Hammond inductors.

This is the major reason I think that I am looking at "active" equalization - I want the ability to "tweek" the response without having to mess about doing "select-on-test" - a couple of trimmers to set the primary response curve, and perhaps a user linearity knob to allow adjustment for different capacitive environments - particularly as I am looking at having a user adjustment for sensitivity (number of octaves one has in the playing field) and I have not found a way to maintain the linearity when sensitivity is changed.

I think that with your digital approach, you have more room for linearity correction at the processing end - the linearity of your front-end is not of primary importance (?).. With an analogue heterodyning theremin, the only place one can implement correction is at the front-end - And I am certain that without correction of some kind, a theremin simply isnt worth building.

Fred.

Posted: 12/1/2012 6:40:13 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"...particularly as I am looking at having a user adjustment for sensitivity (number of octaves one has in the playing field) and I have not found a way to maintain the linearity when sensitivity is changed."  - FredM

Yes this is a very real issue, one I've been grappling with for too long.  The square root circuit I'm using to knock down global sensitivity to 1/2 the raw value is just a stopgap.  A better solution is to knock down sensitivity near the antenna, and let the difference (heterodyne) set the far field sensitivity.  You can approximate this with a second order polynomial, where a difference square term dominates in the near field and the difference term alone dominates in the far.  Adjusting the null point then gives various tone spacings without impacting linearity much.

I think that with your digital approach, you have more room for linearity correction at the processing end - the linearity of your front-end is not of primary importance (?).. With an analogue heterodyning theremin, the only place one can implement correction is at the front-end - And I am certain that without correction of some kind, a theremin simply isnt worth building."  - FredM

I'm not sure mode 0 needs much if anything in the way of linearity correction to make a really nice analog Theremin.  If you watch my first (and only) AFE video, quite a few linear octaves are available with no correction (though the global sensitivity is too high for SNR reasons). 

Posted: 12/1/2012 10:04:18 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

"I'm not sure mode 0 needs much if anything in the way of linearity correction to make a really nice analog Theremin." - Dewster

Sorry, but im back to my "I dont see it.." LOL ;-)

How is the response of Mode 0 any different to the response of a analogue theremin without any antenna resonant circuit ? To me, it seems that Mode 0 frequency is a direct (unaltered / uncompensated / non-linear) function of change of antenna capacitance - just as an uncompensated (as in, tank capacitance directly connected to/altered by the antenna capacitance) theremins VFO frequency is a direct (unaltered / uncompensated / non-linear) function of change of antenna capacitance.

And in my expierience, this is a long way from good enough.

Fred.

I have been playing a bit with various spreadsheets - my unfinished ones and yours.. I think that they may all be flawed.. I think that if one computes the Xl and Xc of the series antenna circuit, and transforms BOTH of these into equivalent "virtual" components which one straps across the tank resonant circuit, one may actually see the operation of the conventional linearization scheme.. Not there yet though.... 

>> My problem is with determining the values for Xl and Xc, as these are frequency dependent in mode 1 - its easy enough to run a simulation (which includes the oscillator) of the whole circuit in LTspice or similat - but not easy (not possible?) to run a "passive" spreadsheet (as in, without a macro or basic program which is actually a model of the oscillator) as these values of Xl and Xc are derived from the oscillator frequency.

Posted: 12/2/2012 12:02:29 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Fred, do you see the linearity in my video?  Lots of octaves with the same hand gesture.

Probably the biggest flaw in my spreadsheet is that it doesn't take the player's body into account - this can really help linearize playing in the far field (I think I see Peter using his body for this in his videos).

I guess I'm not following your virtual component line of thought.  Any simulation must operate the same way that the physical active components detect resonance in the tank, no? Resonance is purely a phase thing.  And all components except the hand|body capacitance are fixed complex values (though there may be significant local oscillator coupling in an analog Theremin).  Their impedance changes with frequency, but that's what capacitors and inductors do for a living?  My spreadsheet solves the whole network for various frequencies, and in the full simulation uses successive approximation to solve for multiple resonance points given hand position.

Posted: 12/2/2012 4:39:38 AM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

Dewster -
First, I just want to ensure that there is no "fight" between us on this matter - Yes, I have looked at your AFE video many times, and am seriously impressed! - But having been "there" myself many years ago, having an impressive performance from a prototype, and then finding that its behaviour (possibly due to the phase of the moon or the migration of the theremin spirits so someone elses prototype - LOL ;-) is not consistant..

You seem to be getting quite good performance - I dont understand how!.. As I see it, you should be getting an inverse-square biased response, only slightly mitigated by the series capacitance.. You should, as I see it, be getting the same kind of linearity as one gets from a Silicon Chip or any other un-equalized theremin... But you do seem to be getting a response which is quite a bit better!

 

"I guess I'm not following your virtual component line of thought.  Any simulation must operate the same way that the physical active components detect resonance in the tank, no? " - Dewster

Any full simulation using accurate models must -

"Resonance is purely a phase thing.  And all components except the hand|body capacitance are fixed complex values (though there may be significant local oscillator coupling in an analog Theremin). "

Not sure I agree with that - There is more to the loading of the oscillator than just phase - there is the change in both the inductive and capacitive reactances in parallel with the fixed value inductor and capacitor of the tank.. Not sure if this can be accurately defined as "purely a phase thing" - Perhaps it can...

"My spreadsheet solves the whole network for various frequencies, and in the full simulation uses successive approximation to solve for multiple resonance points given hand position."

Yeah - the spreadsheet is cleverly done - Its just that Im not maths-able enough to know if its completely right.. I am not doubting your ability - I just wonder if something is missing - particularly in the "mode 1" computations.. I think there is a tendency to go to simplification and sometimes err by doing this (not saying that you have done this) - For decades we all believed that the Lev oscillator had a parallel resonant tank, and Everyone built theremins on this "faulty" basis.. I wonder if there is some misunderstanding like that involved with the equalization process

But whatever is going on, something is wrong.. My problem can probably be summed up by the fact that I dont see any corrective / linearisation of any kind in your implementation (and you say I dont see it, because its not there!), yet you seem to be getting reasonable linearity -

I have tried un-compensated designs (in fact, I did not need any real degree of linearity for the 16 'theremins' I had at the HO2010 - I wanted to make these cheap and cheerful, concentrated more on the tonal qualities than the playability - But I found them unplayable without equalizing, and was forced [by my own standards, not by the client who was perfectly happy with my uncompensated prototype, LOL] to add a crude antenna inductor) (which led to all sorts of other problems - but iveb told that story before ;-)

.. My original HO2010 were using the S/C front end.. I am trying to understand how your mode 0 configuration can behave any differently to it - They both use a resonant circuit which determines their frequency, they both employ hand capacitance (directly) to determine the resonant frequency.. The S/C runs at a much higher frequency, but if anything I have found (and I dont know why) that uncompensated front-ends do appear to become slightly more linear as the frequency is increased.

Which leaves the size of the inductor/s in the primary resonant circuit - Yours are massive compared to the S/C or any "mode 1" theremin I have ever seen..

But once again, I dont see it! - I dont see how this can make the response more linear! - If you had a fixed frequency oscillator driving a large inductance, and were monitoring the phase or amplitude on the antenna (as I do for my volume control and X/Y sensor array) then I could see it - One actually gets the same kind of linearization action as one gets from a conventional osc + antenna EQ circuit (althoug not quite as good) , because one is shifting the operating point on the non-linear part of the LC curve..

But this mechanism cannot AFAICS operate when the antenna circuit is maintained at its resonant frequency..

My problem is that you are one of the cleverest bods here - We can all make mistakes, even stupid ones - But the probability of doing so decreases as competence increases, so I am strongly inclined to trust your observations and analysis.

But I dont understand why what you are doing seems to be working so well..

Fred.

Posted: 12/2/2012 6:12:42 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"I just want to ensure that there is no "fight" between us on this matter..."  - FredM

I fear I'm being too adamant and perhaps coming across as hostile, which isn't my intention at all.  I certainly don't sense any hostility from you Fred!

"But whatever is going on, something is wrong.. My problem can probably be summed up by the fact that I dont see any corrective / linearisation of any kind in your implementation (and you say I dont see it, because its not there!), yet you seem to be getting reasonable linearity -"

I do get a response that is largely predicted by the spreadsheet sim.  And the sim doesn't cut any corners that I'm aware of with the basic circuits (though it does a "best guess" for the phase resonance point if it can't find it clearly), but it doesn't have a super-accurate model of the hand and body of the player (just the one from that paper) which is where I believe the far-field linearity is coming from.  The linearity you see in the video isn't nearly as good if I stand super far away from the antenna.

"Which leaves the size of the inductor/s in the primary resonant circuit - Yours are massive compared to the S/C or any "mode 1" theremin I have ever seen.."

In the video the AFE has 1mH in the tank and 4mH EQ.  Until I got the new Bournes 6310 coils the other day, the AFE had 100mH in tank and 200mH EQ.  Now it has 50mH for both.  Other than a frequency shift of the operating point it behaves largely the same regardless.

"If you had a fixed frequency oscillator driving a large inductance, and were monitoring the phase or amplitude on the antenna (as I do for my volume control and X/Y sensor array) then I could see it"

I know exactly what you're talking about because was doing this for a couple of weeks before I got the DPLL going, just to see what I might expect from it all in terms of linearity and sensitivity in the time domain.

"My problem is that you are one of the cleverest bods here..."

That means a lot coming from you, who has so much hard-won analog Theremin knowledge and who has thought about this stuff much more than I have.  I really appreciate you being so open and helpful with what you know.

Posted: 12/2/2012 8:43:08 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

"I fear I'm being too adamant and perhaps coming across as hostile, which isn't my intention at all.  I certainly don't sense any hostility from you Fred!" - Dewster

Great! - I never ever felt any hostility from you - I was just worried that some of what I said might be seen as picky or negetive. There are few rewards for theremin development - For me, one of the main rewards has been the increase in understanding in areas I knew almost nothing about before I started designing them - This search for complete understanding can infuriate people!

Fred. 

Posted: 12/2/2012 10:05:33 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

I have gone back to the first page and refreshed my memory regarding how you are using the AFE and FPGA (DPLL) together..

Some gaps remain in my full comprehension of the whole process, but I think I might have a better visualization of it..

My understanding - Hope its not to far off..: Your initial "calibration" step determines the resonant frequency of the antenna circuit, and sets this a s reference - The DPLL then tracks the resonant antenna is its resonant frequency changes due to hand capacitance (the phase change on the antenna is the "marker") and accumulates the phase error with reference to the calibration value - this accumulated error (which is added or subtracted depending on whether the phase change is shifting forward or backward with respect to the calibration) is then used to determine the audio output frequency.

looking at this I am wondering.. will the accumulated phase error will be proportional to the LC resonant frequency (as in, linearly determined by the change in capacitance) - or will it in fact be more like the curve one obtains from driving a fixed frequency into a varying BPF (Or peaky LPF)?

It the latter, this could be your linearization mechanism.. It is the fact that the antenna is maintained at resonance which has stumped me - But I have been thinking in terms of a free-running oscillator where this frequency is determined soley from the L and C, and therefore is directly proportional to the changing value of C.. Although your oscillator is doing this, the underlying means of deriving the audio frequency is entirely different - I have been thinking in terms of there being a "virtual reference oscillator" against which the "difference" frequency is computed - And could not see how you are getting good linearity with this..

However - If the accumulated phase error is not effectively equivalent to a value corresponding to the frequency deviation of the AFE from its frequency at calibration, then this may be where linearization is occurring..

MAY and IF.... LOL ;-) If there is "nothing to see" then I am at sea in a rowing boat without a paddle! Because in this case I either accept what I am seeing from your demo as "truth" and throw several years of observations about theremin circuits in the bin and accept that I have been a delusional nut, or I must accept that there is no such thing as a theremin, it is simply malware thrown into my "matrix machine" LOL ;-)

Fred.

Posted: 12/2/2012 10:45:05 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"looking at this I am wondering.. will the accumulated phase error will be proportional to the LC resonant frequency (as in, linearly determined by the change in capacitance) - or will it in fact be more like the curve one obtains from driving a fixed frequency into a varying BPF (Or peaky LPF)?"  - FredM

The former.  When a PLL has accumulated (integrated) phase error in the feedback loop, any phase error is eventually nulled out.  So the accumulated phase error is a direct (and low pass filtered) indication of operating frequency. 

Some analog PLLs accomplish this nulling via the phase detector by pulsing high or low for a length of time proportional to the error (thus adding / removing charge from a cap in the loop).  Others use an XOR gate and explicitly accumulate phase error with an op amp integrator in the feedback loop (you probably already know this).

Some PLLs don't use accumulated phase error - the output will then have a phase error proportional to the difference from the PLL oscillator center frequency.  My DPLL doesn't work that way.

I was thinking maybe the mode 0 linearity was due to the extreme sensitivity I'm aiming for - the tank cap is only 10pF.  But putting 100pF in the spreadsheet sim doesn't qualitatively change things much (other than lowering sensitivity and the operating point frequency).  It's also true that the output audio frequency is proportional to the operating frequency deviation from the calibrated null point, i.e. it doesn't rely on heterodyning for actual pitch, but I'm not sure how that might play into things other than giving the designer a ton more flexibility when picking an operating point.

One could probably implement a simple mode 0 analog Theremin with the AFE lashed to a CD4046.  The XOR phase detector should work fine for detecting quadrature.  The loop filter would probably need an opamp integrator to fully emulate the DPLL, but it might be close enough if a passive loop filter were used due to the very narrow (~3%) tracking range.  I keep meaning to try this, but I keep running out of time every day.

"If there is "nothing to see" then I am at sea in a rowing boat without a paddle!"

Hey, if it can get you away from tuning a front end by intentionally saturating an inductor it's probably worth it!  But for all I know I'm somehow barking up the wrong tree - when I set out to make a Theremin I rashly decided to forgo all the circuitry I'd encountered on the web and start from scratch, and I often feel like a tightrope walker without a net (or a rope!).  Here I am almost a year in and almost nothing real to show for it except for an eternally messy workbench and one buzzy YouTube video (another reason to at least have a junkyard board prototype to trot out to friends and family who are otherwise wondering about my sanity).  Three years now with no job and jabbering to anyone within earshot about Theremins - it's starting to get embarrassing!

It's really nice to meet and swap ideas with others such as yourself who are as (or likely more) obsessed about these infernal gadgets than I am!

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