Armstrong, Hartley, Colpitts, Clapp, Wallin...

Posted: 12/24/2020 8:37:27 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

Testing of modified dewster's current sensing BJT difference amplifier (LTSpice model link) soldered on prototyping board.

It's awesome at first sight. (Measurement of stability and main hum level with MCU - TBD)

Results are better than expected according to simulation.
Tried to tune model parameters to match test results. R3 on real device is 680 Ohm. To match measured voltage swing I've set R3 to 330.
With 680 no antenna swings near 400Vpp can be reached.


Transistors used: BC549C, Hfe 630..650, pairs matched for differential cascade and current mirrors.
Output buffer: emitter follower shifts drive signal down by 0.7V to 0..3.3V range.

Powered from 4.5V (regulator on teensy theremin board).
Built in capacitive voltage divider for measuring of antenna voltage swing: 0.5pF (1+1 serial) : 470pF = x940 attenuation.


Testing with two inductors:
4.485mH 133.5 Ohm 0.1mm wire 77mm winding length on 32mm polypropylene frame
2.624mH 66 Ohm 0.125mm wire 66mm winding length on 32mm polypropylene frame

Antenna swing measured via 1:940 divider:



Output signal waveform.
Falling edge is slower because of emitter follower's 680 resistor.
Drive signal from amplifier: 3.68Vpp
Inductor input (drive after R_sense=47 Ohm): 3.36Vpp
Output signal, close to square, 0..3.45V (is it safe for 3.3V non-5V tolerant MCU input?)



Optional 100pF in series looks useless. Tried in hope that touch behavior will be better. Just lowers antenna (and hand) capacitance.
With both inductors, touch test results are similar.
Light touching of uninsulated antenna stops oscillation. But if touch surface increases (e.g. grab antenna with hand) oscillation restores - with smaller swing (30-70V) and 200-300KHz frequency.
Light touching of antenna insulated with paper doesn't stop oscillation, just antenna swing drops. But if touch surface increased, oscillation can be stopped.
After removing of hand oscillation restores instantly.
Interesting: connecting only one side of inductor, w/o antenna on another side gives good oscillation at 2MHz.


Results for 2.624mH inductor:

Hand far from antenna: 937KHz, swing 432mV from divider (397Vpp on antenna)
Hand (finger) 1 cm from antenna: 865KHz, swing 300mV from divider (282Vpp on antenna)


Results for 4.485mH inductor:

Hand far: 730KHz, 450mV swing (423V on antenna)
Hand (finger) 1cm from antenna: 680KHz, 250mV (235V on antenna)


With an air core I can stick a 17" (67cm) jumper wire between the drive resistor and the 6mH air core and it still looks good.  Two jumpers in series and I see ringing on the leading edge of the drive signal.  The RF choke is less well behaved, even just one jumper gives it trouble.  I didn't attempt to control the impedance here, perhaps coax might work better or worse.  So it seems to depend on the mH, SRF, and Q of the coil, and any significant distance between drive and coil might be inviting interference / harmonics (or secondary HF LC).  15-30cm is probably OK for larger L air cores, but this is something you might want to experiment with to really nail down.

-- dewster

Thank you for testing.
So, at first side, placing oscillator on main board and connecting inductor and antenna using wire will probably work.

I'm going to measure main hum level with Teensy MCU as I did for other types of oscillators.
Let's see how it would affect sensor performance, and if there is a difference between simple wire and coaxial.

P.S.: Merry Christmas!!! 

Posted: 12/25/2020 5:07:46 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Results are better than expected according to simulation."  - Buggins

I found that too.

"With 680 no antenna swings near 400Vpp can be reached.

Built in capacitive voltage divider for measuring of antenna voltage swing: 0.5pF (1+1 serial) : 470pF = x940 attenuation."

I don't doubt you're getting pretty high voltages with your setup.  The coil Q is likely a little over 100, and the square drive has a 27% larger amplitude fundamental, so 3.5Vpp in could very well produce over 400V.  That's a pretty high impedance C divider though, and it could be giving you false somewhat high readings.

"Output signal, close to square, 0..3.45V (is it safe for 3.3V non-5V tolerant MCU input?)"

If you current limit it with a series R (which you should do at the source anyway for signal integrity) it may be OK.

"Interesting: connecting only one side of inductor, w/o antenna on another side gives good oscillation at 2MHz."

This is the SRF of the coil (+ any stray C).

"P.S.: Merry Christmas!!!"

Happy Holidays!

Posted: 12/25/2020 5:12:49 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

NPN difference amplifier current sensing sensor testing results report.


Short description: dewster's current sensing oscillator approach looks perfect for digital theremins.

I've tested sensor performance with Teensy 4.1 MCU.

Sensor schematic is updated since my previous post: output cascade resistor replaced with current mirror.


LTSpice model (download link)

Layout made in KiCAD for 2.54mm pitch prototype board:


Tested with two inductors:
4.485mH 133.5 Ohm 0.1mm wire 77mm winding length on 32mm polypropylene frame
2.624mH 66 Ohm 0.125mm wire 66mm winding length on 32mm polypropylene frame
Antenna is 10mm diameter 50cm length chromed copper or brass pipe.
Oscillator output is connected via 100 Ohm resistor and 3-pin ribbon cable (gnd, signal, vcc) to MCU pin.
Voltage swing measured ~ 400Vpp (powered from 4.5V)

Teensy 4.1 is running sketch to collect measured signal period with 1ms step for 15 seconds.
PWM timer counter is captured on both edges, saved to memory using DMA. Averaging filter is used.
After collecting of 15000 samples, program dumps them to serial console, then copy+pasted from terminal to excel.
Hand movement pattern: starting with far distance, move hand close to antenna, then back, then try vibrato on different hand distances.

Spreadsheet with test results can be downloaded here


4.485mH results:

Raw data looks ok, but only close distance movements are visible. Far distance looks like a line.


Linearization using log scale makes movements on far distances visible. But noise appears.


Zoom in 200ms of raw data at far hand distance shows that it's periodic 50Hz signal - main hum.


Applying 20ms moving average filter after log scale conversion:

Applying 20ms moving average filter before log scale conversion:

2.624mH inductor results are similar:




Main hum filter gives good hand distance position, introducing 10ms latency.


Posted: 12/27/2020 5:13:42 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

Found cheap enough opamp suitable for current sensing.
OPA354 is fast, and has rail to rail for inputs and outputs.
Minimal configuration - w/o resistors - open loop / comparator mode - only opamp and one resistor is needed.

According to simulation, there is 300Vpp on antenna when powered from 3.3V, 400Vpp from 4.5V.

Phase alignment is probably not the best, but at least it gives higher antenna swing than bjt.

Posted: 12/28/2020 2:58:35 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Found cheap enough opamp suitable for current sensing.  OPA354 is fast, and has rail to rail for inputs and outputs."  - Buggins

Wow, that looks like a nice op-amp!

So will you be doing filtering before or after log (or whatever for linearity) scaling?  Interesting that the results look so similar.

Posted: 12/28/2020 8:07:42 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017


Wow, that looks like a nice op-amp!
-- dewster

Update on opamp based current sensing oscillator based on LTSpice models.
All of opamps I've tested have significant phase shift from R_sense current. As a result, antenna voltage swing is lower than it could be.
My symmetrical npn+pnp differential amplifier gives very small (15-25ns?) delay between R_sense current and drive, and gives 400Vpp on antenna for 4.5V power.
Even opamps which have 1.45GHz bandwidth according to datasheet have worse results than BJT.
Going to route sensor PCB with npn+pnp differencial amplifier.


So will you be doing filtering before or after log (or whatever for linearity) scaling?  Interesting that the results look so similar.
-- dewster

Good question.

Updated spreadsheet to see difference between two approaches - set the same value for LOG base.
(In previous post, log-then-filter base was chosen based on pre-filtered min value - it causes some NANs when non-filtered value is below min filtered)


Both plots look almost the same, when hand is at working distance.

Filter, then log:

Log, then filter:

Trying to zoom in region with hand and body far from antenna (100..500ms in sample data).

Filter, then log:



Log, then filter:

Min/max values for region:


Code:
filter/log order      min      max    diff 
filter, then log  4.43513  4.48559  0.0504
log, then filter  4.37157  4.44597  0.0744

Filter-then-log looks better (noise has smaller min/max difference).

Not sure if I selected proper base for LOG conversion which should represent infinite hand distance - it's taken as min_value_ever_detected * 0.999999
If 0.9999 instead of 0.99999 is used, diff goes to 4.8493..4.82609=0.02321

Tying to evaluate distance scale

Code:
7.38363 at 1cm
4.80435 at ~100cm
2.57928 : difference between 1 and 100 cm
0.02579 per cm
0.002579 per mm

So, noise seen at 100cm corresponds to random 1cm range hand movements. Seems unplayable.
On closer ranges (not sure what was exact distance) on plot we can see clean enough position detection and visible vibrato.
So, I hope, playable range should be at least 70-80 cm.

Posted: 12/29/2020 3:32:32 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Even opamps which have 1.45GHz bandwidth according to datasheet have worse results than BJT." - Buggins

This is because they need a lot of "selling" features people expect from opamps like sky high gain, low distortion output drive, stability at gain=1, etc. that hurt this particular application.  Any phase delay kills a high Q LC oscillator, so generally the fewer the transistors in the direct feedback path the better.  Like Theremin coils, a custom low-tech solution can often do better than a generic high-tech off-the-shelf solution.

"Filter-then-log looks better (noise has smaller min/max difference)."

That's what I'm doing, and I think that's what makes the most sense.

"So, noise seen at 100cm corresponds to random 1cm range hand movements. Seems unplayable."

You can squash a ton of interference in software.  I made the hum 4th order lpf track with hand location, so that the -3dB cutoff in the farfield is quite a bit lower (with a hard stop at 8Hz minimum, you'll never be able to tell when playing low frequencies) giving a much better SNR out there, to the point where I routinely see numerical quantization steps in the far field on the tuner (bandwidth reduction is extremely powerful if handled right).  From what I've seen on the scope, the ECL-LC oscillator is likely stable enough to give you that sort of performance too if you post process it enough and control any systematic noise sources.

Posted: 12/30/2020 8:31:10 AM
Buggins

From: Porto, Portugal

Joined: 3/16/2017

One way to keep oscillating with highest possible antenna swing is to use fast amplifier.
Another - use PLL approach.

Cheap opamp or comparator with significant delay may be used.
Two identical opamps/comparators needed: one for current sensing, second - just to get excitation signal back with the same delay we have for current sensing.
PLL should keep phases of current sensing and drive close.
Some 4046 PLLs look suitable. I found 74hc4046 spice model, will try to implement oscillator in LTSpice.

UPD: hard to get PLL working. High Q LC has bad current waveform when drive is far from resonance.

Posted: 12/30/2020 4:55:08 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"UPD: hard to get PLL working. High Q LC has bad current waveform when drive is far from resonance."  - Buggins

One thing I stumbled upon was the very desirable drive waveform you get from an NPN / PNP L driver: [LINK].  AFE schematic.

Guaranteed to lock even if it starts out way below resonance.  You should still limit the low range of the VCO though.  And the 4046 VCO is RC-based, so it may have a fair amount of phase noise.  I would use the XOR phase detector and a C divider.  A couple of CMOS inverters would center and square it up.

Posted: 12/30/2020 8:53:27 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017


One thing I stumbled upon was the very desirable drive waveform you get from an NPN / PNP L driver
-- dewster

It's suitable only for drive signal range 0.7..VCC-0.7V. W/o load it's output looks like rail-to-rail, but under load it's getting limited by 0.7V offset.


Guaranteed to lock even if it starts out way below resonance.  You should still limit the low range of the VCO though.  And the 4046 VCO is RC-based, so it may have a fair amount of phase noise.  I would use the XOR phase detector and a C divider.  A couple of CMOS inverters would center and square it up.
-- dewster

With limited VCO frequency range (tuned to be close to LC frequency), current sensing is good enough to lock the phase.
Frequency range of VCO is natively limited. If phase detector behaves well, VCO will work at min or max frequency if LC resonant frequency is below or above limit.

Likely, phase noise could be considered as dither, and filtered out.

RC oscillator itself is probably not a big issue because it's controlled by LC.

There are some other PLL/VCO ICs. MC1648 is LC VCO. TLC2932 is nice, but requires external divider due to higher vco freq.


LTSpice model of current sensing oscillator with PLL.


74hc4046 as PLL

opa354 as comparators and buffer

To use 74HC4046 you need to download 74HC4046.lib and 74HC4046TI.asy and put to the same directory as model.

PLL is tuned to cover 629..734KHz range for 0..5V control voltage range (resonance for antenna C 10pF is near 700KHz)

PLL locks phase for working range of C_hand (0..2pF). For higher C_hand, it stops at min frequency 269KHz (0V VCO CV).

Phase is locked near 0, using phase comparator 2.

VCO frequency varies near LC resonance with big enough spread.

Antenna swing shows that drive signal is closer to resonance than I've expected.


The same 400Vpp can be obtained by driving of tank with output of current sensing comparator (same VCC, 5V).

I expected that phase detector will vary VCO frequency close to LC frequency behaving as a kind of dither and averaging / high frequency noise filter.

But control voltage swing around resonance looks too big for me.
Going to experiment with custom phase detector.

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