# single-capacitor oscillator choice for digital theremin

Intro

One of the pupils puzzled me with a question of building a theremin - a basic musical instrument which has a pitch manipulated by moving the hand around the vertical antenna.

Due to specifics of our course (and skills of our pupils) I proposed to create a digital solution, like this:

• we have an oscillator with antenna attached to one of its capacitors
• the oscillations are fed to counter input of arduino, which generates sound from the preprogrammed waveform, with the frequency depending on the values from the counter

Well, the part with arduino works right now. We also have tested ultrasonic distance sensor (instead of antenna+oscillator), but it is not very handy.

Oscillator - what I'm trying

But what oscillator to use? The simplest thing I've taught my pupils is the 555-based generator, so I've tried to plug one with a very small capacitor first - like this:

Here C = 5pF R1 = 400k R2 = 1k, the output from 3 goes directly to arduino counter input.

This works, giving the frequency of about 200 kHz (decreasing by about 3% when hand is about 1 cm from antenna). It should be higher (judging by R1*C, though there is also capacitance of antenna) and I want it be higher (for more accurate count) - however I could not increase it by changing R1. With 100k it is only about 250 kHz. With 21k it is only marginally higher and seemingly stops to react to waving around antenna.

This is puzzling. I think I'm either doing something wrong, or can't get more frequency due to some limitation of the chip (probably it may work better at higher VCC).

The question

So I'm seeking for either advice to improve this design, or suggestion of some transistor based oscillator. The most familiar thing is a symmetric multivibrator, but I'd rather prefer something with a frequency depending on a single capacitor (either in LC or RC setup).

• That's a pretty cool project idea! Commented Nov 26, 2016 at 8:56
• In theory (i.e. according to TI's datasheet), an xx555 should have a pulse rise and fall time of each somewhere in between 100 and 200 ns, that makes 200 – 400 ns in total, i.e. a max reliable oscillation at 3 MHz. Commented Nov 26, 2016 at 9:01
• Are you building this on a PCB or a breadboard? Parasitic capacitances and inductances might become a problem! Commented Nov 26, 2016 at 9:02
• Are your pupils aware of Opamps? That'd make building a Wien-Bridge oscillator relatively easy. Commented Nov 26, 2016 at 9:12
• It's not that likely any xx555 will work reliably at 5MHz, if you follow my calculations. Again, it might however not be the NE555 that's the problem here, but the stray capacitances of however you're building the circuit. Commented Nov 26, 2016 at 9:29

I think your best bet is the good old colpitts oscillator - nothing ends up in saturation (unlike a square wave oscillator) and with even modest transistors, it's capable of several tens of MHz: -

In a slightly more advanced version it is used in capacitance probe measurement circuits looking for pieces of metal rotating past the probe end and, it will certainly detect tiny fractions of a pico farad change.

Attach the antenna (aka probe) at the top of L1 or even make two flat plates (one being 0V) where you can wave your hand over and change the frequency. To make it more sensitive to habd movement, the two 1n0 capacitors should be made lower in value and L1 increased.

It produces a sine wave but this can be changed to a square wave using a fast comparator like a MAX999. The basic oscillator will also run down to 3V (just about) on the power lines.

• Thanks for suggestion! I vaguely remember this schematics from my childhood. I'll try it and update the post with the results! I believe R1 should be tuned depending on voltage and transistor's beta, right? Commented Nov 26, 2016 at 10:25
• Right you may have to tune R1 but it's not critical because R2 provides DC feedback. A couple of volts (say 1V-4V) across R2 should be OK
– user16324
Commented Nov 26, 2016 at 10:59
• I agree with Brian and also you can use a more stable bias arrangement of two resistors forming a potential divider providing the resistor values don't go too low i.e. below a few kohm because oscillations won't start. Commented Nov 26, 2016 at 11:14
• @RodionGorkovenko did you try this idea in the end? Commented Feb 24, 2018 at 17:28

Since you have tried Theremin approaches other than oscillators, namely ultrasonic, perhaps you could try a reflective optocoupler approach: This has the advantage that younger students can grasp light reflection much easier than capacitance, oscillation, frequency. Interfaced to a microcontroller, it is possible to isolate reflected light from ambient light. An analog-to-digital converter inside the microcontroller measures current through the phototransistor. The microcontroller also commands the infrared light-emitting diode to turn "ON" or "OFF". A measurement sequence goes like this:
(1) Turn on light-emitting diode
(2) Measure photo-transistor current "I1"
(3) Turn off light-emitting diode
(4) Measure photo-transistor current again "I2"
(5) Reflected light = I1 - I2
Since this sequence takes very little time (easily under 100 microseconds), many measurements of reflected light can be accumulated to give high resolution. In a bench test, the reflected light result refused to go to zero, because LED light was reflected from the ceiling tiles eight feet away. Many inexpensive microcontrollers include the required A-to-D converter :

simulate this circuit – Schematic created using CircuitLab R2 can be sized to accommodate phototransistor sensitivity, and to accommodate ambient light. Larger values increase sensitivity. In the example schematic, the A-to-D result will be numerically smaller for more light, so the calculation would be modified to (I2 - I1).

• Glen, thanks for proposition! I regarded this approach along with ultrasonic, but the main problem is that the dependence between distance and amount of reflected light is not linear. And moreover it greatly depends on the size and reflective properties of the object (e.g. hand). Another problem, similar to ultrasonic, is that the sensor works in the acute angle only... Commented Nov 30, 2016 at 5:55

Thanks to Marcus-Müller - I've solved the problem by switching to opamps. More precisely, to comparator. With the typical LM358 I was not able to make more than 200 kHz, but then I fetched basic LM2903 comparators from the nearest shop - and the result is great. I've got 700kHz at once and it is quite enough for this project.

Sorry for I haven't succeed with Colpitz oscillator yet. I still hope we'll try it to compare results. But it appeared bit more complicated to tune it to working mode...