Best way to throttle based on temperatures

Michael Mrozek EvilDragon at openpandora.org
Sun Dec 20 20:39:18 CET 2020


On Mo, 2020-11-02 at 08:37 +0100, H. Nikolaus Schaller wrote:

Hi,

I'm working now actively on that script, but... the more I work on it,
the more I think the resistor values are not correctly chosen.

Here are some of the investigations I did:

1. The battery usually is 3°C less than the reported battery
temperature. I tried that multiple times: Removed the battery and
measured it with my infrared scanner device.

2. When the system is being actively used (without any power supply
attached), the temperature for the battery often reaches around 45 -
47°C (internal temperature) Which would mean you can't even charge it
anymore! The battery would still be at 42°C, so still fine.

3. Charging with 45°C or higher, the battery starts to die faster - but
it's far below a critical level, so having 6°C more would make a
difference.

4. My script already changes the cpu speed based on Core and Battery
temperature and manages to keep the battery on 45°C (so 42°C in real)
even with the high-load script. I'll add charger-current limitations as
well, but with 45°C, charging would already be disabled by the charger
chip....

5. The current setup could lead to the problem that the battery can't
even be charged on a hot summer day...

What do you think?



> > Am 01.11.2020 um 23:06 schrieb dave <dave at ds0.me>:
> > 
> > One last thought. Looking at the PALMAS datasheet it appears it can
> > programmably source 5, 10 or 15uA out of the GPADC0 pin. Not sure
> > if this will make much difference as I haven't done the calcs, but
> > it might at least compensate for the loading of the ADC divider?
> 
> Ah, intersting! I wasn't aware of that. Hm. It could help to
> compensate - or make things worse (and even more difficult to
> calculate...).
> 
> Let's make an assumption that the voltage at the TS pin of the
> bq24297 is 2V. Then, the voltage divider R2001+R2002 draws ca. 15µA
> from the TS pin and pulls it weakly down. This shifts the voltage fed
> into the bq24297 and the thresholds are at different temperatures.
> 
> So turning on the 15µA source might roughly compensate for this. So
> having this connected to gpadc0 by accident (should have been gpadc1)
> may have the positive effect of a tricky workaround...
> 
> > 
> > -------- Original message --------
> > From: "H. Nikolaus Schaller" <hns at goldelico.com>
> > Date: 01/11/2020 20:12 (GMT+00:00)
> > To: Michael Mrozek <EvilDragon at openpandora.org>, dave <dave at ds0.me>
> > Cc: kernel at pyra-handheld.com
> > Subject: Re: Best way to throttle based on temperatures
> > 
> > 
> > > Am 01.11.2020 um 19:43 schrieb dave <dave at ds0.me>:
> > > 
> > > For the sake of the calculations, do you know the details of the
> > > thermistor in the battery? Is it a regular 10k NTC?
> > 
> > Good question. I have no data sheet of the battery and always
> > assumed that it is a standard 103AT (10kΩ).
> > This is also what the example in the data sheet assumes.
> > 
> > In the meantime I have worked on a spreadsheet that does the
> > calculations and even more important allows to reverse them (those
> > formulae are quite complex).
> > So I can now check what specific resistor values with or without
> > the voltage divider for the Palmas gpadc have as temperature
> > thresholds.
> > 
> > It turns out that the divider has some influence which reduces the
> > threshold from 45°C to 42°C.
> > And when choosing an existing value for R709 it was rounded up a
> > little too far when trying to compensate for the gpadc connection.
> > 
> > So from this calculation the COLD and HOT thresholds should be ca.
> > -8°C and 42°C instead of 0°C and 45°C as planned and assumed for
> > the data sheet values.
> > 
> > Removing R2001/R2002 and the path to the Palmas GPADC would move
> > both limits upwards but much less than I had thought. Just to -4°C
> > and 44°C.
> > So by the palmas connection we are only 2-4° off. A better resistor
> > value for 50°C limit would be R709 = 4k42 (1%) and for 45°C it
> > would be 4k1 (you see the small difference of just 8%).
> > 
> > What I don't know is the influence of tolerances and component
> > variation which could easily be another 1-2°.
> > 
> > @ED: would you like to build a test setup?
> > 
> > idea:
> > 1. take some tape and cover the middle battery pin (NTC)
> > 2. take a 10k or better 50 kOhm potentiometer (maybe a logarithmic
> > one is better) and connect it by two tiny wires to the Pyra main
> > board.
> >    There are two spare solder points to access the NTC above the +
> > connector pad (originally I had added them to more easily test the
> > board/charger without battery).
> >    This allows to tell the bq24297 fake news about the battery
> > temperature.
> >    Alternatively you could use a real 103AT NTC plus hot/cold water
> > and a thermometer
> > 3. then choose 10kΩ which simulates 25°C and charging should work
> > fine
> > 4. 45°C is 4.9k, 50°C is 4.1k - i.e. reduce the virtual battery
> > temperature and check when it turns off
> >    or determine the real resistance
> > 5. you can do the same in the other direction to find the COLD
> > value (0°C = 27k, -10° = 42k)
> > 
> > > 
> > > -------- Original message --------
> > > From: Michael Mrozek <EvilDragon at openpandora.org>
> > > Date: 01/11/2020 18:34 (GMT+00:00)
> > > To: dave <dave at ds0.me>, "H. Nikolaus Schaller"
> > > <hns at goldelico.com>
> > > Cc: kernel at pyra-handheld.com
> > > Subject: Re: Best way to throttle based on temperatures
> > > 
> > > On So, 2020-11-01 at 18:18 +0000, dave wrote:
> > > 
> > > Okay, then let's calculate with 45C.
> > > 
> > > When proper heat management is built-in, it still should be good
> > > enough.
> > > 
> > > > I would advise against setting it too high (personally I would
> > > > aim
> > > > for 45 degrees ish). Smartphones can charge hotter because they
> > > > (a)
> > > > have a design lifespan of <2years and (b) almost certainly
> > > > dynamically control current based on voltage and temperature -
> > > > whereas afaik the bq charges at full current until it reaches
> > > > the
> > > > threshold and then turns off.
> > > > 
> > > > -------- Original message --------From: Michael Mrozek
> > > > <EvilDragon at openpandora.org> Date: 01/11/2020  16:01 
> > > > (GMT+00:00) To:
> > > > "H. Nikolaus Schaller" <hns at goldelico.com> Cc: dave <
> > > > dave at ds0.me>,
> > > > kernel at pyra-handheld.com Subject: Re: Best way to throttle
> > > > based on
> > > > temperatures On So, 2020-11-01 at 16:28 +0100, H. Nikolaus
> > > > Schaller
> > > > wrote:Hi,> > > The critical temperature for LiIon batteries are
> > > > around 60C - so> > the resistors should be changed to set the
> > > > critical temperature to> > around 50C.> Ok, I'll dig into the
> > > > data
> > > > sheet section and formula (unless there is> a volunteer who can
> > > > do
> > > > that faster than me) so that you can test.> Yes, it is for
> > > > battery
> > > > protection (during charging and operation),> not for system
> > > > over
> > > > temperature protection.If you let me know the formula, I can
> > > > try to
> > > > calculate it.Shouldn't excel be able to do that or is that
> > > > formular
> > > > too complicated?:OBut yeah: Critical is basically the same here
> > > > as it
> > > > is with the OMAP5critical temperature:It should only trigger
> > > > when all
> > > > other safety measures have failed. :)> > > > The operational
> > > > temperature is 15 - 45C, but that's not the> > critical one.> >
> > > > > > A
> > > > critical shut off should happen if the system is not able to
> > > > keep> >
> > > > the temperature low enough itself, but that's what a
> > > > temperature> >
> > > > monitor should do.> > > > So I'll tell GC to stop the
> > > > production
> > > > right now and I'll test new> > resistor values.Hopefully we
> > > > need to
> > > > increase a value, as stacking> > a resistor on top would be
> > > > faster
> > > > than replacing it with a lower> > one... and I probably need to
> > > > do
> > > > this with over 100 PCBs...> > > > On 1 November 2020 15:43:56
> > > > CET,
> > > > "H. Nikolaus Schaller" < > > hns at goldelico.com> wrote:> > > > >
> > > > Am
> > > > 01.11.2020 um 15:22 schrieb Michael Mrozek < > > >
> > > > EvilDragon at openpandora.org>:> > > > > > Well, it charges
> > > > properly
> > > > with 2A when the unit is off and the> > > battery stays cool.>
> > > > > > >
> > > > > > The issue only happens when the Pyra is switched on, but
> > > > > > AFAIR
> > > > it> > > did that even before we raised the limit that high,
> > > > when I
> > > > was> > > only charging with 1A.> > > > > > So we seriously need
> > > > to
> > > > change the behaviour by either..> > > > > > 1. Use the battery
> > > > temperature, NOT the bq temperature to as> > > indicator> > >
> > > > 2.
> > > > Raise or better even disable the critical temperature if this>
> > > > > >
> > > > always depends on the bq temperature (as that temperature will>
> > > > > >
> > > > always be way higher than the batteries temperature).> > > > >
> > > > > At
> > > > the moment, it even stops charging if the battery has 25C or> >
> > > > >
> > > > less, simply because the OMAP heats the bq temperature chip...>
> > > > > > >
> > > > Sorry but I can't follow your assumption here.> > > > Charging
> > > > stops
> > > > if the NTC *inside the battery* says it is too hot.> > This is
> > > > done
> > > > by the bq2429x by measuring the resistance of the NTC.> > And
> > > > that
> > > > resistance measurement is some % off because we have> >
> > > > connected an
> > > > additional voltage divider parallel to the NTC to be> > able to
> > > > measure the temperature through the Palmas with more steps> >
> > > > than
> > > > the bq2429x driver can report. This % off *could* explain why>
> > > > > the
> > > > LED starts blinking too early when the OMAP heats up the Pyra.>
> > > > > > >
> > > > I (and apparently nobody else) was aware of this effect until
> > > > end> >
> > > > of August. And since I always assume that nobody is perfect
> > > > (me> >
> > > > included) I would like to have someone cross-check if the
> > > > effect is>
> > > > > real and the root cause of the problems you have. If it is
> > > > > not> >
> > > > important or not a root cause, we may invest a lot of time to
> > > > make> >
> > > > the wrong modifications...> > > > > > > > > > > On 1 November
> > > > 2020
> > > > 15:02:44 CET, dave <dave at ds0.me> wrote:> > > Can you try
> > > > reducing the
> > > > charge current to say 1A using sysfs (I> > > can't remember the
> > > > exact
> > > > filename but it has been discussed> > > before)? > > > > > > It
> > > > would
> > > > be interesting to see if the main problem is heat from> > > the
> > > > OMAP,
> > > > or internal heating of the battery itself from the> > > charge
> > > > current.> > > > > > -------- Original message --------> > >
> > > > From:
> > > > dave <dave at ds0.me> > > > Date: 01/11/2020 13:47 (GMT+00:00) > >
> > > > > To:
> > > > Michael Mrozek <EvilDragon at openpandora.org>, "H. Nikolaus> > >
> > > > Schaller" <hns at goldelico.com> > > > Cc: 
> > > > kernel at pyra-handheld.com> > >
> > > > Subject: Re: Best way to throttle based on temperatures > > > >
> > > > > >
> > > > I've noticed this behaviour too. The threshold is set by the> >
> > > > >
> > > > relationship between two resistors on the PCB and the
> > > > thermistor> > >
> > > > in the battery, its not software configurable. The only
> > > > settings> > >
> > > > inside the bq relate to the temperature at which it turns off
> > > > the> >
> > > > > OTG boost regulator.> > > > > > -------- Original message ---
> > > > > ----->
> > > > > > From: Michael Mrozek <EvilDragon at openpandora.org> > > >
> > > > > > Date:
> > > > 01/11/2020 13:26 (GMT+00:00) > > > To: "H. Nikolaus Schaller"
> > > > <hns at goldelico.com> > > > Cc: dave <dave at ds0.me>,
> > > > kernel at pyra-handheld.com> > > Subject: Re: Best way to throttle
> > > > based
> > > > on temperatures > > > > > > > > > > > > > > > Well, the bq2429x
> > > > can
> > > > not report real temperature since it> > > > > > has only a 2
> > > > bit ADC.
> > > > It only provides "too low", "normal",> > > > > > "too hot"
> > > > which is
> > > > mapped to 3 values by our driver (I> > > > > > think -10C, 22C,
> > > > 50C
> > > > or so). But "too hot" is already> > > > > > sufficient to
> > > > detect
> > > > overtemperature and trigger some> > > > > > action.> > > > > >
> > > > > > >
> > > > > But isn't "too hot" too late? Isn't that when the battery> >
> > > > > > > >
> > > > already makes an error (blinking LED) or is that before that> >
> > > > > > >
> > > > happens?> > > > > > > > Yes, the blinking LED comes when the bq
> > > > detects HOT and stops> > > > charging. So it is indeed too late
> > > > to
> > > > avoid this point.> > > > > > Hmm, there seems to be something
> > > > wrong
> > > > with the bq setup.> > > While I was charging my Pyra, it
> > > > suddenly
> > > > started to blink again> > > and stopped charging.> > > > > >
> > > > The
> > > > battery was nowhere near critical temperature (I don't have> >
> > > > > my
> > > > temperature measurement device here, but it was just a little>
> > > > > >
> > > > bit warmer than my hand).> > > My smartphone gets as lot warmer
> > > > when
> > > > I charge it.> > > > > > So that emergency shutdown triggers WAY
> > > > too
> > > > early as well.> > > > > > What value does it use for that
> > > > trigger?
> > > > Could it be that it> > > reads a wrong temperature?> > > > > >
> > > > Where
> > > > can we configure that?> > > > > > In was never able once to
> > > > charge
> > > > the Pyra fully while it was> > > switched on. It always
> > > > disconnected
> > > > and discharged the battery> > > after a while.> > > > > > -- >
> > > > > >
> > > > Mit freundlichen Grüßen / Greetings,> > > > > > Michael Mrozek>
> > > > > >
> > > > OpenPandora GmbH> > > Geschäftsführer / CEO: Michael Mrozek> >
> > > > > > >
> > > > > Schäffbräustr. 11> > > 85049 Ingolstadt> > > Deutschland /
> > > > > Germany>
> > > > > > Tel.: +49 841 / 990 5548> > > http://www.openpandora.de/> >
> > > > > > > HRB
> > > > 4879, Amtsgericht Ingolstadt> > > eMail:
> > > > mrozek at openpandora.org> > >
> > > > > > > -- > > Mit freundlichen Grüßen / Greetings,> > > >
> > > > > > > Michael
> > > > Mrozek> > OpenPandora GmbH> > Geschäftsführer / CEO: Michael
> > > > Mrozek>
> > > > > > > Schäffbräustr. 11> > 85049 Ingolstadt> > Deutschland /
> > > > > > > Germany>
> > > > > Tel.: +49 841 / 990 5548> > http://www.openpandora.de/> > HRB
> > > > > 4879,
> > > > Amtsgericht Ingolstadt> > eMail: mrozek at openpandora.org> -- Mit
> > > > freundlichen Grüßen,Michael Mrozek-----------------------
> > > > OpenPandora
> > > > GmbHGeschäftsführer: Michael MrozekSchäffbräustr. 1185049
> > > > IngolstadtDeutschlandTel.: 0841 / 990
> > > > 5548http://www.openpandora.de/HRB 4879, Amtsgericht Ingolstadt-
> > > > ------
> > > > ----------------eMail: mrozek at openpandora.org
> > > 
> > > -- 
> > > Mit freundlichen Grüßen,
> > > 
> > > Michael Mrozek
> > > 
> > > -----------------------
> > > OpenPandora GmbH
> > > Geschäftsführer: Michael Mrozek
> > > 
> > > Schäffbräustr. 11
> > > 85049 Ingolstadt
> > > Deutschland
> > > Tel.: 0841 / 990 5548
> > > http://www.openpandora.de/
> > > HRB 4879, Amtsgericht Ingolstadt
> > > -----------------------
> > > eMail: mrozek at openpandora.org
> > > 
> > 
> 

-- 
Mit freundlichen Grüßen,

Michael Mrozek

-----------------------
OpenPandora GmbH
Geschäftsführer: Michael Mrozek

Schäffbräustr. 11
85049 Ingolstadt
Deutschland
Tel.: 0841 / 990 5548
http://www.openpandora.de/
HRB 4879, Amtsgericht Ingolstadt
-----------------------
eMail: mrozek at openpandora.org



More information about the Kernel mailing list