Duggle Posted March 30, 2013 Report Share Posted March 30, 2013 (edited) 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 I've done a spreadsheet to make it even easier!Scale Offset.zip 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): Edited March 31, 2013 by Duggle 1 Quote Link to comment Share on other sites More sharing options...
folly Posted March 30, 2013 Report Share Posted March 30, 2013 thank you for your work. you are very kind. I can not download photos. (Sorry, you don't have permission for that!) you can send on my email info@harddiskrecovery.it ? thank ! Quote Link to comment Share on other sites More sharing options...
Duggle Posted March 30, 2013 Author Report Share Posted March 30, 2013 (edited) I've just inserted the pictures as "image links", I think this is better than the "My Media" method. Can you access the spreadsheet and pdf file attachments o.k? Edited March 30, 2013 by Duggle 1 Quote Link to comment Share on other sites More sharing options...
folly Posted March 31, 2013 Report Share Posted March 31, 2013 Hello DUGGLE! I simulated your design and works well. Now build the circuit board. thank you again! Quote Link to comment Share on other sites More sharing options...
Duggle Posted March 31, 2013 Author Report Share Posted March 31, 2013 (edited) That's good. What software did you use for the simulation? Can you access the spreadsheet and pdf file attachments o.k? (I don't have 2 forum accounts to test it.) [edit] I can now see there have been a number of downloads. Edited March 31, 2013 by Duggle 1 Quote Link to comment Share on other sites More sharing options...
nILS Posted March 31, 2013 Report Share Posted March 31, 2013 Semi-off-topic, but for small stuff I love this simulator: http://www.falstad.com/circuit/ The attachments work fine. Quote Link to comment Share on other sites More sharing options...
folly Posted March 31, 2013 Report Share Posted March 31, 2013 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. thank you very much! Quote Link to comment Share on other sites More sharing options...
Duggle Posted March 31, 2013 Author Report Share Posted March 31, 2013 One more thing: 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. Quote Link to comment Share on other sites More sharing options...
folly Posted March 31, 2013 Report Share Posted March 31, 2013 Hi! 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 BEST REGARDS Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 1, 2013 Author Report Share Posted April 1, 2013 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. Quote Link to comment Share on other sites More sharing options...
folly Posted April 4, 2013 Report Share Posted April 4, 2013 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. thank! Quote Link to comment Share on other sites More sharing options...
folly Posted April 17, 2013 Report Share Posted April 17, 2013 Hello Duggle! 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? THANK! Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 17, 2013 Author Report Share Posted April 17, 2013 TK does say that the LPC17 analog inputs (as implemented on the core PCB) are very jittery and instead recommends AINSER solutions for pots etc. I've used the LPC17 Ain on my MIDIbox KB modwheel and pitchbender and they seem o.k to me for that purpose. Quote Link to comment Share on other sites More sharing options...
folly Posted April 17, 2013 Report Share Posted April 17, 2013 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. Quote Link to comment Share on other sites More sharing options...
ilmenator Posted April 18, 2013 Report Share Posted April 18, 2013 Sound like jittery AD conversion to me. Duggle offers a solution to this in his last post. You don't need to build a complete AINSER64, a single (well, 8-channel) subset will do - this will be available soon, see In the meantime, you could also DIY something according to this schematic. Quote Link to comment Share on other sites More sharing options...
folly Posted April 18, 2013 Report Share Posted April 18, 2013 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! Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 18, 2013 Author Report Share Posted April 18, 2013 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. Quote Link to comment Share on other sites More sharing options...
folly Posted April 19, 2013 Report Share Posted April 19, 2013 hi ! I think the correction is not a problem. MIDIBOX KB supports Ainser 64? I just need 2 pot. thank! Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 20, 2013 Author Report Share Posted April 20, 2013 (edited) hi ! I think the correction is not a problem. MIDIBOX KB supports Ainser 64? I just need 2 pot. thank! 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). Edited April 21, 2013 by Duggle Quote Link to comment Share on other sites More sharing options...
folly Posted April 21, 2013 Report Share Posted April 21, 2013 HI DUGGLE! 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. thank Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 21, 2013 Author Report Share Posted April 21, 2013 Hi folly, with just MIOS Studio connected to your MIDIbox KB, tell us what midi messages are produced when you move the pitch and modwheel. Quote Link to comment Share on other sites More sharing options...
folly Posted April 23, 2013 Report Share Posted April 23, 2013 hello Duggle.I took pictures. so see the messages that sends modwheel.I noticed that when I move modwhell, the processor of the computer increases the workload of 8-10% so my varranger slows the song.I also use a Korg 01/wpro as a master keyboard, but does not give me problems.I also tried with another computer, and I laid out the problems.thank! Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 23, 2013 Author Report Share Posted April 23, 2013 It looks like the modwheel is outputing CC#1. A quick google tells me this is normal for modwheel. Quote Link to comment Share on other sites More sharing options...
folly Posted April 23, 2013 Report Share Posted April 23, 2013 I made a recording, so I'm feeling problems modwheel. test modwheel.MP3 Quote Link to comment Share on other sites More sharing options...
Duggle Posted April 24, 2013 Author Report Share Posted April 24, 2013 Try routing CC#1 from the MIOS Studio slider to your host via midi yoke. Same? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.