Learn MoreFAQsTutorials

10 posts / 0 new
Last post
Rajapurerohit
Offline
Last seen:4 months 2 weeks ago
Joined:2017-04-20 09:17
Use SDK battery driver

Hi All,

I am developing a device using DA14583 and which is powered up with 2xAAA cells.

I had gone through a battery driver available in the SDK example, an example is for coin cell and AAA cells.

My question is do I just need to include this battery driver file in my application and read the values? Or Do I need to connect ADC pins for the same?

Thanks and Regards

Rohit R

Device:
PM_Dialog
Offline
Last seen:2 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi Rohit,

Hi Rohit,

Yes, you could add the battery driver in your application - the examples includes how to get the battery lever from 2xAAA batteries

// BUCK mode (2 x AAA batteries in series)

adc_sample = adc_get_vbat_sample(false);

If you read the example, you will see that the battery in not connecte to GPIO – the adc_get_vbat_sample() gets ADC sample from VBAT1V or VBAT3V power supplies using the 20 usec delay.

All you need to do is to embed the SDK example in you project.

Thanks, PM_Dialog

Rajapurerohit
Offline
Last seen:4 months 2 weeks ago
Joined:2017-04-20 09:17
Hi PM_Dialog,

Hi PM_Dialog,

Okay, thank you for the response.

Means, I just need to include file and set "TRUE" in adc_get_vbat_sample(false); function and read the values correct?

Correct me if I am wrong?

Thanks and Regards

Rohit R

PM_Dialog
Offline
Last seen:2 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi Rohit,

Hi Rohit,

You should set it to TRUE if you need to sample the ADC VBAT1V or FALSE if you need to sample the ADC VBAT3V sample. Please run the example in your side first.

Thanks, PM_Dialog

Rajapurerohit
Offline
Last seen:4 months 2 weeks ago
Joined:2017-04-20 09:17
Hi PM_Dialog,

Hi PM_Dialog,

I had tested the code on Dev-kit, dev-kit powered up via USB and I saw that the bat_val is 144% and varies. Attached is the log file.

And it is not stable it varies as you can see in the log file.

Can you please tell why its unstable value not constant?

Thanks and Regards

Rohit R

Attachment:
PM_Dialog
Offline
Last seen:2 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi Rohit,

Hi Rohit,

请参见7.37节电池的例子吗from theUM-B-051 : DA14580 Software Platform Reference (SDK5)/ Please check if you have the same setup.

Did you check the battery selection from BATT_CR2032 to BATT_AAA? - battery_get_lvl(BATT_AAA)

Thanks, PM_Dialog

Rajapurerohit
Offline
Last seen:4 months 2 weeks ago
Joined:2017-04-20 09:17
Hi PM_Dialog,

Hi PM_Dialog,

Kindly note that I have done all the required settings to read the battery from using AAA. while testing I know we need to select BATT_AAA without that I will not get correct reading also. What I shared previously is after doing all changes I am getting results in 147%, 143%, 144% and which not stable also and this I have tested on Dev-kit and Dev-kit was powered up using the USB cable.

And there is no section 7.37 in the mentioned document. Document restricted to 7.2 section.

Please let me know your feedback on my previous post which is regarding unstable values?

Thanks and Regards

Rohit R

CYibin
Offline
Last seen:2 months 5 days ago
Staff
Joined:2017-12-14 02:48
Hi Rohit R,

Hi Rohit R,

Can you share some code snippets so that we can understand your configuration when using battery driver.

In addition, the relevant chapters on battery drive should be: 10.12 Battery Level

Br, Yibin

Rajapurerohit
Offline
Last seen:4 months 2 weeks ago
Joined:2017-04-20 09:17
Hi Yibin,

Hi Yibin,

Please find the attached code.

Thanks and Regards

Rohit R

Attachment:
PM_Dialog
Offline
Last seen:2 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi Rohit,

Hi Rohit,

If you call instead battery_get_lvl(BATT_AAA)of battery_get_lvl(BATT_CR2032) it should work. Can you please test it with the CR2032 ? Also, can you please share how the battery is connected?

// Battery types definitions

#define BATT_CR2032 (1) //CR2032 coin cell battery

#define BATT_CR1225 (2) //CR1225 coin cell battery

#define BATT_AAA (3) //AAA alkaline battery (1 cell in boost, 2 cells in buck mode)

Thanks, PM_Dialog