7 posts / 0 new
Last post
Stone_wang
Offline
Last seen:9 hours 52 min ago
加入:2015-10-23 03:55
Question about ADC .

Hi Dialog ,
I am use SDK: 3.0.6
The attatch file xx.jpg is my schematic diagram and the battery (form 0.9v - 1.45v) information ,
I want to use the battery serves :
I have question about get ADC sample . I add code like this :

adc_init(GP_ADC_SE, GP_ADC_SIGN);
adc_enable_channel(ADC_CHANNEL_VBAT1V);
adc_sample = adc_get_sample();

And I get Some Value :
Voltage Value
1.283V adc_sample = 355
1.319V adc_sample = 363
1.552V adc_sample = 431
1.272V adc_sample = 350

Q1:
10bit Adc , (1.283 / 355 ) * 1024 = Reference Voltage = 3.6921 V ?
Q2:
I had See the battery.c file , Why shift right 4 then shift left 4 ?
adc_sample >>= 4;
adc_sample <<= 4;

附件:
Device:
MT_dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2015-06-08 11:34
Hi Stone_wang,

Hi Stone_wang,

1) The adc has a reference voltage of 1.2V if the 3x attenuator is enabled then you can measure up to 3.6V. Please check the datasheet for more information.

2) The code that you are refering to is to eliminate the burr of the aquired data. A plain filter just to keep tha data steady.

Thanks MT_dialog

Bharath
Offline
Last seen:1 year 5 months ago
加入:2016-04-14 07:03
Hi MT_dialog,

Hi MT_dialog,

In the above comment what do you mean by "eliminate the burr of the acquired data"? Does it mean the effective bits of the ADC is only 6 out of 10?

Thanks
Bharath

MT_dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2015-06-08 11:34
Hi Bharath,

Hi Bharath,

In previous battery drivers we were using this in order for the aquired measurements not to jump up and down by discarding the last 4 bits, this is not used anymore in recent battery drivers, different filters are used in order to aquire the battery measurements. The fact that the last 4 bits were removed from the measured value doesn't mean that the effective number of bits of the ADC as a module are only 6 bits, we just wanted to have an indication of the battery level and not the exact value so we applied the above method.

Thanks MT_dialog

Bharath
Offline
Last seen:1 year 5 months ago
加入:2016-04-14 07:03
Can you explain more about

Can you explain more about the "different filters are used" in your above comment.
In our application, we are reading a voltage from a battery and a 10K voltage divider, we are observing a of variation in the ADC read values by 12.
For 2V we are reading min= 564 to max=576 when sampled at 250sps.
If we sample at 1ksps, we are reading min=564 to max=567.
If we want to use BLE, 250sps is the maximum sampling we can use so that there wont be any loss.

Now, why there is 3 to 4 bit error when sampling at 250sps? How to solve this error or how to reduce this error?

MT_dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2015-06-08 11:34
Hi Bharath,

Hi Bharath,

There are quite some methods in correcting the errors of an ADC and getting more accurate values, which are out of the scope of the forum, you can either have a look at the filters used in the new battery example or check how to improve your measurements by checking different kinds of methods on line.

Thanks MT_dialog

Bharath
Offline
Last seen:1 year 5 months ago
加入:2016-04-14 07:03
The filter functions are

The filter functions are altering the shape of analog signal. Also take some time to settle when there is a change in the signal.