XIAO BLE Sense battery level and charging status

can we get the upgrade of the chip to be addressable via IIC as is done with Coulomb Counter

the sensing of power is very important
this should be much more plug and play

1 Like

Hi Folks (Experts)ā€¦

I came to this thread , wanting to read Read Battery voltage, Turn on LED when charging and Turn on LED to a different color when not charging)ā€¦

Unfortunately, I was not able to decipher all the discussions and make a conclusion. How to do it?
Can anyone please help with an example and Library/Board version that i need to use to accomplish the above?

i am using XIOA BLE SENSE board.
Using 2.9.2 Board version.

What exactly The code i should use?

Appreciate your helpā€¦
thanks
Outkast

Hi there,
You do know that It has an RGB-LED onboard and a charge LED that does that already. ā€œcharging indicatorā€
The issue is the board files SEEED engineering (marketing) puts out without thoroughly testing them. Different files support different non-standard configurations of methods to get the batteries voltage. In some cases additional voltage divider resistors need to be added to work and be able to read the voltage.
Youā€™ll have to read the threads to determine what can work for you. I have several posts with video and code demonstrating different methods and results.
Hereā€™s the hardware view

HTH
GL :slight_smile: PJ

1 Like

Hello guys!
I used this forum to get started with a battery driver/library and I thought I would leave the work I have done here on this forum so other people can have a look at it. The library supports charging, setting the charging speed, reading the battery voltage, and getting the battery capacity in a percentage. Here is the link to the GitHub page: GitHub - Tjoms99/xiao_sense_nrf52840_battery_lib: A battery library for the XIAO BLE Sense (nRF52840).

The project uses the Zephyr RTOS, meaning it is not compatible with the Arduino IDE, but the core functionality of the driver can be used to create an Arduino library. The only difference is how the GPIOā€™s and ADC are configured and used.

For those already familiar with Zephyr, this project is plug-and-play; You donā€™t need to worry about anything except building and flashing the project.

Enjoy guys! -Tjoms

2 Likes

Hi!
Is this assuming that the batteryā€™s BAT+ BAT- are connected to the respective BAT+ BAT- pads on the back of the XIAO Sense for this driver to work? Iā€™m currently using an ā€œexternalā€ PMU for my 3.7V LiPo battery (Solar_Power_Manager_5V_SKU__DFR0559-DFRobot) and it has a dedicated BAT analog pin for battery voltage monitoring. Can I instead connect this BAT pin to the XIAOā€™S BAT+ pad? Thanks in advance.

I think in your case the best is to just power the XIAO via the usb cable from the DFRobot

We are trying to get Seeed to build a power bard specific for XIAO Ecosystem

Maybe I can post this here, since I canā€™t seem to post a new topic from scratch.
I am trying to read the analog battery voltage on SEEED nRF52840 module using pins P0.31 with P0.14 but I am using Circuit Python, not Arduino.

I have not been able to find a document that tells me what the pin definitions for all these functions are in Python, so I cannot assign the pin. I had the same issue with the RGB LED until I found an example.

Is there documentation on the net somewhere that identifies what the pin definitions are?

Hi there,
In the wiki thereā€™s a resources area at the end, the XLS sheet has the pins in it.
If you search micro python pins , you should see where we have seen you use the GPIO numbers to code it up.
HTH
GL :slight_smile: PJ
:v:

If I may ask, do you have a link to that Wiki? I want to make sure I use the correct one.
I am using Visual Studio Code. I am still learning my way around it.

Hi there
Sure,
Hereā€¦ Getting Started with XIAO nRF52840 | Seeed Studio Wiki
look on the right near the bottom, Open the pins sheet. :+1:
GL :slight_smile: PJ
:v:

1 Like

Ah, thatā€™s exactly what I needed. Thanks.

Hi, you can view the pins in REPL console with the following code

import module
dir(board)

you can also use help(board)

depending on configuration you may need (ā€œboardā€)

with the pinout diagramm on the ā€œxiao nrf52840 getting startedā€ seed wiki page, youā€™ll be able to map them

feel free to send me a msg if you need additional or more detailed help

That helped. It got me at least pointed in the right direction. I just had to figure out how to output the dir(board) function to Putty.
I currently cannot debug my code directly on the PC.

Hi, your code was high useful! I only have 2 questions.

  1. You use pin 22 to set battery charge speed to 100mAā€¦ some other people said that the pin is PIN_13, so I got confused (Iā€™m new programing microcontrollers).
  2. About the battery, which voltage indicates full charged battery and which an empty battery? Iā€™m using Lipo 503440 1000 mAh. I dont want to make a mess :slight_smile: