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

    WiPy2 ADC performance

    Scheduled Pinned Locked Moved WiPy 2&3
    5 Posts 3 Posters 1.3k Views 4 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.
    • J Offline
      jonirons
      last edited by

      Has anyone any experience with audio ADC sample rates on the WiPy2?

      A simple "for loop" doing an ADC read (specifically "adc_c.value()") gives about 15k samples per second (15000 samples in 1048ms).

      I'm hoping that's nowhere near optimal, and would love guidance on getting this to run MANY times faster. I'm hoping to sample 4 channels of audio at 16k samples per second,

      Possible solutions:
      Timer driven callback (not sure how much time is taken by the for loop)
      Initiate sample, and come back in a little while (not sure if this is planned for the API)
      Some sort of direct dump of samples into memory (DMA or something)

      Anyone have any hints?

      Cheers

      Jon

      1 Reply Last reply Reply Quote 0
      • M Offline
        marcmar
        last edited by

        Hi, I'm very interested in what you are doing. Can you explain to me how works your code?

        Thanks

        1 Reply Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh
          last edited by

          The ADC of the ESP32 is very noisy and non-linear. You'll find some discussiona about that. The noise is like +/- 10 LSB. You can get acceptable values by averaging like 1000 samples. For an audio application I would expect nothing but noise and distortion. Better go for an dedicated external ADC.

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            marcmar @robert-hh
            last edited by

            Any suggestion about an external ADC that can sampling audio for Pycom boards?

            1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh
              last edited by

              Actually I did not find one which would suit. Theer are plenty at any quality for the acquiring side, but no device buffers the output, and that is the same problem you have with the internal ADC - accepting and handling the data in real time w/o any loss. Even if you limit the bandwith to e.g. 5 kHz, you have to process 10k samples per channel. at least.

              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