When interfacing a Joystick, Modwheel or Pitchbender it is sometimes found that the voltage range on the potentiometer output is well _ inside _ the range of the Core ADC input.
This can often be overcome with digital calibration in the firmware (e.g MIDIbox KB) in some cases there is extreme loss of resolution.
Presented here is a circuit to overcome this to give the ADC the full range (in this case 0..3.3V) even though the range of the potentiometer is well inside this.
The design process is very easily done following this app note:[sloa097.pdf](< base_url >/applications/core/interface/file/attachment.php?id=10542)
I’ve done a spreadsheet to make it even easier! [Scale Offset.zip](< base_url >/applications/core/interface/file/attachment.php?id=10543) If you don’t have MS Excel, you can use it with free tools Google Docs, or Open Office.
To use the speadsheet you enter numbers into the blue fields. The input range at the top as measured on your pot. In preparing the examples, I played with the value of Rg2 so that Rg2+R1 came close to 10k. This allowed to replace them with a 10k trimpot as in the example circuits. It was just as well, as the trimpot did require some tweaking away from the calculated values, I found.
I chose LM324 op amp as it’s output goes down very close to 0V. It’s maximum possible output with a Vcc=5V is about 3.5V which should be quite safe with a 3.3V Core ADC such as LPC17 MBHP Core.
There are 4 op amps in this device, so 4 scaling/offset circuits can be implemented with 1 chip.
Here’s the circuit with 2 worked examples:
Here’s the test (input on left, output on right) showing 3 points ( Modwheel example):
Here’s another test (input on left, output on right) showing 3 points ( Pitchbender example):
Hello Duggle.
With pdf files and excel I have never had problems with downloading, only the pictures are not unloaded. now all ok.
As a simulator I use NI Multisim.
tomorrow I build the PCB of your project so let’s see how it works in life.
from playing with the speadsheet, it looks as though Vref can be equal to 5V rather than 3.3V.
This means one less connection to your PCB.
If you do this the position of the trimpot will be a little different and the gain is less by 1 or 2%. Which should be fine, the most important thing setting up this circuit is to make sure the ADC does not saturate, (i.e make sure 0.0V<Vout<3.3V across the range of your modwheel.) Then do final calibration in firmware.
I redid the simulation with vref 5v. works well. I used the MC33079 because I have more than 10 pcs, and I’m sure you are good at 5v. I have used correctly on a digital effect
Make sure you use an IC socket, because MC33079 (according to my reading of the data sheet) outputs >1.0V above GND at minimum output. This is common with op amps.
Thus, I don’t think MC33079 will work well.
This is why I specified LM324.
Don’t worry, they’re pin compatible, easy to swap.
hello! I used LM324 and I managed to get the correct volts.
there a problem with pitchbender. trying with Midistudio, I saw that modwheel never stands still at zero, it always turns. I tried using the potentiometers without your circuit and behaves the same. I think there still to be done on the software.
As I wrote above I built the circuit with lm324 and I managed to get the right volts. problem and that there too much sensitivity in software midibox kb regard to the potentiometers. This thing or noticed even in MIDIO 128 V3 with potentiometers. Do you think that the programmer can do something to improve this problem?
I use MIDIBOX kb, with varranger software, since I enabled Pitchwheel and modwhwell my varranger and become crazy. when I have time, I’ll make a recording. In my opinion, too many midi commands sent from midiboxkb makes them dizzy.
Thanks for the reply! I have already drawn Ainser for 20 pot. Saturday prepare the pcb, after I tell you if that’s okay. still remains the problem of pitchweel and modweel.
It might be possible to connect the pitchweel and modweel of ainser64?
THANK!
It might be possible to connect the pitchweel and modweel of ainser64?
Correct!
Remember to recalculate the resistances for 0..5V output (hint: use the spreadsheet, let me know if problematic, change the values so that only one resistor need be re-soldered, if any)
You may be lucky and just a tweak of the trimpot(s) is all that is required.
Not sure what you mean, I thought you were planning on using the same modwheel and pitchbender which have limited range, and hence the scaling and offset is still required.
[edit] I forgot that the op amp requires a +ve rail about 1.5V higher that the maximum desired output voltage. For a 5V output, this implies a required +ve supply of >6.5V which may be inconvenient. It might therefore be appropriate to go back to just digital calibration, given that the ADC reading with the AINSER converter will have better resolution ( as well as less jitter).
I tried everything today to calibrate pitch. and mod. nothing to do. my varranger not digest pitchwhell and modwhell of MIDIBOX KB. I do not know what to do.