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

Posted: 2/9/2022 12:46:16 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"I believe this would not work."  - Buggins

It should, but it will only work if one encoder is active at a time.  I don't ever really turn or press more than one at once, so the others are open circuit.  In the rest state all switches on all encoders are open (as long as they have physical detents).

The transistor BE junction is a diode, so each encoder switch group can pull the common CW, CCW, PB lines down to 0.7V when active.  If more than one switch in the active encoder is closed, like CW and CCW during rotation, the transistor is just further saturated in the on state. 

I don't think it's a good idea to put switches that are noisy, phase sensitive, and rapidly opening and closing in an active diode matrix.  Doing so would preclude the use of analog filtering, and the scan switching would have to be pretty fast so a possible compliance radiator.

And if I'm going to use an external shift register, I might as well keep the logic in the FPGA if I've got the pins.  With all of the scarcity and supply chain delays of years, I've come to loathe bits and pieces logic (though passives and transistors are OK).  One key part goes missing and you're dead in the water.  I had to buy my EEPROMs and LED drivers direct from Micron and TI, Mouser was totally out with an ETA of a year or more.  I bought more than I needed, and I suspect everyone is doing this, creating a run on them.  It's a crazy time to be building anything.

Posted: 2/9/2022 3:46:50 PM
Buggins

From: Porto, Portugal

Joined: 3/16/2017


In the rest state all switches on all encoders are open (as long as they have physical detents).

Are you sure both phase switches are off when encoder is not touched?
It can be just checked on real encoder.

Posted: 2/9/2022 4:00:45 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Are you sure both phase switches are off when encoder is not touched?  It can be just checked on real encoder."  - Buggins

I've tested gobs of them, if there is a physical detent then all switches are definitely off in the resting state (on the left and right sides of this scope pic):

With no physical detent all bets are off.  I don't like the detent-less ones though, too sloppy feeling in response, the detent (in a non-Bourns, non-worn out encoder) enables you to click things up or down a bit without having to look at the display.  Tactile feedback is underrated.

Posted: 2/9/2022 11:05:58 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Encoder Analog Filtering

The suggested contact noise filter for encoders is actually pretty ideal:


The contacts are normally open, when they close the capacitor C discharges through R2.  When the contacts open up again, C charges through R1 + R2.  So R2 is doing double duty here:

1) it protects the switch contacts from a high current discharge of C, and
2) it makes the output rise time slower than the fall time, so the filter is actually bi-modal. 

This is a good thing because the switch closure is a real and low impedance event, so you want to bias the filter to react to it quickly.  A high impedance is due either to the switch being genuinely open, or to contact noise during nominal closure, so the filter shouldn't react to it as quickly. 

What values of R1, R2, and C should we use?  Let's take a look at a fast spin of a clean encoder:

The grid here is 1ms per division, so a detent cycle takes roughly 4ms, let's say 2ms worst case.  I would set the rise time to somewhere around 1/10 this, or 0.2ms.  Picking a convenient C of 0.01uF, 0.01e-6/0.2ms = 20k.  We could split this many ways across R1 & R2, the datasheet makes them the same, or 10k ohms.  I might be inclined to offset them more towards faster discharge, and make R2 somewhat lower Ohms than R1.

My FPGA code accomplishes the above, but in the digital domain, and the charge / discharge ramp is linear rather than exponential.  The very latest load, in an attempt to help the noisy Bourns encoders limp along a bit longer, biases pulling to ground three times stronger than pull-up.  It also implements 1/3 & 2/3 hysteresis switching points, which helps to further resolve changes and clobber contact noise. 

The result is fed to a gray code state machine, which only registers a +/- detent with a return to the rest state if a proper succession of levels is seen.  The state machine tolerates noise throughout the cycle, which I think is an important feature.

Posted: 2/12/2022 9:29:14 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

dewster The Cable Guy

While waiting on the LEDs (Amazon order was sent to VA for some reason) and JLCPCB for another round of Claraboxes, I'm getting a jump on the 3D printing and cabling.  Both are a rather significant investment of time, what's shown below took me two days to do.

Above: 14 power / ground clip cables, 28 AFE banana clip cables, 28 encoder IDC cables, 14 tuner IDC cables, 28 AFE IDC cables.

I'm making most of the cables a little longer for this batch to give more flexibility to the builders.  Could only score 13 FPGA boards so that's the hard limit, otherwise I'd probably aim for 20 kits.  Totally slave driving my Ender 3!  And me!

Posted: 2/15/2022 2:13:32 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

More Tenor

Guillaume Subra inspired me to take a stab at this one:

https://d-lev.com/audio/2022-02-14_i_will_wait_for_you.mp3

Amazing how many old tunes one has rattling around in one's head.

Posted: 2/20/2022 7:59:32 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Theremin 30 Podcast

I had the pleasure of being interviewed by Rick Reid a couple of weeks ago, and it went live today: https://www.theremin30.com/

Rick did an amazing job of piecing my mumblings together into something that actually sounds coherent, and I really like the way he layered in the sound clips. 

Thank you Rick for all the time and effort that must have taken you!

Posted: 2/22/2022 2:22:45 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Coil Winders Local 151

Literally winding up for the next batch of kits.

Above: A box of hand wound coils on 1-1/2" PVC kitchen plumbing forms.
- Qty 15 / 110mm / 32AWG / 2mH / 25 Ohm (left)
- Qty 15 / 100mm / 30AWG / 1mH / 10 Ohm (right)

Above: A spankin' new set of PWBs from JLCPCB - note the spiffy rounded corners!  The encoder board should now be a little more cable friendly with the staggered 0.1" hole pattern.  These were updated in the latest version of KiCAD, which is really, really nice!  JLCPCB always does a really good job too, and I got a few extra boards so I guess they make spares just in case.

Above: Scored this desoldering tool off Amazon for pretty cheap.  It double triggers a bit, but works quite well if you tin the tip and flux the board.  It's got a solenoid plunger inside, so it's like an automatic self heating Soltapult on steroids!  I found an old populated digital thermostat PCB and desoldered a relay, trimmer pot, slide switch, jumper pin header, and a memory backup capacitor in no time flat - no muss, no fuss.

Posted: 2/26/2022 2:14:37 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

From this thread (don't want to clutter it up with my blathering): http://www.thereminworld.com/Forums/T/33693/open-theremin-v3-loses-calibration?post=222134#222134

"That said, my enclosure is probably not optimal and my music room is not climate stable at all."  - Mr_Dham

I believe I've seen atmospheric temperature drift when the heater comes on in the winter time and the D-Lev itself hasn't had time to significantly heat up, which I chalk it up dielectric changes in the air.

Found one paper "THE EFFECT OF HUMIDITY ON THE CALIBRATION OF PRECISION AIR CAPACITORS" by L. H. FORD which says the change in capacitance over 30% to 65% relative humidity can be 3 parts per 10,000 at room temperature.  This is 300ppm, or 300Hz change for a 1MHz oscillator.  If I had to hazard a guess, I'd say that's in the ballpark of the drift I see with the D-Lev in the winter.

"Auto CALibration (ACAL) being instantaneous, I can perform it at no cost."

That's the beauty of separating the various field settings from calibration itself.  Sure, there are more confusing knobs to deal with, but calibration is then a quick nothing one can do at any point.  I feel that Moog tries to do way too much with the calibration procedures on the Theremini and Cvox, which turns them into laborious, time consuming, and rather opaque exercises.  They don't even have dedicated buttons and stuff to initiate and guide it, further complicating things.

Posted: 2/27/2022 4:58:17 PM
Mr_Dham

From: Occitanie

Joined: 3/4/2012


Yes, if winter were colder here, I think it would be even more critical than summer.
Here, winter is rather dry while summer is a long increase in relative humidity that ends with rains in September.
(Added to this, the activation of the air conditioning makes it very variable... ). So your analysis probably applies to summer here.


Thermal science is a real puzzle... That's why, in addition to the 20 minute warm up, I always go to ACAL first (on any theremin) when I start playing.
(I even considered removing storage in EEPROM of calibration parameters on my Open Theremin because of this personnal approach)
Having a button for this is essential. Having it done instantaneously is very nice. I understand that this is not always possible, heterodyne theremins need a convergent algorithm.

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