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

Posted: 8/4/2026 4:24:31 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Max Headroom

Throughout the project, I've been worried about bad DPLL lock, which is possible due to the strong harmonics associated with square wave drive.  One way to reduce the number of bad lock scenarios is to reduce the operating range of the DPLL, but this has consequences that I didn't anticipate.  Touch the antenna and the LC resonant frequency is instantly and dramatically reduced, but it takes finite time for the drive frequency to catch up, and during that slew other resonant frequencies may be stimulated and locked to.  Limiting the upper or lower range doesn't help, and might actually exacerbate things.  Starting the DPLL at the nominal frequency is a good first step though.

Anyway, now that these scenarios have hopefully been laid to rest via the new hardware / software watchdog, I though it was time to take a fresh look at the lock range.  I decided to remove the lower range limit altogether, and after some testing this appears to be both a simplification of the logic and a good move.  The maximum frequency limit being so close to the smaller inductor resonance has bothered me too, someone could attach a very short antenna and be operating even nearer to the limit.  So I added some headroom here.  The granularity of this adjustment is by octaves, and adding another one doesn't seem to change the operation.  So this appears to be a good move as well.  In summary: YAY!

Posted: 8/5/2026 2:18:32 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Encoder Autopsy

Got a wild hare (hair?) to take apart a couple of encoders to see what makes them tick.  Jumping right in:


Above: Inexpensive generic PEC11 encoder bought off eBay, which is full height.  Note the triple contacts, one on each side to contact the continuous inner section of the toothed conductor, two per side to contact the the toothed section.  The contacts appear to be dry.  Note also generous milky grease on the detent spring.  The internal shaft extension is plastic.


Above: Expensive Bourns PEC11H-4115F-S0020 encoder, which is low profile.  It similarly has two contacts for the continuous inner section, but only one per side for the toothed section.  The shaft is metal all the way through, and there is only a bit of grease on the detent spring.  Notably, there is some form of grease on the conduction side too.


Above: Closer views of the generic encoder (left) and Bourns (right).  Note there is much more lube on the detent side of the generic encoder.  Note also the small plastic shaft end insert on the Bourns which actuates the pushbutton dome switch.

So, what to make of the above?  I think the reason the Bourns has such noisy rotary switch contacts is due to the single contact per side on the toothed section.  Dual contacts make continuous conduction more likely.  The noise could also be due to the grease or whatever being on the conduction side, though that may be there intentionally to extend the life?  The Bourns is supposedly a 100,000 cycle unit, but the batch I bought was so noisy that they're pretty much unusable [LINK].  I wonder if putting some DeoxIT on the contacts might fix the Bourns, or make the generic units last longer?

Posted: 8/7/2026 1:52:54 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

LCD Dimmer

Revisiting the LCD backlight dimming circuit.  The old one was pretty simple, just slightly filtered PWM, with the frequency placed at the highest hum filter notch (200Hz / 240Hz).  This caused interference for one kit builder, so more filtering seemed to be in order.


Above: improved LCD backlight dimmer circuit.

The candidate began as a second order low pass filter based on the single transistor Sallen-Key topology - which can be formed by disconnecting C1 from ground and connecting it to the emitter of Q2.  This turned out to be a bit noisier than a simple 2 RC filter, so I went with that.  I added input buffer transistor Q1 so the impedance could be increased, and C1 & C2 were then reduced to conveniently smaller values.  The buffer also raises the turn on voltage to roughly 1.4V, which is close to the center of the PWM signal driving the input, so we use a PWM duty cycle of 50% for off, and 100% for full on.  Very little power is dissipated by Q2 or R6, so these can be non-power types such as 2N3904 and 0805 (I have yet to encounter a modern transistor that is as versatile as the 2N3904).  R4 is to protect Q1 and Q2 when C2 discharges at power off.  R5 is to prevent self oscillation.  I breadboarded the circuit and drove the input via a function generator and it behaved just like the sim.

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