Results 1 to 6 of 6

Thread: Wemos ADC Operation

  1. #1
    Join Date
    May 2007
    Posts
    5,662
    Post Thanks / Like

    Default Wemos ADC Operation

    I'm under the impression that, like most microcontrollers with ADCs, the ESP CPU writes to a hardware register to start an ADC conversion. The ADC conversion finishes some time later, and the 8266 system function system_adc_read blocks during this time interval. I've read somewhere that them maximum conversion rate is on the order of 100 Kps, which would put the system dead-time of about 10uS while the conversion is in progress. How accurate is this understanding? Is there some way for an application (sketch/library) to return immediately after starting the conversion and be interrupted later when the result is available (other than by using a timer interrupt)?
    Phil

  2. #2
    Join Date
    Jan 2021
    Posts
    323
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    I found this for Arduino (looks like a Mega to me):

    void setup(){
    Serial.begin(115200);
    adcAttachPin(35);
    adcAttachPin(25);
    }

    void loop(){
    //start 1 pin for each ADC bus
    adcStart(35);
    adcStart(25);
    //you can check adcBusy(pin), but adcEnd will wait anyway
    uint16_t a0 = adcEnd(35);
    uint16_t a1 = adcEnd(25);
    Serial.printf("ADC: %u, %u\n", a0, a1);
    }


    But I cannot vouch for how that works exactly with Wemos.

  3. #3
    Join Date
    May 2007
    Posts
    5,662
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Thanks, I'll try that out.
    Phil

  4. #4
    Join Date
    May 2007
    Posts
    5,662
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Something seems to be wrong or missing - those three adc functions are all marked as 'not found in this scope' when compiling with the Arduino IDE. They are mentioned lots of times on the web in the context of the ESP32, but the first few google pages don't return any hits wrt the 8266. Perhaps I'm missing some include file.
    Phil

  5. #5
    Join Date
    Dec 2012
    Location
    Newtown CT
    Posts
    5,471
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Did you read this page? The syntax is different than you were using. I used this as a reference for one of my projects.

    https://docs.espressif.com/projects/...erals/adc.html


    2021 New Tune-to sign. New 40x27 matrix at the house. Retiring the Strip based matrix. Updating some of the old window frames to the new house. Adding two new songs.
    2020 Full sized show reworked for the new location. Only adding (famous last words) 13 RBLs that I finally got converted to using pixels
    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show. Dim show (3000 pixels) had regular visits most nights.
    https://www.youtube.com/user/MartinMueller2003

  6. #6
    Join Date
    May 2007
    Posts
    5,662
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Unfortunately, I don't have the 8266 RTOS development software installed. I do assume, however, that the calls to adc_read are non-blocking, so that would be useful.
    Phil

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •