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

Posted: 12/29/2012 11:23:27 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 think it would be nice to have the choice of output signal's waveform. Possibly Look-up table method can be used for synthesis. But how is it possible to create a sample which will imitate the sound of for example some particular teremin?" - Snail

What level are you teaching? Is this an engineering course? What specifically do you want your students to gain from this project? .. It is important, I think, for us to have some idea about what you want to teach, and what your aims are.. If you want to teach usage of FPGA's then your approach is likely to be different to if you want to teach interfacing or capacitive sensing or logic or whatever..

It just seems to me from what I read you writing, that unless you are teaching a really low level (almost pre-college) you are already way out of your depth - someone intending to teach even basic FPGA / digital electronics should not be asking " But how is it possible to create a sample which will imitate the sound of for example some particular teremin" - You should have enough understanding to at least know where to look for the answers to basic stuff like this.

Please, dont get me wrong - I am not trying to be rude.. But teaching electronics is a big responsibility - You need to be competent and motivated, and if (as seems obviously the case) you are completely out of your depth, either spend the hours required to bring youself up to a reasonable standard - Or teach your students about some area where you are really competent.

And we need to know your real objectives in order to be able to help you best.

Fred.

Posted: 12/30/2012 9:49:35 AM
snazzy_snail

From: Minsk, Belarus

Joined: 6/21/2012

Hi Fred!

Thanks for Your opinion, but I see no reason accusing me of teaching someone. I'm really not at that level - I agree with You completely here.

Maybe I expressed my thoughts not very clear. Somewhere in this topic dewster mentioned, that he would like to have sound output different from a rectangular wave - that the reason I asked. 

Posted: 12/30/2012 4:22:41 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

Hi Snazzy_Snail,

Went back over your posts, and I am really sorry - I made a big mistake!  When you said "My students project" I must have assumed you were talking about "your students" - as in, you were a lecturer / teacher ! Oops! ;-)

Ok - You are a student not a lecturer ! - This changes my perspective a bit, LOL ;-)

For a student, you are doing ok! ...... I have a lot of time for students - but lazy / incompetent teachers reall p*ss me off! - I had several of those (mostly maths teachers) and I had electronics / radio teachers who didnt know how to use a 'scope - As a hobbyist I was showing the teacher (and class) how to use basic test equipment.. I thought you were one of those type of "teachers"..

Sorry!

Fred.

Posted: 12/31/2012 8:50:33 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

Snazzy Snail.. My advice -

Somehow (beg, buy, borrow or steal) get a copy of "Musical applications of micro-processors" by Hal Chamberlin.

There are no theremin circuits in it, but there is an absolute wealth of analogue and digital circuits, brilliant explanations, formulae, software routines etc.. This book has been my bible for years, particularly in the early days - I bought the first edition in 1983.

Electronics has moved on a bit - but the basics are still all valid.. Ok, theres no talk about FPGA's, and 16 bit MCU's were "new" - the 6800 and 6502 were "high end" - but everything in the book is easier to understand because of this - IMO. - Read it, and you will know how to create wave tables!

Fred.

Some 2nd hand available : http://www.alibris.co.uk/booksearch?qwork=4522292

Posted: 12/31/2012 2:29:32 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"What concerns oscillators, first of all I would like to test the AFE schematics You posted on the page 2. But right now I'm busy exploring some theoretical issues."  - snazzy_snail

That's changed somewhat since it was originally posted.  It now uses a 74LVU04 hex inverter, a LP2950-33LPRE3 3.3V LDO voltage regulator, and 6310 Bournes 50mH inductors.  I also eliminated the in-phase feedback because the inverter is so much faster, and only use one inverter to drive the tank due to the increased drive strength and the lower drive requirements. 

I'm thinking of moving to 10mH inductors, and maybe trying some transformer action similar to what Fred is currently experimenting with.  Low frequencies seem to be more problematic in terms of environmental interference (not sure of that) and large coils are a bear to shop for.  Low frequencies tend to translate into much lower drive current, something to think about if you are designing battery powered Theremins (not likely once an FPGA is in there though).

(I swear, 95% of Theremin design is finding / building / buying / modifying the right coils.  With caps they tell you up-front what tempco the dielectric has, the tolerance, etc.  With coils they generally don't tell you the tempco of the ferrite formulation, what the heck the ferrite formulation even is, whether it's gapped, how many turns, transformer winding inductance, tolerance, etc. so you're often feeling your way in the dark.  I suggest you get a bunch of coils and test them in an AFE or similar.  My earliest AFE used coils from an old RS graphic equalizer - only a few the coils from the equalizer would actually work, I believe those that didn't had too low a self-resonant frequency.  An LC meter that can read small capacitances and inductances wouldn't hurt if you're thinking of doing this kind of work seriously / long-term.  A self-resonance coil tester like Fred described elsewhere could be handy as well.)

"From theremin simulation spreadsheet I figured out that currents in the AFE circuit are relatively low, so circuit's NAND gates may be replaced by FPGA logic. What are the drawbacks of doing so?"

The main drawback would be powering the essentially analog circuitry in the AFE with the noisy digital supply.  I intend to try this at some point, but during development I want to keep confounding influences to a minimum.

"I think it would be nice to have the choice of output signal's waveform. Possibly Look-up table method can be used for synthesis. But how is it possible to create a sample which will imitate the sound of for example some particular teremin?"

Fred gave you very good advice above, the Chamberlin book is a gold mine of info when it comes to synthesis.  One of the important things I learned from it is that aliasing can easily happen when doing D/A conversion (or any sample rate down conversion) - you often have to low pass filter any arbitrary waveforms you generate in digital logic before they can be faithfully represented downstream in the sampled analog domain.  Modulator based D/A can ease this somewhat.  The filtering and synthesis sections are great as well.  He covers VOSIM but if you play around with it at all you'll realize it's probably more straightforward (and more flexible) to make high Q low pass or band pass filters in order to do vocal synthesis.

You could use multiple wavetables and morph between them based on various input parameters, you could distort a basic wave based on amplitude, you could take a rich harmonic base and filter out the stuff you don't want with a fixed/moving filter, etc.  Right now my prototype takes the ramp wave from an NCO accumulator and uses very simple logic to turn this into a triangle wave, which is then output via a 2nd order delta sigma modulator.  The tone is a lot easier to listen to than a square wave, but the modulator creates a lot of RF splatter which influences the pitch side.  I'll probably switch to a proper DAC soon.

Posted: 1/11/2013 8:42:03 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Let me emphasize something I perhaps haven't before: For the series tank, the EQ coil scales with the tank coil to give similar linearity!  But obviously at a different operating point.  The AFE gives similar sensitivity and linearity whether using 1mH coils for both tank and EQ, or 100mH for both tank and EQ.  This holds true in both in simulation and in reality.  (Also, the largest the EQ coil can be made is ~5x the tank coil before the tank phase fails to cross -90 degrees and the PLL fails to properly lock.)

So I'm still wrestling with coils.  Hacked on my spreadsheet sim to use a transformer rather than a single coil as the tank, but I don't think my analysis for the series tank is correct so I'm not releasing it yet.  Everything is in VBA now, which makes it easier to read and maintain, but it really slows the calculations down.  I'm spending more time in LTspice, which is a very nice program.  (I'm not sure why Bob Pease has such an aversion to analog simulation.)

The absolute limit to Theremin sensitivity is governed by antenna geometry and stray capacitance, and for the more or less standard EWS rod I believe this is around 5%F/pF.  I don't think any LC based design can do better than that regardless of whether a transformer or EQ coil is used or not, though a transformer can match a lower impedance tank to a higher impedance world, allowing one to get closer to the theoretical sensitivity limit, and allow other options that aren't otherwise available without it.

Found an interesting coil calculator this morning:

http://www.coe.ufrj.br/~acmq/programs/

The program is "Inca" and the two papers associated with it are interesting as well.  The program calculates air core single layer coils and transformers.  It give the coupling coefficient k, and also calculates winding capacitance.  The windings have to have similar geometry to have the best coupling, which can be >0.9, better than I thought possible for an air core.  Use the program for a half hour or so and the reasons for the geometry of most Theremin coils becomes very clear.

From my series tank simulations I've found that a 1:10 turns autotransformer tank inductor (1:100 L ratio, this is also what Smirnov uses for his D-sensor) would allow the use of a larger tank capacitor.  This seems to be a high impedance point in my AFE, so a larger cap could increase SNR.  0.1mH primary, 10mH secondary, 10mH EQ coil gives ~310kHz operating point.  I wonder if a 0.1mH winding could be easily added to a Bournes 6306 10mH choke and still have good coupling.  Good coupling is necessary for the tank phase to follow the EQ | hand capacitance phase and voltage peak.

The use of a series tank transformer also seems to make the tank coil current fairly constant regardless of operating point.  Otherwise tank current scales roughly linearly with operating point frequency.  High tank current is something that drove me to the lower frequencies, as I was worried about drift associated with heating.

Posted: 1/12/2013 1:00:14 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 don't think any LC based design can do better than that regardless of whether a transformer or EQ coil is used or not" - Dewster

Some ideas which may / may not be relevant to what you are doing.. I have only used these in mormal (mode 1 or no EQ inductance) theremins..

You can improve sensitivity and linearity "to taste" if you actively control the inductance - the active control signal being a function of whatever you want..

Factors to correct linearity would be the frequency (or perhaps phase in the case of a fixed frequency system), sensitivity can be controlled by amplification of the derived frequency variation.. Also, one can have a temperature sensor (simple BJT) or several and derive a correction voltage.

Actively changing the inductance can be done by several means - The simplest being controlling a DC bias current through it.. If one has temperature compensation (a BJT glued to the ferrite for example) then any heating errors can be corrected.. But actually the variation of inductance as a function of DC current is quite huge with some ferrites, and only small currents are required..

With "Mode 1" I am finding that the whole antenna equalization system can be omitted, the oscillator designed to operate directly on antenna capacitance change (as in, the actual means of frequency change is directly down to antenna capacitance change, not down to the virtual inductance change as one gets with a equalized system) and that by having a small filter producing a CV as a function of oscillator frequency, and using this CV to alter the oscillator frequency, I can achieve equalization (and more).

Just wondering if you could do something similar with "mode 0"

The main disadvantage is lower antenna voltage (and the fact that the Lev oscillator only works with an equalizing front-end ): ... I really wanted to use the Lev oscillator, but its entirely the wrong topology and doesnt work with my favorite trick! ... I can add this trick to improve the Lev sensitivity and linearity - but not if I get rid of the EQ coils!

At the moment I am undecided - Lev oscillator with EQ coils and special custom inductors (expensive) and ITF,  or a new armstrong based design with no EQ coils, and a couple of simple cheap 42IF106 IFT, which seems to give as good performance but has lower antenna voltage.. I probably need to implement both - design a PCB which can cater for both builds..

"LTspice, which is a very nice program.  (I'm not sure why Bob Pease has such an aversion to analog simulation.)"

I dont really understand it either! (his "Small signal Audio Design" book is one of my bibles!).. It may be that he just doesnt enjoy simulation.. Acurate Analogue simulation is a real grind for the first year or so (although LT-Spice is a lot easier - I started with simulators where one spent more time debugging the simulator and models than debugging the circuit, and one was never sure if any problem was "real" - circuits which worked in simulation failed in reality, and visa-versa...)

Until I bought an expensive (>£2k) simulator, simulation was often not worth the effort.. Now, however, one can get LT-Spice free, get good models (for most components) and actually "build" circuits which behave like real-world circuits most of the time.. The LT simulation engine and UI is as good as that in my £2k simulator and sometimes better for analogue (and now that I rarely use MCU's to co-process with analogue circuits, the main benefits of this simulator are lost - LT-Spice is just as good, or better)

But I can understand that engineers were put off simulation in the early days - And even today, one really needs to understand the parameters to "tweek" for optimum results.. Tune the simulator too critically and simulations take forever to run, and often fail to complete.. Tune it too sloppily, and the simulation is fast, but the results are unreliable.

Fred.

Posted: 1/12/2013 4:43:17 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Wow Fred, it sounds like you're making some interesting inroads! 

Sorry, I'm not being very clear by using the inexact term "sensitivity" - by it I mean absolute tank resonance frequency change in terms of external capacitance change.  As we know, the antenna has some fixed capacitance (say 8pF) to which the player adds extra capacitance (say 1pF) - this delta lowers the operating frequency by some amount.  Because frequency is proportional to the inverse of the square root of capacitance in an LC oscillator, adding the player's 1pF to the antenna's 8pF will change the frequency:

1 / sqrt[(1+8)/8] = 0.9428 or -5.7%

The tank oscillator can at most change this much due to the added 1pF.  The addition of an EQ coil can make the tank frequency change close to this, and using a transformer for the tank can also help, but I don't believe the tank can change more than 5.7% due to the addition of 1pF if the antenna capacitance is 8pF (though I could be wrong - the parallel tank has much more complex behavior than the series tank - I should say that haven't seen changes larger than the theoretical limit in the small amount of parallel tank simulation I've done).

"Just wondering if you could do something similar with "mode 0""  - FredM

I can eliminate the EQ coil, but this gives lower absolute sensitivity.  (It may be possible to use a poorly coupled secondary as both tank and EQ, but LTspice isn't showing this.  Perhaps its transformer model is too simplistic?  The uncoupled k I believe should act like a separate inductor in series with the secondary.  So a 40mH secondary with k=0.5 should act like 10mH & k=1 with 10mH in series?  I suppose it's a distributed thing though, so the uncoupled inductance isn't located 100% on the antenna side like it is in the discrete EQ coil case.  Perhaps this is why the primary is located at the bottom end of a Tesla coil, so that the top is uncoupled and acting more like a separate inductor in series with the antenna.  Hmm.)

Analog Theremins probably don't care so much about achieving absolute sensitivity because moving the operating point higher | lower will give a larger | smaller difference frequency range after heterodyning.  Digital Theremins need all the sensitivity they can get.  I'm thinking of using a shorter antenna to lower the bulk antenna capacitance, though this will likely make it more sensitive to vertical movement when playing (good for vibrato technique?).

"The main disadvantage is lower antenna voltage"

A series tank can give you gobs of voltage with as little as 1V in.  Just sayin'. ;-)

This morning I did surgery on one of the Bournes 6310 50mH inductors that arrived DOA due to poor Mouser packaging (10 tossed into a plastic bag & rock tumbled all the way to my house).  Removing two of the three windings gives 7.44 mH and room to hand wind a primary.

Also, ran across this paper yesterday that looks at interwinding capacitance:

http://www.researchgate.net/publication/5900008_Analytical_calculation_of_the_self-resonant_frequency_of_biomedical_telemetry_coils

The upshot is some small spacing between layers gives the lowest capacitance.  The Inca program shows pretty low capacitance for single layer coils.  Hmm.

Posted: 1/13/2013 12:11:04 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

"A series tank can give you gobs of voltage with as little as 1V in.  Just sayin'. ;-)" - Dewster

Thank you! ;-) LOL..

Aint it strange the way one can get stuck in a particular mode of thinking, and miss the obvious! .. I have been messing with trying to configure a parallel resonant Armstrong oscillator, using a couple of 42IF106 transformers and routing the drive through both "tickler" windings and strapping the capacitance across the large combined primary windings to step the voltage up.. When all I needed was to switch the primary configuration to series resonant..

Duh!

Fred.

Posted: 1/13/2013 2:01:51 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Glad to be of minor help to you Fred, after all hard won info you've so generously shared with us!

A series / parallel tank recap (allow me to drone on and on):

Series tanks need low impedance, low voltage drive to achieve high Q and high antenna voltage.  The series drive resistor sets the coil current and antenna voltage.  There is no need to tune the EQ circuit to any particular frequency, a broad range of EQ coil values should work fine (~1x to 5x the tank inductor).  The oscillator cannot stall because the 90 degree phase difference between drive and sense allows the use of infinite gain (this also ensures a very consistent output voltage).

Parallel tanks need high impedance high voltage drive to achieve high Q and high antenna voltage (hence the open collector drive and +/-12V supplies in the EWS) and the EQ resonance strongly interacts with the tank resonance in very complex ways.  The oscillator can possibly stall because the 0 degree phase difference between drive and sense requires the careful application of "just enough" gain to overcome losses.

Series tanks are so much simpler than parallel tanks, and have none of the downsides IMO.  The only downside I can think of is phase detection, which one can simplify by introducing a 90 degree RC phase delay via the addition of a capacitor to ground after the series drive resistor.  The tank gives an additional 90 degrees at resonance, and inverting drive gives the remaining 180 degrees.  The RC also lowpass filters the square wave drive.  This is how the Smirnov D-sensor works.   Smirnov also uses a transformer for the tank coil, which allows for the use of a larger tank capacitor and gives lower drive current at higher operating frequencies.  He's got a lot going on in there (though I would add an EQ coil, or loosely couple the primary to one end of the tank transformer ala Tesla coils).

I know others have brought this up, but there are many parallels between Tesla coils and Theremins, many more than I initially thought!

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