Theremin variable pitch oscillator power supply voltage

Posted: 3/17/2017 6:18:58 AM
Buggins

From: Theremin Motherland

Joined: 3/16/2017

I'm building digital theremin. It's MCU requires 3.3V signals.

Is it ok to use pitch antenna oscillator powered by 3.3V? Any problems with noise expected?

Can I have some benefits from increasing oscillator voltage to 5/9/12 Volts?

My goal is to achieve pitch antenna sensitivity at least 1/100 semitones with hand far from antenna (~80cm).

 

Current design:

I'm using Teensy 3.6 ARM based MCU board with 180Mhz clock, 192K of RAM and 1Mb of flash. It has hardware floating point support (1-2 cycles per floating point addition or multiplication). It's enough for precise digital sound processing. For 44100 Hz output, it may perform 1000-2000 floating point operations to calculate single sample value. There is a sound board, and audio library which allows to implement low latency solution.

MCU is able to measure number of 60Mhz pulses per input signal period. It can provide reference frequencies for using in D-trigger based heterodine. Frequency measure is based on hardware timer, and measurement precision is not affected by delays in interrupt processing.

With signal from heterodine in range 2..10KHz for working hand location range, it should be possible to have about 13 meaningful bits to be used for pitch value. W/o linearization, sensitivity is about 1/100 halftones when measured for 0.5..1ms period (pitch hand position measurement latency 0.5..1ms). But after applying of linearization formula sensitivity for low notes is expected to be reduced a lot (not sure how much). By averaging more values (increased measurement interval), better precision may be achieved, in cost of bigger latency.

BTW, does someone know what is max latency value which still allows to play vibrato? I hope 1ms is good enough. I hate how my Theremini reacts on hand movements.

 

Posted: 3/17/2017 2:55:55 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Hi Buggins!  It sounds like you are dealing with many of the same issues as I am over on the Digital Theremin thread.  So much of it, as you understand, comes down to SNR, so you need as many significant digits of data as possible as cleanly as possible.  

If you aren't averse to using a plate antenna, this is one way to multiply the sensitivity several times right at the source.

And I would highly recommend using a software CIC filter to kill mains hum and low pass filter the data. 

"Is it ok to use pitch antenna oscillator powered by 3.3V? Any problems with noise expected?" - Buggins

3.3V should be OK if you use high Q to get the voltage swing at the antenna high enough (some tens of volts minimum).  The 3.3V oscillator supply should be independently regulated from the digital stuff.

"Can I have some benefits from increasing oscillator voltage to 5/9/12 Volts?"

Possibly.  A higher supply voltage could help you process a larger oscillator swing, and so give you somewhat better internal SNR in that stage if all other things are equal.  IMO this is diminishing returns, so probably not worth it as higher voltages generally aren't present around digital circuitry.

"My goal is to achieve pitch antenna sensitivity at least 1/100 semitones with hand far from antenna (~80cm)."

This is a reasonable goal, and very similar to my own.  If you think about it, it's pretty amazing that physics allows this.  One technique for longer distances would be to track the distance in SW and apply more filtering to longer distances.  I may try this at some point.

"BTW, does someone know what is max latency value which still allows to play vibrato? I hope 1ms is good enough. I hate how my Theremini reacts on hand movements."

There's latency (transport delay) and there's bandwidth (inertial delay), and they are generally related - particularly in a first-order filter.  Though they can be decoupled too - particularly in digital systems that do batch data processing.  Assuming you don't have significant throughput times (transport) you're then talking bandwidth.  I think 100Hz or even a little lower is probably OK, though I haven't experimented with this much.  The Theremini bandwidth is something like 2Hz which is way too low.  I used to have a inertial target of 1kHz (1ms) but I now think that's overkill.  10ms of transport delay should be OK, and 10x this inertial delay (100Hz) should probably be OK too.  Inertial delay isn't as easily perceived IMO.

If you are using the offset heterodyning approach you might be able to use that to do your linearization.  If you set the variable and fixed frequencies correctly you can get a pretty linear response in the exponential domain.  I.e, you can feed the number directly to a linear numeric oscillator.  The downside to this is it makes further processing more mathematically difficult because it is non-linear: varying pitch sensitivity is a power function (and varying pitch offset is multiplication).

"With signal from heterodine in range 2..10KHz for working hand location range, it should be possible to have about 13 meaningful bits to be used for pitch value."

13 real bits should be enough if optimally arranged, but as you say, it all depends on how those 13 bits are arranged in the pitch space.  And the ear can tolerate a fair amount of FM if the bits are dithered by noise in a way that isn't obvious.  When the resolution is low I generally prefer dithered data over hard steps.

I suggest you start designing with real (or accurately simulated) hand / antenna capacitance data, and go from there.  I use spreadsheets to do much of this sort of thing.

Also, you might want to simulate D latch heterodyning to see if it is sufficient for your purposes.  The timing is dictated by the latching oscillator, rather than the digital system clock, so timing resolution isn't the best, and the resulting aliasing noise may be impossible to sufficiently remove via downstream filtering.  Multiplicative heterodyning followed by an LPF can give you much better timing resolution, but has its own problems.  Multiplying square waves via XOR requires at least a 3rd order filter to get rid of ripple, and this filter restricts the operating range because of the amplitude variation it induces.  Multiplying sine waves requires less filtering, but can be difficult to do in hardware.  A high speed A/D (or high speed sample and hold with a slow A/D) with sub-Nyquest sampling is another heterodyning possibility.

Posted: 3/17/2017 5:20:54 PM
Buggins

From: Theremin Motherland

Joined: 3/16/2017

"Hi Buggins!  It sounds like you are dealing with many of the same issues as I am over on the Digital Theremin thread.  So much of it, as you understand, comes down to SNR, so you need as many significant digits of data as possible as cleanly as possible.   If you aren't averse to using a plate antenna, this is one way to multiply the sensitivity several times right at the source. And I would highly recommend using a software CIC filter to kill mains hum and low pass filter the data.

[cut]"

Thank you for your reply.

Building theremin is really exciting hobby :)

I'm using LTSpice to simulate schematics. Tried already about ten different approaches for theremin antenna sensor. Some on breadboard, but half of them - even soldered.

I've realized that inductor with 30 Ohm resistance is bad idea. Each osciller needs separate 3.3V regulator (passive lowpass RC filter for power supply does not help). Current design which uses 2 Ohm inductor seems much better. It has ~3.6V swing of pure sinusoid at point where antenna is connected.

I've tried D-trigger and XOR+lowpass 3rd order filter heterodines. On simulation both gave ideal results. But in real cirquitry they were worse. Results were very noisy.

Tried to make two very similar oscillators for fixed pitch and variable pitch (expecting that both will behave similarly on temperature and other condition changes, and will be compensated by heterodine.

Direct frequency measure using MCU timer did not work (only 10 bits frequency data). Heterodine is needed.

Now I'm under impression that D-trigger heterodine and separate fixed pitch osciller (just pin programmed for PWM with specified frequency) is good design idea.

Last results I had from this schema implemented on a breadboard were promising.

I was see frequency measure results (antenna is connected to oscillator; no movement nearby) sequence like 23451 23452 23451 23451 23311 23452 23452. (Shown values are number of 60MHz ticks per measure interval). Most of measurements had least significant bit change only (gave 0.01% deviation), but one of 5 - 10 measures gave strange jumping values, Not sure what is the source of this. At first sight, wrong measures might be filtered out using some algorighm (not simple averaging - such results are noisy). Will post results here.

 

According to your information, 1ms for pitch tracking is overkill.

 

BTW, I've made a kind of software theremin for Windows with Wacom tablet as an input controller. Using this project to test synth code I'm going to use in hardware theremin. (Or I may add using of my DIY theremin as external controller to this app).

https://github.com/buggins/soundtab/releases

Pen movement horizontally - pitch, pressure - volume, pen movement vertically - may be assigned on some controller.

If you can play Theremin, you can play using Wacom tablet, too ;)

If you don't have Wacom device, you can play with mouse, but it's harder, and no volume control (pitch only mousemin).

 

 

 

 

 

Posted: 3/17/2017 11:30:18 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Building theremin is really exciting hobby :)"  - Buggins

It is!  It requires deep background in many areas to do it justice, and there is quite a learning curve on top of that.  I knew very little about inductors before I started researching Theremins.

"I've realized that inductor with 30 Ohm resistance is bad idea. ... Current design which uses 2 Ohm inductor seems much better."

Inductor resistance will consume energy on each swing, so it should be minimized if possible, though there are diminishing returns. Driver resistance can be worse, and you will ultimately bump up against RF emission loss, which imposes an upper limit on Q. Ferrite core coils can easily have much less wire, and therefore lower resistance than air core coils, but they have magnetization hysteresis losses and temperature drift issues, so I pick a higher frequency operating point and wind my own air core coils.  Air core coils can have less self capacitance, though I believe they are more prone to interference.  But I wonder how much the interference matters when the C it is oscillating with is the antenna intrinsic, which picks up just about everything.

"Each osciller needs separate 3.3V regulator (passive lowpass RC filter for power supply does not help)."

Could your processor somehow provide the reference frequency digitally?  Having two analog oscillators here is problematic.

"It has ~3.6V swing of pure sinusoid at point where antenna is connected."

IMO you need at least 10x this to overcome environmental noise and get a big operating field.  For example, my oscillators have over 200V p-p at the antennas.

"I was see frequency measure results (antenna is connected to oscillator; no movement nearby) sequence like 23451 23452 23451 23451 23311 23452 23452. (Shown values are number of 60MHz ticks per measure interval). Most of measurements had least significant bit change only (gave 0.01% deviation), but one of 5 - 10 measures gave strange jumping values, Not sure what is the source of this. At first sight, wrong measures might be filtered out using some algorighm (not simple averaging - such results are noisy)."

This could be a lot of things.  If the jumps are periodic it could be low frequency aliasing from heterodyning, or some kind of beating with your system clock.  Since your antenna voltage swing is low it could be mains hum or other environmental noise is getting in there and causing trouble.  It could also be noise in one or both of the oscillators.  What oscillator circuit are you using?  I might be able to help you increase the voltage swing.

How are you grounding your oscillators?  Mine are grounded via the USB or scope ground lead, and both go back to the AC ground in my house.

Posted: 3/18/2017 6:15:34 AM
Buggins

From: Theremin Motherland

Joined: 3/16/2017

"Could your processor somehow provide the reference frequency digitally?  Having two analog oscillators here is problematic."

Yes, there are 3 timers, each controls part of PWM pins base frequency. So, generating 2-3 frequencies should not be a problem.

 

"IMO you need at least 10x this to overcome environmental noise and get a big operating field.  For example, my oscillators have over 200V p-p at the antennas."

I will try. Thank you!

Are you using SPICE modelling to check how noise from antenna affects your oscillator?

 

"How are you grounding your oscillators?  Mine are grounded via the USB or scope ground lead, and both go back to the AC ground in my house."

I did not think about this. When I'm using my cheap USB oscilloscope, oscillator's ground is connected to PC ground via oscilloscope ground. But AC connector of PC does not have grounding wire. Same when I'm testing MCU connected with USB.

I'll try to collect fresh results with new oscillator PCB.

 

Posted: 3/18/2017 2:04:14 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Are you using SPICE modelling to check how noise from antenna affects your oscillator?"  - Buggins

Not really, I'm looking at long-term stability with a delayed-trigger oscilloscope, and also looking at the digital data from it with FFT.

Posted: 3/21/2017 5:49:29 AM
Buggins

From: Theremin Motherland

Joined: 3/16/2017

D-trigger heterodine experiment: http://thereminworld.com/Forums/T/31730/d-trigger-as-heterodine-mixer-aliasing

Results: don't use D-trigger as mixer.

 

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