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:
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
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
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
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?
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
The filter functions are altering the shape of analog signal. Also take some time to settle when there is a change in the signal.