Go Down

Topic: Arduino Theremin (Read 7808 times) previous topic - next topic

jon

hi all.

my first arduino project!  i've been fiddling around trying to make a theremin, but my electronics knowledge is sooo bad...  perhaps i could use arduino instead?

anyhoo, before i go and short circuit the thing in a fit of blissful electronic ignorance, i thought i'd best get a few opinions.

what if we use one of the analog outputs to charge up a capacitor - then, when it's charged, switch off the output and let the cap discharge through an analog input.  when the cap has fully discharged and the input goes low, measure how many microseconds have elapsed since the program started, feed that number into a tone generator function, then repeat.

my preliminary schematic:

[or goto http://www.jonandaviva.googlepages.com/theremin_schematic.jpg]

a change in antenna capacitance will alter the cycle time marginally, and this difference can be amplified before the result goes to the tone generator.

do you think i need the diodes?  did i even show them pointing the right way??  what about a resistor - some kind of load to work against??  hmmm.  what's stopping all the charge from just going from A0 (out) to A1 (in) rather than charging the cap?  maybe put a resistor at A1 instead of a diode?

aaargh!

here's the programming concept:

1. set A0 high for x microseconds (long enough to charge the cap).
2. once A0 is low, wait for A1 to go low (while the cap discharges through it)
3. once A1 is low, measure the elapsed time in u-secs (MILLIS command? ideas?) from the beginning of step 1.
4. process the u-secs value mathematically to detemine pitch (larger value = hand closer to antenna = higher pitch)
5. execute a module to play resulting pitch through another analog output with speaker attached.
6. while the pitch generator module is in operation, loop back to step 1.

sorry for posting such a sketchy concept, but i need all the help i can get.  hope to hear your ideas!

jon.

Daniel

#1
Jan 18, 2007, 08:26 am Last Edit: Jan 18, 2007, 10:43 am by Daniel Reason: 1
it's close, but I don't think it will work as is.

one thing I note right away is that for the discharge cycle, doing an alalog.read will not discharge the cap in time for the next cycle, since an analog read only uses microamperes of current (it's a high-impedance input by nature). You'd actually have to do a digital.write (pin, LOW); to drain the cap through a pin (digitalWrite(pin,LOW) places the pin in Lo-Z mode).

In that case you will definitely need a resistor, or you risk burning out the input.

Why not just go with the basic principle of the Theremin: detecting frequency variations? Find a F to V chip that will do the trick and then do the voltage analysis in software.

Have you seen this site?

jon

thanks daniel.  i've actually decided to give the Qprox QT300 chip a go, since it basically does what i'm trying to achieve in my attempted schematic:  ie, charging and discharging a cap really quickly, and turning the results into 16-bit data for processing.  and if that fails, yep - i'll try the f to v converter.  i've been hesitant to try them in the past because i thought they'd be too sluggish in response time, but maybe if i run the oscillator at a relatively high frequency...?  anyway, i'll post the results as soon as qt300's arrive and i can get something happening.  oh and thanks for the theremin world link - i've been using the site for a while now and think it's a really good resource!

jon.

Daniel

#3
Jan 19, 2007, 08:54 am Last Edit: Jan 19, 2007, 08:54 am by Daniel Reason: 1
nice idea-- I hadn't seen that chip until now. Seems like it's exactly what the doctor ordered!


porres

hello, Im trying to do a similar thing... but i think of using more than one antena, and using them to control different parameters... hmm... hey... so, did you get your simplified/theremin working on arduino after all?

I need other people to look at this and help me out... damn, I'm such a begginer yet...

cheers
alex


jon

well, i've been too scared of frying my arduino to have a go doing something like that schematic.  BUT!  i have some digital capacitance sensors on order, so once they arrive i'll make a prototype and keep you posted.  if they EVER arrive goddammit!
i'm not getting my hopes up, though.  the qprox folks seem to think that capacitance-in-air applications, like a theremin, really aren't what the QT range are made for.  they only ever seem to talk about touch control buttons and fluid levels, yadayada. but we shall see...

jon

well, for anyone interested... i've had some initial success with this project - in that i've somehow managed to get a QT300 capacitance-to-digital sensor talking to arduino in a vaguely meaningful manner.  yay!  you can see some of the progress and read about what needs to be done next on this thread (titled "supply current..."):
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1169728880

hopefully you might also be able to emulate what i've done, if you're interested, but otherwise i'll do my best to write up the proceedure as a tutorial soonish...
i'll start a new thread once i'm back from a (potentially very fun and messy) beach roadtrip and have had time to get round to investigating ways to make the setup behave more like a theremin should behave.  at the moment it's actually quite bad, but i've got a few ideas on how to improve it.  if you do too, i'd love to hear about it!

love, jon.

kk

Hi jon,
dunno if you are interested in implementing that particular technology more than having a quick and working solution,
in my experience a much easier way would be using an ultrasonic range finder, sorta like Maxbotix EZ-1,
it gives analog voltage output proportional to the distance of the nearest surface, from 0 to 6 meters,
reasonably cheap and nothing more than plugging 3 wires, the +/- and the analog input.
I've built a sortof theremin just connecting the reported range to the frequency of a sine oscillator in maxmsp,
then you can use the same data to control some phaser-reverb-delay effects giving you much more expressivity.
Hope it helps,
ciao!
gio
http://www.somaticav.com

Go Up