556 views|6 replies

101

Posts

1

Resources
The OP
 

FireBeetle 2 ESP32 C6 Development Board _ADC Module Test [Copy link]

 

This time, let’s test the ADC of ESP32

1. MCU uses 3.3V power supply

2. Use a potentiometer to provide a signal

3. Test the code

void setup() {
  // initialize serial communication at 115200 bits per second:
  Serial.begin(115200);
  
  //set the resolution to 12 bits (0-4095)
  analogReadResolution(12);
}

void loop() {
  // read the analog / millivolts value for pin 2:
  int analogValue = analogRead(2);
  int analogVolts = analogReadMilliVolts(2);
  
  // print out the values you read:
  Serial.printf("ADC analog value = %d\n",analogValue);
  Serial.printf("ADC millivolts value = %d\n",analogVolts);
  
  delay(100);  // delay in between reads for clear read from serial
}

4. Test situation

Voltage value

AD value

3.3

3344

2.38

2382

2.03

2033

1.70

1701

1.00

1002

This value is very strange. 3,3V should be 4095, why is it 3344? It seems to have been transformed. Does anyone know what's going on?

Latest reply

Yin Xiaozhou published on 2024-5-8 13:40 I found this function. Is it related to it? How to use it? It should be that if this is not set, the default is DB_11. Although it can only test below 3.3V, the reference is 3.9V. In this way, 3.3V is more than 3000. [attach]808160[/attach]   Details Published on 2024-5-13 09:51
 
 

1w

Posts

25

Resources
2
 

Is the ADC attenuation set?

Comments

I haven't used attenuation on Arduino either, is there a setting for this?  Details Published on 2024-5-8 13:24
 
 
 

101

Posts

1

Resources
3
 
dcexpert posted on 2024-5-8 11:27 Is the ADC attenuation set?

I haven't used attenuation on Arduino either, is there a setting for this?

 
 
 

101

Posts

1

Resources
4
 

I found this function. Is it related to it? How to use it?

Comments

It should be that if this is not set, the default is DB_11. Although it can only test below 3.3V, the reference is 3.9V. In this way, 3.3V is more than 3000.  Details Published on 2024-5-13 09:51
 
 
 

101

Posts

1

Resources
5
 

Strange, strange

 
 
 

1w

Posts

25

Resources
6
 

The ADC of ESP32 is slightly different from other MCUs and a little more complicated. There seems to be a calibration function for accuracy.

 
 
 

6062

Posts

4

Resources
7
 
Yin Xiaozhou published on 2024-5-8 13:40 I found this function. Is it related to it? How to use it?

It should be that if this is not set, the default is DB_11. Although it can only test below 3.3V, the reference is 3.9V. In this way, 3.3V is more than 3000.

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list