Hello, I just tried the Capacitor solution (I used a 2220µF capacitor) and it works well well well for the disturbance
Obviously, I used It In muxed mode on the 4051 entries !
It’s quite unstable so it always sends midi events, As you said maybe I should use A low pass filter, I tried just one low pass with what I had as resistor and capacitor (without calculing any frenquency cut …) and, as you will guess, the reactivity of the GP’s was a lot more slowed …
I think this is because of the too low frequency cut of my bad low pass filter, but I don’t really think I need one , I explain my solution :
A choosed The same 4051 entry for A potentiometer AND the GP, and I can switch to each one with a switch … so when I want to use the GP, I switch to it, and I barely use only It and maybe one other potentiometer (I looked In midi studio, the messages of the potentiometer still arrive thought the GP send continuous data)
And when I don’t use the GP, I switch to the potentiometer, so It is more stable …
I’ll try some better value of Frequency cut, but I certify that for What I use the GP (Guitar Effects) the rapidity is really enought (without the low pass filter)
I also thought of ultra sonic sensors, but I wondered if it could be perturbed with sounds (ultra) in a concert or by the environment ??
Now I’ve got to go through this part :
But back to your problem:
getting good values from the GP has different problems - the output curve is (kind of) negative logarithmic, starts at around 3V and goes only down to around 0.4V. A major problem is that in the second half of measurable distance, the curve is so flat that you´d need a really good analog and A/D cirquit design to still get a good resolution. I took the pure software approach to get usable values:
-
Look at the data sheet figure - a minimum distance of about 4 cm gives 2.5V output. The sensor can only measure down to 3 cm, so I sacrificed this one cm to get an easy solution. The PIC does 10 bit conversion. 2.5V is half of the maximum value (5V), so I just stripped the highest bit - a 9-bit value remains.
-
Especially with the jitter problems of the GP, the lowest bit is only meaningless crap anyway, so just right-shift the 9-bit value one bit. Now we´ve got an 8 bit value that still contains (most of) the relevant information, but is way easier to deal with.
-
Now comes the tricky part. You need to linearize this distance information. There is some division involved, but divisions consume a lot of processor time on a microcontroller, so the best way is to calculate the result for all possible values and use a lookup table. If the precision has to be really good, you can afterwards setup a measuring experiment, e.g. a ruler lying on the floor in front of a wall. So you can move the GP above the ruler and compare the output value with the real distance and make some corrections to your table.
The programming part was not too hard in my case because the GPs were the only analog controllers. So you can just jump in at the point where MB64 acquires the A/D values and change everything to your needs. If you want to have both GPs and “normal” potentiometers/faders in one box, it gets a bit complicated…
thanks a lot for the advices !!
Unfortunately, I’m using It with other potentiometers of the AIN module … I know a little bit of programming, but I don’t know what’s a scaling routine … can somebody Help me on this topic ? Has it got to be modified in the MIOS or in the Midi box program ?
I don’t really need to linearize the caracteristic, It’s some part of the musical instrument, I can adapt myself to the instrument, but what i really need is the first and second steps you describe, a better resolution of the upper values …
I don’t have got the time to do all this work by now, I will be able to do all this only this summer … unless I doesn’t need too much time ?
Thanks for all I hope it’ll help futur people using GP’s