Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    About ADC Calibration and usage

    Scheduled Pinned Locked Moved FiPy
    adcadc accuracycalibrationadc precisionfipy
    10 Posts 5 Posters 1.1k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      nervencid
      last edited by

      Hello:

      I'm reading the documentation about ADC:

      https://docs.pycom.io/tutorials/all/adc.html

      And i have a couple of questions:

      1. Shall i calibrate both channels? is necessary to calibrate each pin?
      2. Since some inputs are only for input (otherwise it would damage the board) is not necessary to use them in order to calibrate?
      3. After measures are taken and the calibration process is done. Is necessary to do it again in case of re write the board with other script file?

      Thank you

      mfalkviddM cocoaC E 3 Replies Last reply Reply Quote 0
      • mfalkviddM Offline
        mfalkvidd @nervencid
        last edited by

        Techinically, the calibration is for the internal reference voltage (vref), not for the ADC. Since the same vref is used for both channels and all pins, it is not necessary to calibrate both channels, nor each pin.

        As long as you include adc.vref(your calibration number) in the script, there is no need to redo the calibration. However, each calibration number will be specific to a device, so you'll need to redo the calibration if you switch devices (even if you are using the same script).

        N 1 Reply Last reply Reply Quote 2
        • cocoaC Offline
          cocoa @nervencid
          last edited by

          @nervencid
          ESP32 has the worst ADC on the market. Do not trust on it to make something else than a toy.

          If you need real ADC use an external one.

          Cocoa

          N 1 Reply Last reply Reply Quote 4
          • N Offline
            nervencid
            last edited by

            @cocoa @mfalkvidd Thank you for your answers:

            It seems that the number of the pin measured, is 1090 , so it seems that is very minimum the difference for practicall purposes, anyway i don't have a power source avaible to make an accurate meassure

            cocoaC 1 Reply Last reply Reply Quote 0
            • E Offline
              Elizar @nervencid
              last edited by

              @nervencid There is a lot of noise when reading the ADC. So first, you should take multiple measurements (say, 16 or 32 at least) and calculate the mean value. It's a good idea to switch of the noise sources on your board while measuring, at least everything "wireless" (WLAN, bluetooth, LTE...).

              Secondly you need to do a calibration measurement run. Build a table with two columns: 1) mean value, 2) real value (measured externally by a reasonable good instrument).

              Third, if you don't like to take too many points in step 2, you need to program a simple interpolation between the points (think of something like y=mx+b ...).

              That will give you a quite usable ADC value for most applications.

              N 1 Reply Last reply Reply Quote 2
              • cocoaC Offline
                cocoa @nervencid
                last edited by

                @nervencid
                Hi, see more @ https://github.com/espressif/esp-idf/issues/164, https://esp32.com/viewtopic.php?t=2881&start=30

                1 Reply Last reply Reply Quote 1
                • N Offline
                  nervencid @Elizar
                  last edited by

                  @elizar and @cocoa Hello and thank you for the answer:

                  If i understand the problems of ESP32 is by fabrication and is not possible that they will not correct it in the future (is a pitty due it isn't recommendable for iot).

                  But the unique solution is to make some kind of linearization or interpolation in order to correct it, but i don't know if it works.

                  https://en.wikipedia.org/wiki/Linear_regression
                  https://en.wikipedia.org/wiki/Interpolation

                  But i don't understand very well the concept of attenuation and how work properly with this parameter:

                  attn=ADC.ATTN_11DB
                  
                  robert-hhR 1 Reply Last reply Reply Quote 0
                  • robert-hhR Offline
                    robert-hh @nervencid
                    last edited by

                    @nervencid The attenuation setting change the input voltage range for the ADC. With ATTN_D its is 0-1V, with ATTN_11DB it is ~0-3V. The range of the numbers you read form the ADC is always 0-4095, only at a different input voltage.

                    The factor associated with a dB attenuation number is 10**(dB_number/20). So for 0 it is 1, for 11 it is 3.548, for 6 it is 1.995

                    1 Reply Last reply Reply Quote 0
                    • N Offline
                      nervencid @mfalkvidd
                      last edited by

                      @mfalkvidd Thank you for your answer

                      1 Reply Last reply Reply Quote 0
                      • N Offline
                        nervencid @cocoa
                        last edited by

                        @cocoa Thank you for your answer

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom