Help with attenuverter with center detent (SOLVED)


#1

Hi,
I need help with coding, I have a dial +/- connected via gpio/analog out to a knob, this knob doesn’t have a center detent, I would modify the dial to obtain a sort of center detent like behavior, in specific if the dial goes from -64 to +64 and the 1 is the center, I would program a tolerance, when the dial is between -5 to 6 the value is equal to 1.
Anyone could help me? I’m not so skilled in coding, I hope to be clear in explaining my task​:sweat_smile:
Many Thanks


#2

Hmm, maybe try out one of the "tiar/kfunc" objects.


#3

Or just buy a potentiometer with center detent. Will be cheaper than spending hours of coding if you lack the experience.


#4

Hi! Look at this patch, maybe it could help, I've hacked a philoop object so if the pot value is 0 both leds are on, between -4 and 0 only the green led is on, between 0 and 4 the red led is on my dial disp.axp (3.3 KB)


#5

You can patch it like this:


#6

thank you all @borututuforte @patatos @MattilynMattroe @janvantomme , I'll try with all your suggestions and keep you in touch on wich solution is the best :slight_smile: cheers :metal:


#8

@borututuforte unfortunately I didn't have this module in my library
@janvantomme actually I didn't find cheap and affordable center detent pots, I'm still searching for it
@patatos grazie angelo (sei italiano vero?:sweat_smile:) con l'ausilio dei led dovrei occupare porte sulla board e devo razionarle :wink:
@MattilynMattroe amazing, applying this simple patch and saving it as a subpatch the implementation was easy and functional!! many thanks for your help :pray:


#9

Good to hear. If you can't find them, better sync your object library (under file / Sync Libraries) - very useful objects.


#10

Probably my patcher version is an older one, never updated, I’m afraid to do it because I know patches of an older version are not compatible in the newer one :sweat_smile:


#11

Thonk has just about any synth part you need. Even different types of shafts.
https://www.thonk.co.uk/shop/alpha-9mm-pots/


#12

@MattilynMattroe I tried to implement the patch to my UI but unfortunately the behavior was unexpected, the control works correctly but the signal coming out is affected by the “tolerance” of the control knob, so I solved a task generating another one :sweat_smile: for example if I process an lfo it cycles between -64 and 64 but near the -5 to 5 interval is constant to 0...and it’s unwanted. Thank you anyway for the suggestion :blush:


#13

Yeah, there will be no change in that range, but wasn't that the purpose? To create a kind of center dead zone for the control so the output value is 1 if the control is between -5 and 6?

Re the lfo - why put it through the mechanism for the control? You could add it to the signal after the mechanism (after the mux 2 and before the display dial in my screenshot) and then it should behave normally, I think.


#14

thank you for your questions :slight_smile: the goal is to have a polarity knob that inverts or not inverts the phase of the lfo and also controls its amplitude (attenuverter) with a center detent without having a center detent knob, problably I'm not enough skilled in patching to obtain it easily and probably the best choice is as suggests @janvantomme to buy some center detent knobs :sweat_smile:


#15

Ah, yeah, that's a bit trickier, I was thinking of a different use...

I was curious so had a play, one of the kfunc objects @borututuforte mentioned gets close, I think this would work (with no modulation between -8 and 8, and inverted when negative). But, that's a fair chunk of knob range to lose, a center detent knob would be much better.


#16

Ah ok, I’ll give a try soon , thank you :blush:


#17

@janvantomme I installed the center detent knobs but there’s an issue, when I move the knob to the center the value vary between -2 to 2 instead of 0, is there a method to apply a tolerance by coding?


#18

These are the screenshots of the actual code


#19

If the offset is constant, just use "math/+c" or "math/-c" to set it right.
If the values change, that's just noise picked up by the analog circuit. If you need to get rid of it, use "kfilter/lowpass" to filter out fast value changes.


#20

I usually add a 100nF ceramic capacitor between the middle pin of the potentiometer and GND to filter out noise.

Remaining noise picked up on the GPIO pin can be filtered with math/smooth. Middle scope simulates the noise of the GPIO, right scope shows the filtered signal.


#21

Thank you both @janvantomme @borututuforte for the tips, I propably missed some details, sorry about that:
In my case the control knob (UI) is connected to the doepfer usb64, usb64 to axo core via usb port, in the patch the knob is mapped to a midi cc, so which is the best way to apply the krate lowpass filter? (I think it could solve this issue, I have already applied krate lpf to gpio inputs but not with midi inputs)
Actually my patch is at the limit of SRAM overflow and I have already optimized it (left to right, top to bottom placement of the objects) so I can’t add too many modules :sweat_smile: thank you for your support