XU4 - Battery level

Moderators: mdrjr, odroid

XU4 - Battery level

Unread postby tgleichger » Mon Feb 05, 2018 6:30 pm

Hi Guys,

I wanted to know if there is an SoC on the XU4 and how to activate it.
I am using XU4 + Lithium-ion battery, is there a way to get battery level readings?


Best Regards
T
tgleichger
 
Posts: 7
Joined: Mon Feb 05, 2018 6:29 pm
languages_spoken: english
ODROIDs: XU4

Re: XU4 - Battery level

Unread postby odroid » Mon Feb 05, 2018 6:41 pm

There is no battery gauge function on the XU4 board.
If you can adjust the Li+ battery voltage output range to lower than 1.8Volt with two resistors divider, you can use the ADC input on the 30pin header to measure the voltage.
https://wiki.odroid.com/odroid-xu4/hard ... connectors
https://wiki.odroid.com/odroid-xu4/appl ... e/gpio/adc
User avatar
odroid
Site Admin
 
Posts: 28490
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Battery level

Unread postby tgleichger » Sun Feb 11, 2018 10:13 pm

I did what you explained, my resistors output 1.61 at full charge (v), I connected to pin 23.

The results are moving between 2700-3400, they are not always consistent. i am reading directly from the file

cat /sys/devices/12d10000.adc/iio:device0/in_voltage3_raw

Do you think I might did something wrong?
tgleichger
 
Posts: 7
Joined: Mon Feb 05, 2018 6:29 pm
languages_spoken: english
ODROIDs: XU4

Re: XU4 - Battery level

Unread postby odroid » Mon Feb 12, 2018 11:16 am

What is the maximum voltage on your battery pack?
Which resistor values did you choose?
I think they must be higher than 50Kohm.
Adding a 0.1~0.01uF capacitor on the lower side resistor(parallel) might be helpful to reduce the batter noise too.
User avatar
odroid
Site Admin
 
Posts: 28490
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Battery level

Unread postby tgleichger » Mon Feb 12, 2018 3:35 pm

The battery maximum capacity is 12.55
The resistor maximum output is 1.61V

I used one 100KH and one 680KH resistors
tgleichger
 
Posts: 7
Joined: Mon Feb 05, 2018 6:29 pm
languages_spoken: english
ODROIDs: XU4

Re: XU4 - Battery level

Unread postby odroid » Mon Feb 12, 2018 3:59 pm

The resistor values seem to be fine.
Connect a DMM to #23 on the 30pin header and measure the voltage.
User avatar
odroid
Site Admin
 
Posts: 28490
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Battery level

Unread postby tgleichger » Mon Feb 12, 2018 10:23 pm

Image
https://imgur.com/a/1Mq7F
This are the results im getting. i checked the voltage on the 23 pin and it is OK.

The results that you are seeing are every 5-10 seconds (on my demand).
sometimes it goes down to 2900 and then back to 3100-3200-3000-3050 etc.

Battery is fully charged
tgleichger
 
Posts: 7
Joined: Mon Feb 05, 2018 6:29 pm
languages_spoken: english
ODROIDs: XU4

Re: XU4 - Battery level

Unread postby odroid » Tue Feb 13, 2018 11:01 am

Since we have 12bit ADC, its resolution must be 440 microVolt approximately.
If the ADC values difference is 200, the voltage difference is around 80mV.
So it seems to be normal if the battery voltage varies by the XU4 CPU load.

BTW, did you add a capacitor?
User avatar
odroid
Site Admin
 
Posts: 28490
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Battery level

Unread postby tgleichger » Tue Feb 13, 2018 5:22 pm

No i didn't, do you think it should be better with a capacitor?
tgleichger
 
Posts: 7
Joined: Mon Feb 05, 2018 6:29 pm
languages_spoken: english
ODROIDs: XU4

Re: XU4 - Battery level

Unread postby odroid » Tue Feb 13, 2018 6:06 pm

I think so.
But 80mV swing seems to be fine to measure the Lithium battery voltage.
User avatar
odroid
Site Admin
 
Posts: 28490
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Battery level

Unread postby joerg » Tue Feb 13, 2018 8:27 pm

I think the values of 680k and 100k are very high. Consider to use factor 10 or 20 smaller values. Remember that the switching components on the board are emitting disturbances and as higher the resistors as more sensible the measurement. Also, as @odroid says, a capacitor should be used.
How far away is the resistor network from 40p header? As short as possible should be. Also other devices in the near as smart phones can produce disturbances. If nothing helps, a digital filtering is the last choice. The discharging curve of a battery is over hours, so it can be filtered heavily.
joerg
 
Posts: 797
Joined: Tue Apr 01, 2014 2:14 am
Location: Germany
languages_spoken: german, english, espaƱol
ODROIDs: C1, C1+, C2

Re: XU4 - Battery level

Unread postby tgleichger » Thu Feb 15, 2018 4:48 pm

OK, i didnt change anything but applied Kalman Filter, and it now works perfect.

Thanks for your advices.
tgleichger
 
Posts: 7
Joined: Mon Feb 05, 2018 6:29 pm
languages_spoken: english
ODROIDs: XU4

Re: XU4 - Battery level

Unread postby Rutherf0rd » Mon Aug 13, 2018 8:00 pm

tgleichger wrote:OK, i didnt change anything but applied Kalman Filter, and it now works perfect.

Could you please share your implementation of Kalman filter?
Rutherf0rd
 
Posts: 11
Joined: Fri Jul 27, 2018 3:24 pm
languages_spoken: singlish
ODROIDs: XU4 x VU5 w/ Kali Linux


Return to Ubuntu

Who is online

Users browsing this forum: No registered users and 3 guests