Questions and discussions about the software that runs on the TD RF module itself.
Posts: 22
Joined: Tue Jun 09, 2015 2:31 pm

volatge measurement on ADC0 pin

by Capture Mon Jul 06, 2015 8:23 am

I written the program for measuring the voltage in ADCO pin by considering the 5V DIFF as reference after compiling it is displaying 1.4 V only but if i measure the same pin by using micrometer it is displaying 3.7V ,i did lot of modification to solve this issue but still encountering the same issue so can anyone suggest me how to solve this problem ?

(// Print out current Battery sataus
tfp_printf("adc0 pin viltage:%d mV\r\n",
Thank you in advance
User avatar
Posts: 168
Joined: Thu May 07, 2015 9:24 am

Re: volatge measurement on ADC0 pin

by mstempin Mon Jul 06, 2015 9:06 am

The 5V DIFF ADC mode is measuring the difference between the + and - SAR ADC inputs.

You are using ADC0 as first input (ADC0_CH6), but the second input defaults to internal +1.25 V reference. However, the TD_MEASURE_SingleVoltage() function initialize the ADC structure in single-ended mode, thus the strange result.

Also, be careful not to exceed the maximum GPIO voltage on these pins (+3.8V).

If measuring voltage from a LiPo battery that can go up to +4.2 V, I strongly suggest to use a voltage divider to bring the measured voltage down to reasonable values and use a non-differential ADC range within the recommended voltage range < +3.8 V. For example, you can use 2x high same value (a few Mohms) 1% resistors between VCC and GND, and connect the middle point to ADC0 input, then multiply converted value by 2.
Posts: 22
Joined: Tue Jun 09, 2015 2:31 pm

Re: volatge measurement on ADC0 pin

by Capture Mon Jul 06, 2015 10:23 am

i have changed the reference to adcRef 1V25 and then it is displaying the output 4096mV (4.2v IN EVALUATION BOARD)
// Print out current ADC0 VALUE
tfp_printf("adc0 pin voltage:%d mV\r\n",

and for Aadcref5VDIFF it is displaying 1935mV(2v without connecting the battery)

I really dont understand this problem and can you please suggest me some ways to find the correct solution for this problem

Thank you
Return to Firmware

Who is online

Users browsing this forum: Bing [Bot] and 1 guest