1

I've got issues with ESP32 ADC conversion. There is too much noise and interference. For example its measures are flying around for +-50 in normal conditions when the measurement should be constant. In other MCUs such as PIC16F, measures were constant (+-5) for same conditions. Can I guess it is about MCU or I've missed some settings. Here is the code too. Also, when I fully cover sensor lenses, it should give maximum value (4095) but it gives around 3700. Thanks.

void setup(){
   Serial.begin(115200);
   SerialBT.begin(115200);
   pinMode(pin, INPUT);
   analogSetAttenuation(ADC_11db);    //reference 0-3.3V
   analogSetWidth(12);
   delay(1000);
  }


void loop{
    val = analogRead(pin);
     ... other code
 }
1
  • 1
    This depends on your hardware and the signal you're measuring. Note that ADC2 is shared with WiFi, which makes it unreliable. Try to use ADC1 only. Commented Dec 12, 2023 at 8:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.