Hi guys,
I met a problem. I am trying to use NHS3152 to measure resistance.
R0 = 8200;
R = 3900;
VDD = 3300 mV
The strange thing is the resistance R = 3069.49, not 3900. The ADC value was 898.8 mV (Native value: 2301 ). Is there any problems of the ADC configuration and IOCON? I don't understand where the error is.
Code is :
- Init ADC
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_ANA0_3, IOCON_FUNC_1); /* Set pin function to analog */
Chip_ADCDAC_Init(NSS_ADCDAC0);
Chip_ADCDAC_SetMuxADC(NSS_ADCDAC0, AN3);
Chip_ADCDAC_SetInputRangeADC(NSS_ADCDAC0, ADCDAC_INPUTRANGE_WIDE);
Chip_ADCDAC_SetModeADC(NSS_ADCDAC0, ADCDAC_SINGLE_SHOT);
- Get val
float res;
int vdd_input = 3300; //Input voltage
int r_0 = 8200; //Pull-up Resistor
Chip_ADCDAC_StartADC(NSS_ADCDAC0);
while (!(Chip_ADCDAC_ReadStatus(NSS_ADCDAC0) & ADCDAC_STATUS_ADC_DONE)) {
; /* Wait until measurement completes. For single-shot mode only! */
}
adcInput = ((float)Chip_ADCDAC_GetValueADC(NSS_ADCDAC0) * 1600) / 4096;
res = ((float)r_0 * adcInput)/ ((float)vdd_input - adcInput);
Solved! Go to Solution.
Hi Wenyang,
Thanks for the clarification! this issue is related with the measuring method, due to some special feature of the ADC module, it is only recommend using the method from the data sheet just as above, and we provide a reference code for that purpose , please kindly refer to app_demo_dp_tadherence project in the SDK for details. The sample code can be found in "/app_demo_dp_tadherence/mods/sense/resistive/sense_resistive.c".
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hello Wenyang,
Your conversion formula to convert from native value to micro volt uV is not correct. It is a bit more complicated:
output in uV = ((native value - native offset) * internal operating voltage / steps per uV) + offset
Plugging in the values for a wide measurement:
I get a converted measured voltage of a little over 1V, which gives a resistor value for R of a little over 3500. Better, but not correct yet. What is the tolerance on your chosen resistor?
Kan 's response here is to be taken to heart: the NHS3152 cannot be used as an accurate generic voltage measurement device. Reason for this is that the saturation of the ADC block sets in too early at the extremities. It is well suited for therapy adherence monitoring and logging. In such cases it can reliably monitor changes and after a calibration step, pill intakes can be monitored accurately, with minimal external components.
Kind regards,
Dries.
Hi Wenyang,
If I understand correctly, VSS is the ground signal, right?
so I think this issue might be due to the measuring method, and we provide a reference in the data sheet, please refer to the following for details.
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kan,
Sorry, I made you feel confusing. I put the wrong label there, Vss is reference voltage, here should be Vdd.
Hi Wenyang,
Thanks for the clarification! this issue is related with the measuring method, due to some special feature of the ADC module, it is only recommend using the method from the data sheet just as above, and we provide a reference code for that purpose , please kindly refer to app_demo_dp_tadherence project in the SDK for details. The sample code can be found in "/app_demo_dp_tadherence/mods/sense/resistive/sense_resistive.c".
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------