cancel
Showing results for 
Search instead for 
Did you mean: 

how to stabilize ADC output

QurioTakeuchi
Associate II

we are reading pH sensor by using nucleo 32L746RG.

even though both VDD and sensor value looks stable on tester like 3.3v+-0.1mv/ 2v+- 1mv, the adc value shows about 10% up/down around the true value.

the adc value seems to repeat increasing and decreasing in about few minutes.

could you please advise possible cause of the problem above?

followings are our adc setting;

 hadc1.Instance = ADC1;

 hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;

 hadc1.Init.Resolution = ADC_RESOLUTION_12B;

 hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;

 hadc1.Init.ScanConvMode = ADC_SCAN_DISBLE;

 hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

 hadc1.Init.LowPowerAutoWait = DISABLE;

 hadc1.Init.ContinuousConvMode = DISABLE;

 hadc1.Init.NbrOfConversion = 1;

 hadc1.Init.DiscontinuousConvMode = DISABLE;

 hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;

 hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

 hadc1.Init.DMAContinuousRequests = DISABLE;

 hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;

 hadc1.Init.OversamplingMode = DISABLE;

 if (HAL_ADC_Init(&hadc3) != HAL_OK)

 {

  Error_Handler();

 }

 /** Configure the ADC multi-mode

 */

multi.Mode=ADC_MODE_INDEPENDENT;

if(HAL_ADCEX_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK

{

Error_Handler();

}

 /** Configure Regular Channel

 */

 sConfig.Channel = ADC_CHANNEL_11;

 sConfig.Rank = ADC_REGULAR_RANK_1;

 sConfig.SamplingTime = ADC_SAMPLETIME_640CYCLES_5;

 sConfig.SingleDiff = ADC_SINGLE_ENDED;

 sConfig.OffsetNumber = ADC_OFFSET_NONE;

 sConfig.Offset = 0;

 if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)

 {

  Error_Handler();

 }

5 REPLIES 5
Javier1
Principal

did you measured the PH sensor signal output with an oscillocope? did you fing the same wavy behaviour?

How is your ground between the ph sensor and the stm32 connected?

Show us

we dont need to firmware by ourselves, lets talk
QurioTakeuchi
Associate II

Thank you for your message.

yes, we measured sensor voltage with occilloscope.

Sensor is ​insulated.

so the ground doesn't connected to stm32.

QurioTakeuchi
Associate II

between the sensor and stm32, there are isolation-amplifier.

>we measured sensor voltage with occilloscope.

Great, did you noticed the same ondulations?

we dont need to firmware by ourselves, lets talk

I bet you have a groundig issue, if you share the schematics maybe we could help you further

we dont need to firmware by ourselves, lets talk