Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Wemos ADC Operation

  1. #1
    Join Date
    May 2007
    Posts
    5,853
    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
    645
    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,853
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Thanks, I'll try that out.
    Phil

  4. #4
    Join Date
    May 2007
    Posts
    5,853
    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,874
    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


    2022 - Not sure yet. At least two new songs.
    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,853
    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

  7. #7
    Join Date
    Dec 2011
    Posts
    7,636
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Giving this a shake for updates

  8. #8
    Join Date
    May 2007
    Posts
    5,853
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    I've got all of the parts, just have to get to it. I've got too many half-finished projects in the works, including my first 3D printer arriving tomorrow.
    Phil

  9. #9
    Join Date
    Feb 2009
    Location
    Plymouth, MN
    Posts
    9,520
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    Quote Originally Posted by P. Short View Post
    I've got all of the parts, just have to get to it. I've got too many half-finished projects in the works, including my first 3D printer arriving tomorrow.
    Uh-oh.... now you're doomed... all of your spare time will be used up by that printer...

    http://digwdf.org/store/
    Even though the DIGWDF Store has been closed for almost three years, it's still awesome!
    User guides, documentation and other files are still free and available for downloading.

  10. #10
    Join Date
    Jun 2015
    Posts
    96
    Post Thanks / Like

    Default Re: Wemos ADC Operation

    The ESP8266 ADC is useless for me, it only accept 0-1v and noisy, using voltage divider knocking down to that level and not enough scaling. I use ADS1115 when I need ADC on the ESP8266.

Page 1 of 2 12 LastLast

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
  •