stm32 esp32 adc dac数据记录

使用数字电源Riden  RD6024 输出24v的直流电源

esp32 自带adc(12bit)实测数据:

理论分辨率:3.3V/4096   (默认不衰减,配置衰减系数以扩大量程范围,但是会损失精度)

ESP32芯片的ADC模块提供了不同的衰减系数,以适应不同的输入电压范围。以下是ESP32可用的ADC衰减系数列表:

ADC_ATTEN_DB_0:不衰减,输入电压范围为0到1.00V。
ADC_ATTEN_DB_2_5:衰减2.5dB,输入电压范围为0到1.34V。
ADC_ATTEN_DB_6:衰减6dB,输入电压范围为0到2.00V。
ADC_ATTEN_DB_11:衰减11dB,输入电压范围为0到3.60V。
您可以使用analogSetAttenuation()函数来设置ADC的衰减系数。例如,以下代码将ADC的衰减系数设置为11dB:

Copy
analogSetAttenuation(ADC_ATTEN_DB_11);
需要注意的是,衰减系数越大,输入电压范围就越大,但ADC的精度也会降低。默认情况下,ESP32的ADC精度为12位,但在使用ADC_ATTEN_DB_11衰减系数时,ADC的精度将降低为11位。因此,在选择衰减系数时,需要权衡电压范围和ADC精度之间的关系。

 使用正点原子数字可调电源DP100输出12v直流,使用0603电阻分压,(1/1+11k)

输入电压纹波:(10mv)

在11db的衰减情况下,测量范围0-3.6v,数据如下(理论值1.0909v)

adc_esp32_volts:0.95092
adc_esp32_volts:0.95333
adc_esp32_volts:0.95011
adc_esp32_volts:0.95092
adc_esp32_volts:0.95414
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95333
adc_esp32_volts:0.95011
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95092
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95011
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95011
adc_esp32_volts:0.95011
adc_esp32_volts:0.95172
adc_esp32_volts:0.95333
adc_esp32_volts:0.95011
adc_esp32_volts:0.95253
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.96703
adc_esp32_volts:0.95172
adc_esp32_volts:0.95495
adc_esp32_volts:0.95092
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95011
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95978
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95011
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95092
adc_esp32_volts:0.95495
adc_esp32_volts:0.95817
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95333
adc_esp32_volts:0.95092
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95011
adc_esp32_volts:0.95333
adc_esp32_volts:0.95333
adc_esp32_volts:0.95011
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.94930
adc_esp32_volts:0.95172
adc_esp32_volts:0.94930
adc_esp32_volts:0.95011
adc_esp32_volts:0.95253
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95011
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.94930
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95333
adc_esp32_volts:0.95333
adc_esp32_volts:0.95172
adc_esp32_volts:0.94689
adc_esp32_volts:0.95011
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95011
adc_esp32_volts:0.95011
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95092
adc_esp32_volts:0.95172
adc_esp32_volts:0.95414
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253
adc_esp32_volts:0.95253
adc_esp32_volts:0.95172
adc_esp32_volts:0.95172
adc_esp32_volts:0.95253

 

 

stm32f103c8t6(12bit)实测数据:(校准后)

(fluke电压表实测1.644V)最大误差5mV

ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2041 
PA0 True Voltage value : 1.6444 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2034 
PA0 True Voltage value : 1.6387 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2037 
PA0 True Voltage value : 1.6411 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2037 
PA0 True Voltage value : 1.6411 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2037 
PA0 True Voltage value : 1.6411 
ADC1 Reading : 2041 
PA0 True Voltage value : 1.6444 
ADC1 Reading : 2041 
PA0 True Voltage value : 1.6444 
ADC1 Reading : 2039 
PA0 True Voltage value : 1.6427 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2040 
PA0 True Voltage value : 1.6436 
ADC1 Reading : 2038 
PA0 True Voltage value : 1.6419 
ADC1 Reading : 2034 
PA0 True Voltage value : 1.6387

 

ads精度明显有优势

posted @ 2023-07-14 14:19  为鲸  阅读(260)  评论(0编辑  收藏  举报