Question about voltage shifting

Posted: 10/14/2010 7:22:09 AM
rfoshaug

From: Norway

Joined: 10/14/2010

Not a question about Theremin construction per se, but the good people in here are probably the most qualified to answer my question.

I've ordered (not yet received) a Moog Etherwave Plus Theremin, with voltage outputs for Gate, Volume, and Pitch.

This got me thinking.... Over at pc-control.co.uk (http://www.pc-control.co.uk) there's a board available (W.A.S.P. (http://www.pc-control.co.uk/wasp_info.htm)) that provides analog inputs accessible via USB. Maybe the Theremin's analog outputs could be snapped up by a computer to control all sorts of crazy stuff via MIDI! :-)

The computer programming is not a problem (I'm a professional system developer). However, the electronics of it all and voltages and resistance etc. are where I get lost.

The challenge is that the Etherwave delivers 0-10 Volts on the volume and gate outputs, and -2.5V - +4.5V on the pitch output.

The W.A.S.P. board can detect voltages from 0 - 5 Volts.

The helpful people at PC-control gave me a simple instruction on how to divide down 0-10V into a 0-5V range using two resistors.

However changing that -2.5V - +4.5V pitch output into a 0-5V input is more complicated. They mentioned a voltage level shifting circuitry is possible.

Does anyone have any helpful info on this? Can a voltage level shifting device be created easily? Or can it be bought somewhere? I'me completely blank here. I did a Yahoo search, but wasn't much wiser from that...

Any info would be highly appreciated. :o)
Posted: 10/14/2010 11:42:04 AM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

[i]"Does anyone have any helpful info on this? Can a voltage level shifting device be created easily? Or can it be bought somewhere? I'me completely blank here." -Rfos [/i]

Hi Rfoshaug, Welcome to TW!

Yes - Voltages can be shifted and scaled quite easily, the easiest way is by using standard op-amp circuits (particularly summers) where you can add voltages (+Ve or -Ve) and set resistor values on each input to change the scaling of that input (multiplication).

There is a thread somewhere here which likns to a simple schematic I designed, which should do most of what you need.. I will edit this post and place a link to this thread as soon as I locate it.

Watch this space! ;-)

I am having some trouble with TW at the moment.. but in the meantime - I checked the WASP link, and one thing is of concern - I cannot see any data on the A/D resolution.

To accurately resolve pitch data into anything musically useful, you need a minimum of 12 bit resolution and an update rate of better than 5ms.. If (as I suspect) the WASP A/D is 8 bit. If one has a linear pitch voltage input (as one gets from the EW - 1V/Octave) then 5 octaves into 8 bits will give you a maximum resolution of 1/4 semitone.. as in, you will not be able to replicate the gliding between notes. Even if you limit the input range to one octave, you will have 21 steps between semitones - and this is clearly audible (you need steps to be 1 cent - as in 100 steps per semitone - and anything worse than 2 cents gives a 'zipper' effect).

8 bits is just ok if one only wants to trigger MIDI note events or similar - but no good otherwise.

Until I find the link.. The circuit you want consists of a couple of opamps, resistors, and selection switch/es and/or potentiometers, and a +/- 12V supply.. it is extremely simple, and I could build it for you. My email is fred[at]fundes[dot]co[dot]uk

[b] Links to comprehensive thread on this subject -> [/b]

http://www.thereminworld.com/forum.asp?cmd=p&T=3939&F=3&p=2

This link is to my schematic for the shift and stretch circuit.. It requires minor modification to achieve 0 to 5V output span:

http://www.therasynth.com/html/cv_mod.html

Fred.
Posted: 10/15/2010 4:58:16 AM
rfoshaug

From: Norway

Joined: 10/14/2010

Thanks for your great reply!! I'm a few notches wiser now. :-)

I thought the W.A.S.P was more than 8 bits, but now that I re-checked the website, it is indeed 8 bits. That might be good for controlling effects (which is one of the uses I imagine for this project), but not for using the control voltages to control the pitch of a synth sound inside my Korg Radias.

The MIDI standard for pitch bend is 14 bits (+/- 8192), so MIDI itself has enough resolution to play a fixed note (eg. a C3 note) and pitch bend up and down without that zipper effect. And the Radias, being a virtual analog synth won't have any sample stretching problems either.


So... I googled (actually Yahooed) a bit and found this:
Measurement Computing USB-1608FS (http://www.mccdaq.com/usb-data-acquisition/USB-1608FS.aspx)

It has 16-bit resolution, and "input ranges of ±10 V, ±5 V, ±2 V and ±1 V are software selectable". With 16 bits resolution and a MIDI pitch bend resolution of 14 bits (1/4 of that of 16 bits), it shouldn't matter if the voltage ranges aren't 100% perfectly matched to those of the Theremin.

One could use ±10 V for volume (which is in the range from 0 - +10V) and ±5 V for pitch (which is in the range from -2.5V - +4.5V) and still get acceptable pitch resolution.

For volume (being a control change from 0-127) DA converter resolution is of course not an issue.

I'll research this a bit more I think...

Thanks a lot for your help, Fred!! I really appreciate it. I'll read more in those links you provided when I have the time, even though I might not need voltage shifting after all, just because it's interesting to learn stuff like that. :-)

Rune
Posted: 10/15/2010 5:20:25 AM
rfoshaug

From: Norway

Joined: 10/14/2010

Also found these:
http://labjack.com/u12 (http://labjack.com/u12) (this one is fixed at +/-10 volts and 12 bit resolution)

DataTranslation DT9816 (http://www.datatranslation.com/products/dataacquisition/usb/dt9816.asp) (this one is selectable of either +/-5V and +/-10V and 16 bits)
Posted: 10/15/2010 8:40:41 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

Hi Rune,

Yes - All those other interfaces you found look a lot better than WASP.. I did'nt like the lack of essential technical data on the WASP - always (in my expierience) a bad sign if things like n-bits and sampling speeds are not boldly stated on the front page!

Even LABJACK with its 12 bit resolution (and 50ks/s) would do most of what you could want with a little bit of software to smooth pitch bend - one can easily derive MIDI note number from the 12 bit data, and determine rate-of-change rapidly on 'bend' data to fill in the missing bits.

With regard to fitting the voltages within the input ranges - Yes, as you say, 16 bit resolution gives enough 'headroom' so that no extra front-end hardware is needed.. But - Dont write-off the idea of having an op-amp or two on the input side.. Adjustable analogue front-end circuitry can greatly simplify everything (particularly if you are using a lower resolution / lower cost ADC).. I personally prefer to have my input signal converted to the full ADC range.

One final word of advice.. With 50ks/s you have time to 'de-jitter' the input signal.. The LSb of the data is (due to noise etc) often unstable, and can effectively lose you one bit resolution if not handled carefully.. I have taken this bit and 'averaged' it over 4 samples (reducing the effective data collection rate to 12.5ks/s if sample rate is 50ks/s).. Simply count the number of '1's detected in this period [800us], and one can eliminate the loss of the LSB and perhaps even gain a couple of extra 'bits' of 'virtual' data - pushing 12 bit resolution up to 14 bits.. This is a crude scheme, and relies on noise being 'good quality' (LOL) - Much more sophisticated schemes are generally employed - but simple counting of the LSb states is quick and simple.

One can greatly extend A/D resolution (at the expense of speed) by deliberately injecting (adding) a triangle wave with P-P amplitude equivalent to 1 bit.. one then gets 'multiplication' of the resolution by averaging the lowest 2 bits, and can even get 16 bits data from a 12 bit ADC... But in most cases it is not worth going to these extremes. (BTW - these are not my ideas - they are used extensively in much more elaborate form in many products.. Oscilloscopes are one application which comes to mind - my 12 bit PICO PC 'scope' gives an effective 16 bit resolution bu using noise..http://www.picotech.com/education/oscilloscopes/resolution-enhancement.html

Fred.
Posted: 10/17/2010 1:56:43 AM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

Another quick idea..

If you want to convert the EW pitch voltage (-2.5 to +4.5) to a voltage compatable with 5V (0 to +5V) interfaces, you only really need two resistors..

Connect a resistor of 20k between +5V and the input (pull the analogue input up to 5V via a 20k resistor - Ideally you want an extremely stable +5V, but for 'playtime' the logic 5V will do... Better would be a 10k in series with another 10k, and a 100n capacitor between the mid point and 0V for decoupling).

Now - the connection from the Theremin CV to the input should (must) be via a 10k resistor.

When the Theremin CV is -2.5V, the input connection will see 0V (the 20k to 5V and the 10k to -2.5V causes a voltage drop across each resistor such that there is a 2.5V drop across the resistor connected to the Theremin.. 2.5 - 2.5 = 0.

When the CV out of the Theremin is 4.5V, the input will see a voltage of 4.666V (The voltage drop across the input resistor is (5 - 4.5)*0.333 so the voltage on the input is 5 - 0.333 = 4.666.

By adjusting the voltage (biasing) on the 'top' resistor and playing with the resistor values, simple shifting and re-scaling can be accomodated without using any active components.. This only works where the 'span' of the input voltage is greater than the 'span' required for the output voltage (as in this case, where the input 'span' is 7V and the output 'span' is 5V, and the 'shift' is small) Best to do the sums on a spreadsheet.. Simply compute the current through each resistor for the input voltage extremes, and find the resulting voltage on the input terminal.

The resistor values given will work provided the loading impedances are insignificant.. Input impedance >>100k, Theremin Output impedance <<1k... You will need to determine optimum resistor values based on resistances of circuit you are interfacing to.. For example, if the input impedence is >1M, but the output impedance is > 1k, you might increase resistor values to 200k and 100k.. You might also want to put a preset in the circuit.

Fred.
Posted: 10/17/2010 8:44:36 AM
rfoshaug

From: Norway

Joined: 10/14/2010

Thanks for the info, Fred!

I have now ordered a USB-1608FS (http://www.microdaq.com/measurement_computing/data_acquisition/usb-1608fs_daq.php). :o) For export outside USA I even had to fill in a form declaring that it won't be exported to embargoed countries and that I won't use it for nuclear or other non-conventional weapons development!

"Nah, I'm not building an atomic bomb, just MIDIfying my Theremin". :-) :-) :-)


That bit on increasing resolution at the expense of sampling frequency (ie. averaging multiple samples) is great! I might not need it in this application as I've ordered a 16-bit ADC which will convert data to 14-bit pitch bend data, but it (as well as the info on voltage shifting) might come in handy at some point, especially if I decide to use the other 6 analog inputs for other kinds of fun. :-)


I guess the very simplest solution (when I get the theremin and A/D-box) will be to use a standard instrument cable (mono jack - mono jack) and cut it in the middle.

I'll then have two pieces, each having a jack plug in one end and two leads in the other, which I then connect to the respective ports on the A/D-box (if I swap the two cables, the voltage will be reversed from + to - x volts or from - to +, but it doesn't matter which is connected to "ground", rigt?) and plug it into the control voltage outs on the theremin and start measuring voltage.

Are there any caveats or possible problems I should know about? If i measure the voltage directly (in the +/-5V and +/-10V ranges for pitch and volume respectively), can I just connect the outputs from the theremin directly to the box without any resistances or other "stuff" in between?

Should I limit the lenght of these cables and limit the distance between the theremin and the A/D box as much as possible to avoid noise and have the voltage measurement as accurate as possible? Would a standard instrument audio cable (or modular synth patching cable) work nicely for this?


Thanks for your invaluable help on this! :-)
Posted: 10/17/2010 10:24:35 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

[i]"Are there any caveats or possible problems I should know about? If i measure the voltage directly (in the +/-5V and +/-10V ranges for pitch and volume respectively), can I just connect the outputs from the theremin directly to the box without any resistances or other "stuff" in between?"[/i]

In theory, you should know both the output impedance from the Theremin and the input impedence of the ADC.. In practice, you should not need to worry about this - Input impedence (to ADC) is likely to be high (>= 10k at least) and output from the Theremin is via an on-board 330R resistor.. The voltage seen by the ADC should therefore not be significantly loaded... You can calculate the voltage drop any loading causes by adding the output resistance (330) to the input resistance (say 10000) and you will see that the voltage drop (across the 330R output resistor) is 0.0319V per volt

Voltage drop per volt is calculated as follows:
Vdrop = (1/(Rout+Rin))*Rout

So with Rout = 330, and Rin = 1k, Vdrop = (1/(330+1000))*330
=(1/1330)*330
=0.00075188*330
=0.24812 V /V

But, in most cases Rin will be higher than 10k and the Vdrop will be insignificant

[i]"Should I limit the lenght of these cables and limit the distance between the theremin and the A/D box as much as possible to avoid noise and have the voltage measurement as accurate as possible? Would a standard instrument audio cable (or modular synth patching cable) work nicely for this?"[/i]

Again, in theory, one wants as good a connection between the CV output and the input. The most likely source of problems will be mains induced signals (50Hz) .. Remember, with a 1V/Octave system, a semitone is a mere 83mV (0.083V) and a cent is only 833uV (0.000833V)..

Any resistance in the cable is effectively added to Rin, and will cause a proportional drop in the voltage.. If one takes the case of a 1k Rin, and adds 1 ohm to Rout, you will see a voltage drop of 0.23865 rather than 0.248123.. this is a difference of 565uV - less than one cent difference.. 1 ohm is a lot of resistance for a cable, and 1k is a low resistance for an input.. in practice therefore one does not need to worry much about cable length in terms of resistance problems.

By far the biggest (and often most puzzling) problems occur as a result of earthing.. but this is a whole topic unto itself.

Sum up ? Reasonable / good quality connectors, good quality cable (but dont go silly - there is absolutely no benefit in oxygen-free or exotic metals even for high-end audio - and even less for CV carrying cables)[i](I know there are many Hi-Fi nerds who would argue with me until doomesday about what I have just stated - but I believe almost every claim regarding exotic cables is pure pseudo science based fraud)[/i]

Good screening on your cable IS important - Both a conductive plastic sheath and metal braid / wrap ideally.. Also, choose cable with high capacitance (this type of cable tends to be cheaper - most applications want low capacitance) as this acts to attenuate high frequency which you dont want.

Good luck! I am most interested in your project.. I have a CV outputting Theremin prototype on my bench, and CV output Capacitive sensing modules on the brink of production - So your developments could be of great interest to me.. I would be real interested in making off-board contact with you. fred[at]fundes[dot]co[dot]uk

Fred.

[b]>> ADDED >> [/b]

I have just looked at the interface you ordered! Looks real high-end.. No problem with Rin of 100M except, perhaps, that it might be a bit too high - LOL - For CV you do not need 100ks/s or 100M Z-in... I would put a 100k resistor in parallel with a 10nF Ceramic capacitor between the input and 0V (ground). (Doing this will also help to protect the input from ESD.. 100M is an extremely high input Z, hopefully it is adequately protected, BUT - it is real easy to kill an input circuit by high
Posted: 10/18/2010 3:50:30 PM
rfoshaug

From: Norway

Joined: 10/14/2010

Again thanks so much for the info!

I ordered some other accessories and stuff from a web shop today and also ordered said ceramic capacitor and resistor (actually something like a 50-pack). :-)

Yes, the USB interface looks quite high-end. And it's indeed overkill, but as you say that's better than underkill.

I might use the other 6 of the 8 analog inputs for other purposes and experimental instruments later on.

I've also ordered some female jack plugs and a small box to mount the AD converter inside so that I'll get a box with 2 jack plugs on one end and a USB cable on the other. At least that's the plan at the moment. :o)


The goal is that it'll be like those connecting their Moog Voyagers to their theremins, except that this will be a control-voltage-to-MIDI interface for any synth (although Virtual Analogs will be better suited).

And I think I might be able to reach that goal. :-)


I've sent you an email as well. I'd love to share my experiences with you both on and off this discussion board as this project progresses.


As for sampling and processing the audio from the theremin itself (the AD converter board is certainly fast enough), I don't know much about digital audio processing or how to alter harmonics etc. My laptop might also be lacking a bit in computing power for this.

My plan is to route the audio from the theremin directly into my Korg synthesizer and process it with the synth's internal effects for some songs, and use MIDI data and the Korg's own synthesis for other songs.

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