Acer C720, its swollen battery and RTC.

In the Spring of 2015 I bought a second hand Acer C720 chromebook for a good price about 100$.
It was in perfect condition, almost not used.

I’ve bought it because I wanted a machine that can’t run Windows at all and so I could force myself to study and get used to Linux 🙂 Once in a while I become such an idiot again…
I really used this device for development and testing purposes for about half a year.

I’ve bought it when Linux already supported almost all its hardware ‘out of the box’ (ha-ha! at least you did not need to compile your own touchpad driver as it had been before) and anyway I got a bunch of problems.

It was a time of Linux Mint 17.1, where cinnamon DE crashed and closed all opened apps every day (Linux Mint live CD also didn’t boot unless you specify RAM amount by hands).
As I remember, in the summer of 2015 or so Linux Mint 17.2 was released. It managed to keep opened applications during his crashes but ruined power management system for me.
Oh, it’s a long and sad story…

Eventually, by the end of 2015 I found myself using the main Ubuntu flavor – Ubuntu Desktop Unity.
Unity was a pain in the ass for me, especially its tray. Many applications (Gajim, DeadBeef) didn’t appear in the tray. I hated messaging menu and the ‘multiclicking access’ it provided to my messaging applications.
And dock… Unity dock was a nice looking but also painful and rigid feature…
Anyway, Rest In Peace, Unity…

Ubuntu Desktop was stable. It had very few settings but I could be sure that if I set it to switch off the laptop after 30 minutes – it would be switched off.
Linux Mint Cinnamon’s power settings often didn’t work. Linux Mint didn’t recognize that I had plugged in power cable if the system was booted on battery so it didn’t change power plan and so forth…

My unhappy but stable life with Ubuntu Desktop on Acer C720 lasted for a few months until I noticed a strange touchpad behavior. I noticed that it sometimes didn’t recognize my taps.
It is not a big deal if you use touchpad occasionally or mostly for scrolling, but if you study something using flashcards and need to do hundreds clicks during the daily training it becomes painful.
I pissed off, manipulated by synclient‘s options for a few days and eventually found this bugreport

They pushed me a new kernel which broke my touchpad and it was difficult for me to realize what is happening because I thought that touchpad lost its sensitivity when actually it was sleeping.
I struggled for some time, rolled back to old kernels but I couldn’t sit there forever.

As time went by, I noticed more and more problems in Ubuntu Desktop and other Linux DEs. These problems are especially painful on laptops.

By the Spring of 2016 I faced two more problems one of which I managed to solve and the other I couldn’t.

The first was a peculiar comprehension of ‘idle time on battery’. In Unity you can set the amount of idle time after which your laptop should go to sleep.
These settings are different for external power supply and battery. Of course I disabled the sleep on external power and set it for 30min of inactivity for battery.

Now, imaging the night… Your laptop is on external power source for an hour. It is considered idle, but doesn’t switch off because this is prohibited in the settings.
And at this moment electricity disappears for a few seconds. What will happen?
Your laptop instantly goes to sleep despite the fact that it is just switched on battery. Its idle time was gathered during the work on external power source, and applied immediately after power source has been changed. That is because there is only one idle timer and it is not affected by switching from one power source to another.
I think this is unbelievable. Such a crappy realization of important power saving feature. Such a perverted usage of the phrase ‘idle time on battery’.
I was very disappointed when I found out the reason why I sometimes suddenly find my laptop sleeping.

I couldn’t find a way to reinitialize idle timer directly on power plug/unplug events, but I managed to use xdotool to move mouse pointer to drop idle timer after the power source was changed.

The second and the last problem was the ability to use Wine software in conjunction with GVFS. I like Notepad++ text editor and I have been using it at work for many years. By the way, my work usually consist of text file editing on remote Linux servers.
On Windows I use WinSCP in conjunction with Notepad++. On Linux I prefer to use GVFS mounted folders together with Wine/Notepad++ because the closest Npp alternative – Geany doesn’t have some features.

At one – not so beautiful – moment Notepad++ became unable to save files on GVFS mounts. I couldn’t find the reason let alone the solution.
I have asked Ubuntu but they said that this is an off-topic 🙂
I think they didn’t even read my question.

After that I ceased to use desktop versions of Linux for a year, but I, of course, used its server distributions.

Acer C720 has been transformed into Ubuntu server in which role it has been working until recent days…
(One of the transformation steps was magnet removal from the lower-left part of the lid so the laptop could be switched on and rebooted when the lid is closed)

Few days ago I pulled it out of the nightstand and noticed that it has a strange shape…
Its keyboard bulged toward the screen so the laptop couldn’t be closed completely.
Battery was swollen.
It was a thin flat battery someday, but now it has become kinda chocolate bar 🙂

I didn’t want to wait until my chromebook will have exploded and I removed the battery. As I noticed recently, while watching images of the swollen batteries on the Internet, – I revealed the problem quite in time. This battery could have increased in size even more, up to 3-4 times, end eventually explode because it still can hold a large charge.

After the battery was removed everything seemed to work well except the wifi. Wifi couldn’t connect to anywhere and somehow (by googling wpa-supplicant error messages from syslog, of course) I understood that the problem is in incorrect date of RTC. RTC really had some fake date in the far future.

It seems that there is no separate CMOS battery in this laptop. It is sad.
Frankly, the whole this chromebook exposes the signs of cheap, disposable device.

Interestingly enough – I found one topic on Reddit about CMOS battery for Acer C720 with images and even a few lots on the different auctions where some things being sold that is claimed to be a CMOS batteries for this laptop.

Maybe that is so, maybe those capacitors can be used as a CMOS battery for a few seconds but they are not comparable to the traditional 3.3V CR2032 CMOS battery because there are 19V voltage out there.

So, there is no separate CMOS battery in this laptop and its RTC will be cleared in case of power loss.
I couldn’t quickly find the place for such battery so I decided to solve the problem programmatically.
Fortunately, there is no need to initialize RTC with a precisely correct time. It is sufficient to set a date, for example, a year ago.

Maybe the whole problem not in the too far date, but in improper, nonexistent date which appears in RTC after power loss. I didn’t test it.
In any case it is better to set the date as close to the current moment as possible or you will get strange timestamps in your filesystem, mail etc.

Here is my reinvention of bicycle, my crutch, my powerless RTC 🙂

I wrote a script that saves current date-time into a file. This script is executed by cron each 5 minutes.
I didn’t tested it in the case of real abrupt power loss. This system survived about 10 abrupt power losses in the Summer of 2017, but it still may not work sometimes… It may not work because of OS, filesystem or SSD caching, but I hope that at least the old version of file will be readable.

#! /usr/bin/perl
 
use Fcntl qw(:flock);
use strict;
use utf8;
 
 
open(my $fh, '>>', '/myscripts/savedtime.txt') or die "unable to save time in file!\n";
flock $fh, LOCK_EX;
truncate $fh, 0;
seek $fh, 0, 0;
 
my $sysdate = `date`;
my($week, $month, $day, $time, $zone, $year) = split ' ', $sysdate;
 
# date --set="23 Jun 1988 10:00:00"
print $fh "$day $month $year $time";
 
flock $fh, LOCK_UN;
close $fh;
 
exit 0;

And one more script to restore the last saved date-time

#! /usr/bin/perl
 
use Fcntl qw(:flock);
use strict;
use utf8;
 
open( my $fh, '<', '/myscripts/savedtime.txt') or die "unable to find saved time!\n";
flock $fh, LOCK_EX;
my $timestr = <$fh>;
flock $fh, LOCK_UN;
 
die "saved time is  incorrect!\n" unless $timestr =~  /^\d{1,2} \w{3,4} \d{4} \d{2}:\d{2}:\d{2}$/;
 
my $resp = `date --set="$timestr"`;
print $resp;
 
close $fh;
 
exit 0;

This last script should be called before bringing up wlan interface in /etc/network/interfaces

iface wlp1s0 inet dhcp
    wpa-driver wext
    wpa-ssid Myssid
    wpa-psk my_long_encoded_pasword+ssid
    wpa-ap-scan 1
    wpa-proto RSN
    wpa-pairwise CCMP
    wpa-group CCMP
    wpa-key-mgmt WPA-PSK
    pre-up  /myscripts/restorecurdate.pl
    post-up iptables-restore < /etc/iptables.rules

After successful interface initialization and connection to the Internet, server will swiftly correct its time using NTP servers.
And also there is no need (in my case) to correct the hardware clock by invoking commands similar to hwclock -w
Some system processes will do it.

I also didn’t consider the situation when cron task is executed before interface pre-up during boot process and destroy saved time.

UPDATE
Using mentioned above trick my server successfully worked a couple of months, but by the end of Summer 2017 we began to have many blackouts. The state of RTC and WIFI connectivity had been restoring well, but I was worried about the file system.
I found a replacement battery AP13J4K on aliexperss for about 50$, but decided that it is too expensive and not funny 🙂
I also doubted that I want to invest any money in this laptop.
I had a few cheap Li-ion 18650 batteries ULTRAFIRE (over 9000 mAh on a label of course, but 800-1000 real), so I decided to replace swollen banks of original battery on these Ultrafire accums.
18650 accumulator can’t be placed inside of the thin case of Acer C720, so I made an ugly external battery.

First, I removed the label from the battery.

It consisted of three swollen SANYO upf476790 banks and a controller hidden in the molded box on the side.
Next, I separated banks from the controller. Unfortunately I didn’t pay attention on small light-grey diodes, that were soldered to each bank, and removed them too (the image is clickable).

I don’t know what it was and maybe this carelessness has ruined all the project. Or maybe it was some other mistake 🙂

After that I just soldered my Ultrafire batteries to the controller, replacing SANYO’s ‘sacks of power’.

I did a few tests on live version of Linux Mint. This system definitely worked. I discharged and charged batteries about three times. Laptop was able to work in idle mode with screen and wifi on for about 45 minutes and was able to show video over wifi for about 20 minutes. It was good enough for me.

I was happy and put this frankenbook (server) into the nightstand again. Next time electricity went off after two weeks and to my disappointment I found chromebook switched off.
Further investigation revealed that two of three batteries are completely dead. One had a zero voltage and one had small reversed voltage. I didn’t give up, considering that the problem was merely in a cheap, old, unprotected accumulators. So I ordered good Panasonic protected 18650 accumulators and holders for them.
Unfortunately, it didn’t help.
After this failure, controller is recognized by chromebook but it always shows 0% charge on batteries, though they are charged.
Finally, I ended up with ordering a “new” AP13J4K battery. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code