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

Posted: 11/9/2022 5:12:18 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"C sensor is not necessary AM. Integrating cirquit on opamp may be phase or frequency modulated."  - Buggins

I'm not sure I follow?  IIRC they're demodulating a direct sequence via analog switches and measuring the resulting voltage.

"I've tried to simulate gyrator + current sensing oscillator but it does not work."

Here's what I was playing with:  https://www.mediafire.com/file/wh2d5b64hchmqxd/gyrator_LC_osc_2014-04-22.asc/file

"Is it possible to get some benefits from current sensing with gyrator?"

I think it's a dead-end.  IIRC the sim is touchy, and FredM said he and Art Harrison had been down that fruitless road before.  Funny that Fred mentions the 555 and that being a dead end too, I've seen long distance human body C detectors that use it, though they had to filter the ever loving crap out of them to get any useful data.

Posted: 11/9/2022 9:19:11 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

LINEARIZATION: LC Frequency = LC Period = RC Period

Spreadsheeting Wednesday: https://www.mediafire.com/file/pp9tbxdxbwrgw07/theremin_linearization_2022-11-09.ods/file

Turns out it doesn't really matter if you use LC or RC oscillators, or whether you measure the frequency or period, post mathematical heterodyning all look virtually identical when linearized via a fractional power (~0.25).  Here is RC period linearized:

That was something I wasn't expecting.  Good news though!

Posted: 11/10/2022 5:10:14 AM
ekahn

Joined: 11/2/2022

It would appear that Waveshare has the original board in stock, albeit priced at $110. Haven't attempted a checkout though.

(also, first post!)

Posted: 11/10/2022 10:23:51 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Ah, excellent catch ekahn, thanks! 

And wow (not to look a gift horse in the mouth but) I wonder why the price is so high?  Even their USB Blaster (Altera programmer knock-off) is like $30, you can buy those all day long for $10 or less on eBay, including shipping.

Posted: 11/10/2022 10:45:48 AM
Buggins

From: Porto, Portugal

Joined: 3/16/2017


Turns out it doesn't really matter if you use LC or RC oscillators, or whether you measure the frequency or period, post mathematical heterodyning all look virtually identical when linearized via a fractional power (~0.25).  Here is RC period linearized:

Identical linearization behavior for frequency and period does not surprise me, as I explained in previous post.
But no difference between LC and RC is not expected - f(C) vs f(sqrt(C))
But actually any smooth function on short range is almost linear.


EDIT

Here's what I was playing with:  https://www.mediafire.com/file/wh2d5b64hchmqxd/gyrator_LC_osc_2014-04-22.asc/file

Played a bit with this model.
Changed it to current sensing (opamp + Rsense=220 Ohm), it's working, too.
But for current sensing it's harder to achieve pure sine - gives more harmonics.
Advantage of gyrator (vs usual RC) is close to pure sine voltage on antenna (vs triangle in the best case for RC), and it's probably less sensitive to noise.
Of course, it's x2 times less sensitive to C3 change than RC. (Actually, 2.71 times on my simulation).

I think we can use shielded antenna instead of C3 (top electrode is a shield - since it's driven by opamp via small enough R5) and bottom electrode is front (grid/pattern) of antenna.
R5 may be reduced down to 220 Ohm for better drive of "shielding".

Posted: 11/11/2022 12:53:44 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Changed it to current sensing (opamp + Rsense=220 Ohm), it's working, too."  - Buggins

Which resistor is Rsense?

Also, this is what I think of as C shielding:

The top shows a 1:1 buffer driving the rear shield plate via the front antenna plate.  The bottom shows that you may be able to do this all on the oscillator end and "zero out" the connecting coaxial cable capacitance along with the rear plate capacitance, which would allow for the oscillators to be more centrally located with the controller.

Posted: 11/11/2022 3:31:27 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Gyrations

Interesting article showing the derivation of a Sallen-Key HPF via LCR and gyrator: https://circuitcellar.com/archive-article/analog-filter-essentials/

===========

Sensitivity / Stability

I think this is what Digital Theremin oscillator quality or usefulness comes down to.  We usually can't do much about fundamental sensitivity, RC is pretty much the theoretical wall here, but it suffers from low Q and threshold noise.  We can experiment with minimizing any C padding in the oscillator, and we can perhaps "disappear" half of the intrinsic via active shielding (as shown in the post above).

The problem with minimizing C is that oscillators often become less stable without some minimum C somewhere.  And the spectral characteristics of the instability can be a huge factor - oscillators with low frequency jitter or random tearing / jumping are particularly problematic because that sort of noise falls below the gestural bandwidth filtering, so nothing can be done about it.

And resolution is a factor when doing this stuff digitally, because the changes in hand / antenna C are so small in the far field.  So if adding some C will optimize the Sensitivity / Stability ratio, resolution may put a practical limit on the result (though heterodyning can massively boost resolution).

Posted: 11/18/2022 4:05:40 PM
ekahn

Joined: 11/2/2022

Was excited to chat with Eric yesterday and dive a little bit into D-Lev hacking, I have a thousand micro-projects I'm excited to try with it once i can build a kit.

A couple notes I may or may have not mentioned on the call, and hope they may be useful to others - hi Eric, again, it was a pleasure!

* I am hoping to design at least one plate antenna out of a PCB, possibly mounted on the AFE assembly with these nifty solder-down hinges! If that's feasible, perhaps we can come up with some happy medium between plates, grids and loops (certainly with clever solder masking, one could design a board that looks like one and plays like the other).
* For rapid PCB experiments, Advanced Circuits has a one-day turn program if you can tolerate two layers and zero soldermask, and it's one of the only domestic services that can compete with Chinese pricing. (Some structural PCB components may even beat 3D printed ones on both price and geometric / electrical consistency - for instance, I'm sure one could design a "slot together and solder" Faraday enclosure for the coils using six identical 1-layer boards.)
* For more manufacturable 'high-end' enclosure components, I have also been itching to try PCBWay's CNC services, as their quality of product has already upended the value game in the PCB space.
* Aliexpress sells coil winding machines with varying levels of automation at every conceivable price point between $100 and $2000.
* I realize this discards a decent amount of work, but modern chainable / addressable LEDs are cheap, never go out of stock, and come in every form factor you can imagine - they are integral to practically every gamer-marketed RGB-vomit product on the market today. The two main options are derivatives of the WS2812, which use a custom (but ubiquitous) 1-wire serial protocol, and the newer APA102, which uses standard SPI and can update much faster. Although they are likely to push everything over the 5W threshold as they can draw up to 100mA each at full brightness.
* Re: USB power headroom, you can get to 5V@3A quite easily for the cost of a USB-C connector and two 5.1k resistors, or an inexpensive PD trigger which unlocks 9-20V (fixed or variable, potentially noisier) from most phone or laptop power bricks. Does the current design rely entirely on USB power? I have a hell of a time with ground loops on my bizarre chained hub setup.
* Another big change that might pay off in the long run. For faster iteration on the USB interface / encoder / LCD side of things, it might be worth porting that code to an external interface controller based on a fast, dual-core ARM micro like the Raspberry Pi RP2040 - then the FPGA can focus on audio and communicate all its LED control and USB needs over a hard UART. The 2040 in particular has first-class support for programming via MicroPython, which lets you develop firmware over an interactive serial terminal without even having to flash anything (and of course also supports more traditional C/C++), and the castellated vias on the Pi Pico dev board let you surface-mount it permanently into a product without having to actually solder down the chip.
* The Tang Nano FPGA mentioned by buggins was pretty much unusable to those of us in the English-speaking world just a few months ago, but support for open-source toolchains has blossomed in the time since, presumably driven by demand for affordably priced FPGAs from any vendor. I have a Tang Nano 9K on its way from China and hope to attempt a drop-in board swap for the Altera once everything is up and running.
* Re: portable and performant librarian design, man lightweight, modern C++ libraries like FTXUI or Dear Imgui make it pretty easy to spin up tooling, especially with the advent of WebAssembly, which let you write an interface once in C++ and have it run natively on any OS or even in the browser. Some have Rust / Go bindings as well.

Posted: 11/19/2022 3:59:38 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Was excited to chat with Eric yesterday and dive a little bit into D-Lev hacking, I have a thousand micro-projects I'm excited to try with it once i can build a kit."  - ekahn

It was a pleasure to meet you too!  I think the kit will give you a good functional baseline to work with, and you can remote control most of the features via the serial port if you like.

Random comments below, please don't take them as criticism!:

"* For more manufacturable 'high-end' enclosure components, I have also been itching to try PCBWay's CNC services, as their quality of product has already upended the value game in the PCB space."

It's amazing what you can farm out these days!

"* Aliexpress sells coil winding machines with varying levels of automation at every conceivable price point between $100 and $2000."

For the D-Lev single layer solenoids, I've found that hand cranking gives you the most control over things.  Sometimes the wire starts going where you don't want it to go and you need to back things up a bit, and sometimes you want to pause and tighten up 10 or so turns.  The actual inductance / turn count isn't all that critical, +/- a few % is achievable by measuring the total turns length.  I just drill a small hole at each end and turn to those, and use the holes afterward for the connecting wires (wire-wrap wire).

It would be nice to farm the coils out, or automate it in-house, but I can (literally) crank through 20 or so in a day, so unless production really spikes I'm cool with that.

"* I realize this discards a decent amount of work, but modern chainable / addressable LEDs are cheap, never go out of stock, and come in every form factor you can imagine - they are integral to practically every gamer-marketed RGB-vomit product on the market today. The two main options are derivatives of the WS2812, which use a custom (but ubiquitous) 1-wire serial protocol, and the newer APA102, which uses standard SPI and can update much faster. Although they are likely to push everything over the 5W threshold as they can draw up to 100mA each at full brightness."

Interesting, thanks!  The ICs I'm using now are pretty weird, and don't have sufficient dynamic dimming range.  I'm doing PWM for inter-LED resolution, but like to use the analog current dimming overall to keep higher current switching to a minimum.  Inter-LED PWM means one LED is always on, which helps to even out the load.

"* Re: USB power headroom, you can get to 5V@3A quite easily for the cost of a USB-C connector and two 5.1k resistors, or an inexpensive PD trigger which unlocks 9-20V (fixed or variable, potentially noisier) from most phone or laptop power bricks. Does the current design rely entirely on USB power? I have a hell of a time with ground loops on my bizarre chained hub setup."

Oh, quite interesting!  The D-Lev is right at the 0.5A limit, and that's been keeping me from seriously considering a larger FPGA.  A real processor would help current draw too, I'd actually like to stay somewhere in the 2.5W or less range just to minimize heating drift, and to allow the use of inexpensive type A chargers.

"* Another big change that might pay off in the long run. For faster iteration on the USB interface / encoder / LCD side of things, it might be worth porting that code to an external interface controller based on a fast, dual-core ARM micro like the Raspberry Pi RP2040 - then the FPGA can focus on audio and communicate all its LED control and USB needs over a hard UART. The 2040 in particular has first-class support for programming via MicroPython, which lets you develop firmware over an interactive serial terminal without even having to flash anything (and of course also supports more traditional C/C++), and the castellated vias on the Pi Pico dev board let you surface-mount it permanently into a product without having to actually solder down the chip."

The direction it's probably headed is FPGA generation of the fields and perhaps encoder input, with a > 1GHZ processor doing everything else.  But it's interesting to hear other approaches.  One thing that's really nice about the FPGA kitchen sink approach is you have full control over every little thing.  Another thing is all the availability risk boils down to one chip - it's rather hair-raising / bewildering having some nothing jellybean part holding up a bunch of builds.

"* The Tang Nano FPGA mentioned by buggins was pretty much unusable to those of us in the English-speaking world just a few months ago, but support for open-source toolchains has blossomed in the time since, presumably driven by demand for affordably priced FPGAs from any vendor. I have a Tang Nano 9K on its way from China and hope to attempt a drop-in board swap for the Altera once everything is up and running."

Thanks!  This is something I should be keeping my eyes on too.  American FPGA manufacturers have dominated the market for too long, though they have incredible tooling.

* Re: portable and performant librarian design, man lightweight, modern C++ libraries like FTXUI or Dear Imgui make it pretty easy to spin up tooling, especially with the advent of WebAssembly, which let you write an interface once in C++ and have it run natively on any OS or even in the browser. Some have Rust / Go bindings as well.

The librarian Go code is open source, so folks can do what they want with it.  I'm personally fine with the command line, but it would be nice to have a more non-tech friendly version for more casual use.  I don't have the cycles or even the inclination to research that at this point, but perhaps someone else will take a shine to it and spearhead it.  Go has robust cross-platform serial port support.

I very much appreciate your participation in this project ekahn!  The FPGA boards you pointed me to are due for delivery on Tuesday, if all goes well you may be able to take a kit home with you after Thanksgiving!

Posted: 11/20/2022 5:58:06 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Presettin'

Audio samples of some D-Lev presets I've worked on recently:

https://d-lev.com/audio/2022-11-18_one_step_beyond.mp3
https://d-lev.com/audio/2022-11-17_whale_of_a_time.mp3
https://d-lev.com/audio/2022-11-14_monster_truck.mp3
https://d-lev.com/audio/2022-11-14_mortal_hum.mp3
https://d-lev.com/audio/2022-11-13_jaw_harp.mp3
https://d-lev.com/audio/2022-11-12_smoke_on_the_d-lev.mp3

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