Remork do you mean a function where it reads the 'real' values, adjusts them and saves them - without connecting to a computer?
while such a mapping is certainly necessary, i'm not sure if the values drift over time.. so i would think that once you have the values for all 8 pots in your Pepper, you can use these for every patch afterwards?

Yes, I have thought of the possible variation of voltages in time. [Pot-Init] need to be incorporate in the [ReadAnalog] as an abstraction. You could use the Pot-Initialisation mode only one time and keep use these values for the rest of your life or use the Pot-Initialisation mode every time you power the Pepper.
It works on my computer, but I need to find a solution only with Pepper to store the values to be readable after reboot. On computer, it's easy with the [savestate] object, by saving the parent patch.

Basic operating manual: power on the PEPPER with button 1 engaged, release it after you see the first blink of led bargraph, then fully turn each pot from a side to the other and let them here, in their max or min positions, press button 2 to quit pot-initialisation mode.

    FatJak
    i'm sure it must be possible to save and recall a text file somewhere on Bela.

      by the way, the [else/rescale] object actually allows for inputs greater than its designated values - which actually happens in [else/brown], where you sometimes will get values over 1 after adding the step to [fold]’s output.

      my patch does this as well since it didn’t seem to matter, but it could easily be remedied with a [clip] object.

      Remork i'm sure it must be possible to save and recall a text file somewhere on Bela.

      Good idea. Oups, now I need to learn another language.

        FatJak not my idea 🙂 it's been done before..
        https://forum.pdpatchrepo.info/topic/9887/save-presets-to-textfile/12
        all the way at the bottom is a vanilla patch where settings of parameters are stored in a .txt file.
        i found the [text] object a bit weird to wrap my head around, but it's actually quite easy..
        best start by taking a closer look at its help file.

        you [define] a text in RAM, write to it w/[text set], ideally a single line of text per parameter.
        you can recall each line individually w/[text get], and you can store the full list to a .txt file on disk for later use.

        the actual text can just be lists of numbers for your calculations etc.

        Remork is there any reason why [savestate] wouldn't work on Bela?

        I hope that [savestate] object will work but I don't know how to save the parent patch ([ReadAnalog]) via Pepper.

          Remork is there any reason why [savestate] wouldn't work on Bela?

          Not that I know of. Does it work?

            FatJak because of the ctrl+s command from the keyboard missing, you mean?

            i think you can just send [savestate] a list of the data you want to save.

            giuliomoro
            do you know of the incoming adc~values drifting over time, or with different power supplies etc?
            aka: is there truly a need for such a function?
            i mean, i check and calibrate my pepper patches in the IDE, pulling adc~ values up to "true" 0 - 1 ranges. and then i consider them done and never think about them again. hasn't hurt so far, in practice, but it's an interesting question nonetheless?

              Remork because of the ctrl+s command from the keyboard missing, you mean?

              i think you can just send [savestate] a list of the data you want to save.

              The [savestate] works on my computer because I can do a ctrl+s with the keyboard but not when the Pepper is alone on the rack.
              Sorry, my english is perhaps not good enough to be well understood.

                FatJak no problem! yeah i thought that was what you meant - since pepper doens't have a keyboard 🙂
                but aigain, i think it should work when you just send it a list of things to save.

                9 days later

                @giuliomoro
                Because of different output voltages from the potentiometers (measured with multimeter and viewable via the bela_scope), can you confirm that we have to consider that we could have for exemple 0.15-0.85 ranges in Pd instead of a 0-1 ?
                In this case, what's your advice to calibrate them the simplest way ?
                Does Bela already do the range conversion ?
                I'm working on something but I would like to know if it's a lost of time...

                Edit: It seems that the values on Bela_scope and the measured ones are not the same. Could it be possible ?
                Measures with getting_started Pure Data patch:
                Potx: measured min-max volt./ approx. displayed volt. with bela_scope / approx. ratio
                Pot1: 0.09-4.52 / 0-5.43 / 1.201
                Pot2: 0.09-4.45 / 0-5.38 / 1.209
                Pot3: 0.05-4.52 / 0-5.43 / 1.201
                Pot4: 0.09-4.53 / 0-5.43 / 1.199
                Pot5: 0.08-4.64 / 0-5.58 / 1.203
                Pot6: 0.05-4.49 / 0-5.4 / 1.203
                Pot7: 0.05-4.52 / 0-5.43 / 1.201
                Pot8: 0.07-4.19 / 0-5.05 / 1.205

                Wich one is converted by Pure Data ?

                  FatJak n you confirm that we have to consider that we could have for example 0.15-0.85 ranges in Pd

                  It depends on the tolerance of the passives used in the input stage, where an internal 10V reference (or an external CV) are divided down with a voltage divider: the potentiometer probably has a 10% tolerance and the resistor a 5% tolerance.
                  Potentiometer readings should then be between 0 and 0.98, with a ±15% tolerance on the upper value, clipped at 1. So, depending on the actual resistor values of these components, you may read values slightly above or below 0.98, namely between 0.83 and 1, but most likely closer to 0.98.

                  There is not much that would explain the bottom of the range to be at 0.15 (or 0.09) instead of 0, so if you get 0.15 or 0.09 when the potentiometer is at a minimum, I'd start looking for issues ... is that on all the channels? Do you get any crosstalk between channels? I am wondering whether the connection between the Bela cape and the Pepper PCB is tight enough on the analog in headers... did you use long enough pins there? Can you try squeezing the boards tighter together?

                    giuliomoro It depends on the tolerance of the passives used in the input stage, where an internal 10V reference (or an external CV) are divided down with a voltage divider: the potentiometer probably has a 10% tolerance and the resistor a 5% tolerance.
                    Potentiometer readings should then be between 0 and 0.98, with a ±15% tolerance on the upper value, clipped at 1. So, depending on the actual resistor values of these components, you may read values slightly above or below 0.98, namely between 0.83 and 1, but most likely closer to 0.98.

                    Thanks for these informations.

                    Because the 1 is sometimes useful with Pd (as in this ATTAC506 patch) and because I don't want to use only the half range of the pot putting too much multiplication to reach it or overtake it, I have these questions :

                    • Wich value is converted for Pure Data : the one viewable on the bela_scope (which seems to be upper than 5V (??)) or the one which could be measured with a voltmeter at the CV OUT ? (which seems to be lower than 5V). Knowing this, I could use a more precise multiplication to reach a 0-1 and use the full range of the pot.

                    • What is the formula involved in Bela to convert these voltages to Pd 0-1 ?

                    giuliomoro There is not much that would explain the bottom of the range to be at 0.15 (or 0.09) instead of 0, so if you get 0.15 or 0.09 when the potentiometer is at a minimum, I'd start looking for issues ...

                    (Note: Measures have been done with both eurorack external power and USB plugged)
                    The Pd 0.15 was just an example, as the Pd 0.85, it was just to try to understand why I can't reach 1 (and perhaps 0).

                    giuliomoro is that on all the channels?

                    The non zero minimum is on all the channels, as measured by voltmeter in CV OUT.
                    On the bela_scope, the zero seems to be fine (by eye...)
                    Potx: real measure min-max volt. on CV OUT / approx. displayed volt. with bela_scope / approx. ratio
                    Pot1: 0.09-4.52 / 0-5.43 / 1.201
                    Pot2: 0.09-4.45 / 0-5.38 / 1.209
                    Pot3: 0.05-4.52 / 0-5.43 / 1.201
                    Pot4: 0.09-4.53 / 0-5.43 / 1.199
                    Pot5: 0.08-4.64 / 0-5.58 / 1.203
                    Pot6: 0.05-4.49 / 0-5.4 / 1.203
                    Pot7: 0.05-4.52 / 0-5.43 / 1.201
                    Pot8: 0.07-4.19 / 0-5.05 / 1.205

                    giuliomoro Do you get any crosstalk between channels?

                    (I will try monday.)

                    giuliomoro I am wondering whether the connection between the Bela cape and the Pepper PCB is tight enough on the analog in headers... did you use long enough pins there? Can you try squeezing the boards tighter together?

                    This point seems to be alright.

                      I have these questions :

                      • Wich value is converted for Pure Data : the one viewable on the bela_scope (which seems to be upper than 5V (??) > so, for example, 5,43/5≠1) or the one which could be measured with a voltmeter at the CV OUT ? (which seems to be lower than 5V. > so, for example, 4,52/5≠1).

                      • What is the formula involved in Bela to convert these voltages to Pd 0-1 ? As simple as theoretical voltage / 5 ? Or something more complex ?

                      Knowing this, we could use a formula to reach and overtake 0-1 and use almost the full range of the pot, like this:
                      f(x)=c+(d-c/b-a)*(x-a)
                      with: a=minimum voltage + 5% ; b=maximum voltage - 5% ; c=minimum Pd value (0) ; d=maximum Pd value (1)
                      The percentage is here to be sure to overtake an improbable perfectly stable voltage, it could perhaps be reevaluated.
                      With a [clip 0 1] object after this formula, it coult be easy to have a full 0-1 in Pd and a straight 0 in full anti-clockwise pot and a straight 1 in full clockwise pot.

                        FatJak the one viewable on the bela_scope (which seems to be upper than 5V (??))

                        The Bela scope will show whatever you send to it, so its relation to real-world voltages (if any) is determined by what signals you connect to it.

                        One thing to keep in mind, is that these are the nominal I/O voltage ranges for Pepper Rev1 and Rev2 when configured in the default way, which expects you to run it from ±12V, using the 5V regulator (J14 set to "12V with regulator") and use the on-board 10V voltage reference (i.e.: J16 set to "10V to pots from rack") and set to use the NE5532 for the audio outputs (i.e.: J21 and J22 set to "Amplified audio w/ rack 12V"):

                        • 2 audio in (AC-coupled, 10V pk-to-pk, 44.1kHz, 16bit)
                        • 2 audio out (DC-coupled, -5 to -5V, 44.1kHz, 16bit)
                        • 8x CV in (DC-coupled, 0-10V with pots attenuating, 22.05kHz, 16bit, 12V safe). Optionally, up to 4x of the CV in sockets can be swapped for trigger ins, leaving the pots connected directly to Bela's analog inputs.
                        • 8x CV out (DC-coupled, 0-5V, 22.05kHz, 16bit)

                        This means that if you write a full-scale (0 to 1) output to a CV out (0V to 5V) and loop it back to the CV in, this will correspond to a half-scale reading on the analog input (0 to 0.5). On top of this you need to add the considerations about tolerance mentioned above. That's expected behaviour although it may appear confusing. The rationale behind it is that 0V to 5V is the maximum available voltage at the output without additional amplification and that it was easy enough to get a 0V to 10V input range with just passives. Btw, a different selection of resistors can give different (unipolar) input ranges, see here. Also consider the 5V rail tends to be quite noisy so the useful (less noisy) CV out range is often constrained to something like 0V to 4.8V.

                        For calibration, I'd read the value with the pot at a minimum (again, I'd be surprised if this is more than 0.01 away from 0) and then again with the pot at the max, then this should work:

                        [adc~ 3]
                        |
                        [-~ $1]
                        |
                        [*~ $2]
                        |
                        [clip~ 0 1]

                        where $1 = minReading and $2 = 1 / (maxReading - minReading).

                        FatJak The non zero minimum is on all the channels, as measured by voltmeter in CV OUT.

                        I am not sure I understand this. To test if there is any offset at CV OUT, you should have a patch like this:

                        [sig~ 0]
                        |
                        [dac~ 3]

                        and read the output at CV out 0. I expect that to be very close to 0V. According to the AD5688 datasheet https://www.analog.com/media/en/technical-documentation/data-sheets/AD5628_5648_5668.pdf, figure 28, it should be under 2mV. Then try again with [sig~ 0.96] which should give a nominal out of 4.8V.

                        FatJak Potx: real measure min-max volt. on CV OUT / approx. displayed volt. with bela_scope / approx. ratio

                        It seems that you are conflating a few things here: are you testing with something like this?

                        [adc~ 3]
                        | \  
                        |  [dac~ 27] // scope
                        |
                        [dac~ 3] // out

                        As you see there:

                        • the scope does not display a voltage, but rather a value between 0 and 1, so what's your "approx displayed volt"?
                        • any errors in the ADC range will translate to an offset and scale error on the DAC

                          FatJak we could use a formula to reach and overtake 0-1 and use almost the full range of the pot

                          well, i'm not forcing you to use the calibration patch i linked earlier 🙂
                          is that patch not precise enough for your purposes? i mean, when used correctly, you shouldn't have any noticeable dead spots on the ends of your pot movement - and you most certainly do not need to sacrifice half of your pot rotation.

                          for calibration, it's a bit tedious going back and forth between Pd and the IDE, but once it's done it just works. for me, at least. but if you come up with a better or easier way, i would be most interested, actually!

                            giuliomoro The Bela scope will show whatever you send to it, so its relation to real-world voltages (if any) is determined by what signals you connect to it.

                            Yes, sorry, I forgot to tell that it was just [dac~ x]- - - -[bela_scope], so just reading the pot value by moving it, with nothing connected to the CV IN.

                            giuliomoro FatJak The non zero minimum is on all the channels, as measured by voltmeter in CV OUT.

                            I am not sure I understand this.

                            For the "real" voltage measurement, I just done it by moving the pot and reading the value with a cable plugged in CV OUT and connected to the voltmeter.

                            giuliomoro the scope does not display a voltage, but rather a value between 0 and 1, so what's your "approx displayed volt"?

                            The "approximative displayed voltage" was what I thought to be the out voltage graphically viewable by moving the pot, which I believed was from 0 to max voltage. With this simple patch [dac~ x]- - - -[bela_scope]. So, yes, I was in total conflation.

                            giuliomoro any errors in the ADC range will translate to an offset and scale error on the DAC

                            I’ll try this patch and see what will be output.


                            Thanks again @giuliomoro for all this attention.

                            All this object is a piece of cake of confusion for me (computer to analog and back to data with Pd, hardware settings, IDE settings… Even if all the informations are available). So, sorry if I ask too much questions, if I share confusing experiencies told with approximative english, and if I can't fully understand the given answers.

                            Remork well, i'm not forcing you to use the calibration patch i linked earlier 🙂

                            Well said ! I think I just could find a harder way to do it.
                            Perhaps I didn't understood where to find the right values (individuals min and max voltage depending of the pots) to take as references to do the individual calculations:
                            - Are they the output voltages which could be measured by a voltmeter plugged in the CV OUT ?
                            - Or are they the ones viewable with the bela_scope ? How to determine it with the scope ?