APC Back-UPS Battery Run Time Mod

I got an APC Back-UPS 1400 to protect my hardware from power surges and outages. With my notebook and PC plus two monitors, network switch, PCengines router and ISP router connected, it ran about 40 minutes until the battery was empty.

By far the most “power outages” last less than two seconds and merely elicit an angry growl from the UPS before it returns to its usual, quiet 50Hz hum. However, every now and then, a transformer goes boom, and it usually takes the electricity guys about 1-2 hours to fix it. Which was too long for my UPS to bear.

So I figured I should replace its original batteries. According to APC, the model I bought does not have user-replaceable batteries. They even have this somewhat useless video on YouTube, showing how you can not replace the battery.

The Hard(-ware) Part

Well, as it turns out, you can in fact replace the battery if you are fearless and know how to use a screwdriver.

APC Back-UPS 1400 insides

The UPS contains two 12V, 7Ah lead acid batteries, standard BP7-12, which are connected in series. Unfortunately, there is no replacement battery with significantly more capacity with these dimensions, so I cut them out, drilled a hole in the case of the UPS and led the cables to the outside.

I ordered two 35Ah, 12V deep cycle lead batteries as replacement, as well as some cable and lugs to fit the M6 battery screws. I build a nice battery pack out of the paper boxes in which the batteries were shipped, and connected everything together.

New batteries connected in series in the back, original battery pack in the front
My cat เสือ (Tiger) warming his ass on the UPS, next to the finished battery pack

The Soft(-ware) Part

Now, this “Back UPS” series of APC is the dumb, cheap kind of UPS. You can’t just tell it that it now has a bigger battery. In fact they have a different series called “Smart UPS” where you can do that. Apparently they didn’t want to call this one “Dumb UPS” though.

Anyway, it has a USB interface via which it reports some status information, including the battery voltage, the estimated battery charge and the estimated remaining run time, which you can read out using apcupsd (which I run on my router, which runs pfSense):

APC      : 001,037,0959
DATE     : 2019-10-05 07:54:55 +0700  
HOSTNAME : ********
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : greenhouse-ups1
CABLE    : USB Cable
UPSMODE  : Stand Alone
STARTTIME: 2019-10-04 12:08:32 +0700  
MODEL    : Back-UPS XS 1400U  
LINEV    : 232.0 Volts
LOADPCT  : 31.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 18.1 Minutes
MBATTCHG : 1 Percent
MINTIMEL : 1 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 155.0 Volts
HITRANS  : 280.0 Volts
ALARMDEL : 30 Seconds
BATTV    : 27.2 Volts
LASTXFER : Unacceptable line voltage changes
XONBATT  : 2019-10-04 17:21:49 +0700  
TONBATT  : 0 Seconds
CUMONBATT: 4 Seconds
XOFFBATT : 2019-10-04 17:21:51 +0700  
STATFLAG : 0x05000008
SERIALNO : 3B1803X11330  
BATTDATE : 2018-01-18
NOMINV   : 230 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 700 Watts
END APC  : 2019-10-05 07:55:00 +0700  

As you can see here, at a load of about 30% (I ran some stress test on my PC to achieve this relatively high load), it reports a remaining run time of 18 minutes – which would possibly be somewhat accurate with the original batteries.

As it turns out, the battery charge is not calculated from the actual battery voltage. When I disconnected the power, the UPS reported a linearly decreasing battery charge and remaining run time, hitting zero after about 40 minutes (I did this with normal work load which is around 15%) – while the batteries happily still delivered 24.8 Volts (and would continue to do so for another two hours or so).

Ideally, I’d want apcupsd to shut down my hardware when the UPS reports an accurate remaining charge of, say, 30% (even though they are “deep cycle” batteries, they do not actually like being drained completely – it reduces their life span).

I found multiple sources claiming that you could calibrate the UPS by draining the battery completely with a load of between 30 and 34%. I tried that to no avail – the UPS still reports a remaining run time as if it had its original battery. Unfortunately, recharging the large battery takes approximately 40 hours because the charge current is dimensioned for the original battery, so I did not do any further tests up to now.

Instead, I set apcupsd’s BATTERYLEVEL = -1 and MINUTES = -1 and set TIMEOUT = 9000, so that the hardware would shut off after 9000 seconds (=2.5 hours) regardless of the battery charge reported by the UPS. (Ironically, pfSense’s apcupsd package wouldn’t allow setting those values to -1 due to a validation bug, so I fixed that first).

So, now hopefully I’m ready for all the power outages to come.

Extraordinary people: Thomas Midgley Jr.

Thomas Midgley Jr.

Today, I want to introduce you to this extraordinary gentleman.

Mr. Thomas Midgley Jr., an american engineer born on May 18, 1889, in Beaver Falls, Pennsylvania, is considered one of the most harmful persons who lived on this planet. He contributed to some of the worst environmental problems the world faces today.

Working at General Motors, Midgley discovered that the addition of Tetraethyllead to gasoline prevented knocking in combustion engines. Unopposed by the fact that it is an extremely poisonous substance due to its lead content, General Motors began to market it as a fuel additive, even though there were harmless and cheap alternatives such as Ethanol (that’s plain alcohol).

According to Wikipedia, in 1923, after his discovery, Midgley took a long vacation in MiamiFlorida, to cure himself of lead poisoning. Afterwards, he was tasked with supervising the setup of the TEL production plant.

Quoted from Wikipedia:

In April 1923, General Motors created the General Motors Chemical Company (GMCC) to supervise the production of TEL by the DuPont company. […] However, after two deaths and several cases of lead poisoning at the TEL prototype plant in Dayton, Ohio, the staff at Dayton was said in 1924 to be “depressed to the point of considering giving up the whole tetraethyl lead program”.[6] Over the course of the next year, eight more people died at DuPont’s plant in Deepwater, New Jersey.[9]

But that was no reason for them to give up:

Ethyl – The “lead” was dropped from the name for marketing reasons.

In 1924, unsatisfied with the speed of DuPont’s TEL production using the “bromide process”, General Motors and the Standard Oil Company of New Jersey (now known as ExxonMobil) created the Ethyl Gasoline Corporation to produce and market TEL. Ethyl Corporation built a new chemical plant using a high-temperature ethyl chloride process at the Bayway Refinery in New Jersey.[9] However, within the first two months of its operation, the new plant was plagued by more cases of lead poisoning, hallucinations, insanity, and five deaths.

Yet, still convinced of his invention’s feasibility:

On October 30, 1924, Midgley participated in a press conference to demonstrate the apparent safety of TEL, in which he poured TEL over his hands, placed a bottle of the chemical under his nose, and inhaled its vapor for 60 seconds, declaring that he could do this every day without succumbing to any problems.[7][10] […] Midgley would later have to take leave of absence from work after being diagnosed with lead poisoning.[11]

For the next 60 years, lead was spread all around the world causing all sorts of health problems: nerve damage, reduced IQ levels and aggression. Read about lead poisoning on Wikipedia if you like. It was found that the use of leaded gasoline had a statistically significant effect on violent crime rates – the violent crime curve virtually tracks the lead exposure curve with a 22 year lag.

But that was not the conclusion of Mr. Midgley’s life’s work.

Mr. Midgley, still employed at General Motors, went on to invent a new refrigerant for their air conditioning and refrigeration systems. Mr. Midgley Jr. and his team came up with Dichlorodifluoromethane, which in the U.S. became known as Freon, and belongs to the group of Chlorofluorocarbons a.k.a. CFCs.

That’s right, the stuff which went on to destroy destroy our ozone layer.

While chemically stable and thus non-toxic to humans and animals, it turned out that this stuff, due to its stability, accumulates in the upper layers of our atmosphere.

Ozone hole

There, it does two bad things: first, it acts as a greenhouse gas, absorbing heat radiated from earth and thus preventing it from leaving. Second, it acts as a catalyst for the conversion of ozone into oxygen. Ozone shields us from dangerous UV-B radiation.

So, Mr. Thomas Midgley Jr. not only caused the lead poisoning of mankind, he also helped to cause the Ozone Hole.

Interestingly, in the end, one of the inventors own contraptions caused his death (quote Wikipedia):

In 1940, at the age of 51, Midgley contracted poliomyelitis, which left him severely disabled. He devised an elaborate system of ropes and pulleys to help others lift him from bed. In 1944, he was entangled in the device and died of strangulation.

Tetraethyllead was largely banned from industrialized countries by the 2000s (notably, it still used today in aviation fuels, known as  Avgas). CFCs became closely regulated in the 1970s and 1980s.

Sources: Wikipedia, interestingengineering.com, both November 2018

How to get a Residence Certificate at Chiang Mai Immigration (Airport)

Residence Certificate

Just recently, the Chiang Mai Immigration office moved back from Promenada Mall to the building near the CNX airport. At the old location, you could get your residence certificate on the second floor of Promenada Mall, and there was also an expedited service counter which would get you the certificate the next (or even same?) day.

As I wasn’t able to find any information on where to get this stuff at the new office, I went there and found out.. and I will share it here.

So, if you walk up to the information desk in the new immigration office, straight from the entrance, and ask where to get a residence certificate, they will tell you: turn right, walk straight out of the side entrance, across the pavement to the small building. It looks closed from the outside but there is a glass door and behind that a small room where you can fill in your application.

You can fill in your application form there. In addition to the form, you need:

  1. Copy of your passport, including
    1. The picture / data pages
    2. Entry stamp
    3. TM.6 departure card
    4. Current visa
  2. Two 4x6cm photos of you
  3. Your TM.30* receipt which must be up to date
  4. Proof of address such as your lease agreement

*Note that you need to update your TM.30 every time you (re-)enter Thailand. Your landlord is responsible to register you within 48 hours of entry.

Now the girl in the small office will check your documents and staple them together, then she will tell you “pick up your certificate in four weeks”. If, however, you need your certificate, say, the next day, you take the documents, say “thank you” and go outside.

Across the pavement, next to the side door of the main building, are some suspicious looking guys who will see you approaching them with your documents and welcome you with a friendly greeting. They will then check your documents again and send you to their agency office across the street (it is in the fancy large white building on the other side of the busy Mahidon Road leading up to the airport). Avoid cars.

This is a visa agency which will handle everything for you – for instance updating an outdated TM.30 (300 Baht), and they will also get you a residence certificate the next day for 1000 Baht.

Hope that helps.

How to Extend a Non-Immigrant ED Visa at Chiang Mai Immigration (Airport)

There’s much confusion about what’s going on at Thai immigration offices. Just recently, Chiang Mai Immigration has moved (back) from Promenada Mall to the old location near the CNX airport, with a new queuing system.

As I haven’t found any recent information on the web myself, I’m going to tell you my story today (this was actually today, Monday, November 19th of 2018 at the “new” immigration office).

Show up early

Be aware that extending a Non-Immigrant / long stay visa is different from extending a tourist visa (e.g. SETV or visa exemption). You will get a different queue and you will need to provide more documentation.

Rumor has it that people start queuing at 5 o’clock.

I showed up about 7:45, walked up to the information counter right inside the main entrance and handed my stack of documents to the guy in the brown uniform. He did a quick check, stapled the documents together, and handed them back to me, along with queue number E34.

Anyway, I got number E34 and my number was called at about 11:30 – almost four hours later. I was able to run some errands in the meantime, so no biggie.

There is a QR-code printed on the queue ticket which purportedly lets you check the queue status online – however it didn’t work when I tried it (I got some error message on the website).

Have all your documents ready

The following documentation is needed to extend a Non-Immigrant ED visa at Chiang Mai Immigration:

  1. TM.7 Application Form (download), filled in and with
  2. A photo of you, 4x6cm
  3. Copies of all relevant pages of your passport, namely
    1. The picture / data page
    2. The last entry stamp
    3. The TM.6 departure card
    4. The current visa (which is to be extended)
  4. A copy of your TM.30 receipt*
  5. Documentation from your school (this is usually prepared by your school)
    1. A letter requesting to extend your visa
    2. Some form of proof that you are attending, for instance an assessment form signed and stamped by the university
    3. Some form of proof confirming your identity – (CMU had a letter with my  passport photo and signature on it, stamped and signed by the University)
    4. Two forms with declarations about the reason for extending and confirmation that overstay and working is illegal, etc.

Sign all copies. Also, you will have to pay 1900 Baht so have them ready.

*Note that they will ask for a current TM.30 receipt. Your landlord needs to register you at immigration within 48 hours of you entering Thailand – every time you leave the country and come back you have to renew this, which I didn’t know at first.

You don’t need the TM.30 receipt for extending a tourist visa (at least I didn’t need one back at Promenada Mall), but for the ED visa it appears to be mandatory – there even are signs posted outside the immigration office, stating that you absolutely need a TM.30.


So at 11:30 I was called to the counter and handed in my documents, which were complete and sufficient. I guess when you wait four hours and don’t have sufficient documentation, you’re out of luck. The guy who gave me the queue number didn’t spend much time checking them.

Now the guy at counter 7 did a thorough check of my documents and passport, and hammered an estimated 15 to 30 stamps onto them. Then asked me to take a picture at the next counter.

After my picture was taken, I was asked to sit down and wait. After another 45 minutes of waiting, my name was called via the intercom and I got my passport with the extended visa.

I hope that helps someone 🙂



I Am A Banana 🍌

Yesterday, while browsing the web, I stumbled upon this short article which claims that we humans share about 60% of our DNA with bananas. Purportedly, we share about the same amount with chicken, too.

Banana tree — and me

While I believe without further doubt that we are similar to chimps (96%), I  was intrigued about our heritage shared with the yellow fruit. Let’s ignore the whole new chapter of issues that this opens for vegans, and have a look at the facts.

To Be, Or Not To Be

Unfortunately, the article mentioned above doesn’t cite any sources. While searching the interwebs for answers, I found some interesting math and misconceptions regarding percentage of shared DNA. When we say we share some DNA with another organism, it doesn’t mean that it is completely identical in the shared parts, just that the DNA sequence can be aligned by functionality. So humans share 100% of their genes with other humans, but the genes itself might still be different from each other, other versions so to speak.

As this guy on Quora points out, both us and bananas belong to the same biological domain (quote, added link):

Both bananas and humans are eukaryotes. Hence, much of the basic metabolism and cell machinery is largely the same. All those same functions will be encoded by proteins which share a clear kinship between humans and bananas.

These genes make up the very basic functionality of our cells and chemistry. The fact that you have a nose, eyes, and a brain, and the banana doesn’t, might be of paramount importance to the observer, but doesn’t actually make up most of our DNA as it seems.

P.S.: Also, I found this article which describes how to extract DNA from a Banana in your Kitchen.

Mt.Gox Claim Filing System Online

Today I got mail from Mt.Gox again… their new claim filing system is up and running! So I scrambled to file my claim.

The log in process is a bit complicated, they required me to provide email address, user name and passwords for both the actual Mt.Gox Exchange as well as the old claims system, which I fortunately still had all in my password database. Along the way, they mixed up exchange and claims system at least once, which didn’t make it easier.

Anyway, after a new password is set for the new claims system, you have to set up two factor authentication with an authenticator app, log in again for a last time, and then you get this:

When you click that blue button, you get a listing of all assets that you had on the exchange. In addition to any fiat currency, it listed the BTC and BCH in my account! Now you have to provide some data, they also ask for your old address in case it changed since Mt.Gox got shut down.

So I filed my claim and got this confirmation page along with an email. I guess now I’ll have to wait for a couple years again 😀


Elon Musk allegedly taking Tesla private

I found this write-up on pastebin, I don’t know who made it, and I fear it is going to be deleted from pastebin. It was fun to read so I want to share without further comment:


  1. Elon Musk on Twitter:
  2. Tesla short sellers have about 3 weeks before their position explodes.
  3. Elon Musk later on Twitter:
  4. Am considering taking Tesla private at $420. Funding secured.
  5. New York Times:
  6. Board members, blindsided by the chief executive’s market-moving statement, were angry that they had not been briefed, two people familiar with the matter said. They scrambled to cobble together a public statement trying to defuse a mounting uproar over the seemingly haphazard communication.
  7. Elon Musk:
  8. I notified the Tesla board that, in my personal capacity, I wanted to take Tesla private at $420 per share. I don’t recall getting any communications from the board at all. I definitely did not get calls from irate directors.
  9. New York Times:
  10. What Mr. Musk meant by “funding secured” has become an important question. Those two words helped propel Tesla’s shares higher. But that funding, it turned out, was far from secure. There were no indications that Mr. Musk has actually nailed down any commitments to bankroll such a transaction, and the Securities and Exchange Commission last week contacted the company about Mr. Musk’s Twitter posts.
  11. Also New York Times:
  12. Multiple directors have recently told Mr. Musk that he should stop using Twitter, with one urging him to stick to building cars and launching rockets, according to people familiar with the board’s communications. Tesla employees, including the company’s public-relations staff, have echoed that point, another person said.
  13. Elon Musk goes on Twitter:
  14. I’m excited to work with Silver Lake and Goldman Sachs as financial advisors, plus Wachtell, Lipton, Rosen & Katz and Munger, Tolles & Olson as legal advisors, on the proposal to take Tesla private
  15. New York Times:
  16. Neither Goldman nor Silver Lake — a private-equity firm focused on technology investments — had actually signed on with Tesla or Mr. Musk to play those roles, according to people familiar with the matter. Goldman was in talks with Tesla about a possible role, but had not finalized anything. Silver Lake, meanwhile, is interested in investing in any going-private deal, but it isn’t acting in a paid advisory capacity.
  17. Azealia Banks:
  18. I waited around all weekend while grimes coddled her boyfriend for being too stupid to know not to go on twitter while on acid
  19. Wall Street Journal:
  20. Tesla’s investors, captivated by the electric car maker’s future growth prospects, have ignored its rickety finances. That is no longer possible. Tesla is in trouble after a chaotic week. Elon Musk’s supposed plan to take the company private at $420 a share looks more like a fantasy. The Securities and Exchange Commission is investigating the company on multiple fronts, including issues related to disclosure about production of the Model 3 sedan.
  21. Nasdaq:
  22. TSLA 305.50
  23. fortune.com:
  24. Investors betting that Tesla stock will lose value — so-called “shorts” — have made $1.2 billion since CEO Elon Musk first tweeted about taking the company private. Much of that gain came on Friday, after the New York Times published a revealing, emotional interview with Musk that drove Tesla stock down nearly 9%.
  25. >>> You can’t make this shit up 😀

(end quote)

The Elon Musk interview in NY Times mentioned

Remarkable Blackmail Spam

I received some remarkable spam with an attempt to extort some bitcoin from me today, and wanted to share:

Subject: (Your password XXXXXXX)

It seems that, XXXXXXX, is your password. You may not 
know me and you are probably wondering why you are 
getting this e mail, right?
actually, I setup a malware on the adult vids (porno) 
web-site and guess what, you visited this site to have 
fun (you know what I mean). While you were watching 
videos, your internet browser started out functioning 
as a RDP (Remote Desktop) having a keylogger which 
gave me accessibility to your screen and web cam. 
afterthat, my software program obtained all of your 
contacts from your Messenger, FB, as well as email.
What did I do?
I created a double-screen video. 1st part shows the 
video you were watching (you've got a good taste haha
 . . .), and 2nd part shows the recording of your web 
exactly what should you do?
Well, in my opinion, $1000 is a fair price for our 
little secret. You'll make the payment by Bitcoin (if 
you do not know this, search "how to buy bitcoin" in 
BTC Address:


(It is cAsE sensitive, so copy and paste it)
You have one day in order to make the payment. (I've 
a unique pixel in this e mail, and at this moment I 
know that you have read through this email message). 
If I do not get the BitCoins, I will certainly send 
out your video recording to all of your contacts 
including relatives, coworkers, and so on. Having 
said that, if I receive the payment, I'll destroy 
the video immidiately. If you need evidence, reply 
with "Yes!" and I will certainly send out your video 
recording to your 6 contacts. It is a non-negotiable 
offer, that being said don't waste my personal time 
and yours by responding to this message.

The password in the subject was indeed one of my oldest “throwaway-passwords”, which I would use to sign up at websites which required to make a user account for no good reason. That’s why it catched my eye.

Notably, if you look at the address given in the email, you can see that (at this time) eight people have already sent around 0.15 BTC (that’s roughly $1000) each to this address, which is sad – but also a clear sign that this address was apparently used to scam multiple people and not personalized for me.

Most likely, my old password is contained in some publicly available leaked database of some website, along with my email address. So the scammer just mailed every address with their respective password. And it seemed to work.

By the way, the email did in fact not contain a “unique pixel”, it was plain text. It originated from some Japanese email provider, however I guess it’s pointless to try and trace the actual sender.


The next morning I woke up to another email: this time the subject was:

Subject: (Part num your Hacked phone. +XX XXXXX1234)

It contained the last four digits of my old mobile phone number, otherwise the same text as above, and a different BTC address. This one has only received little Bitcoin so far.

So it looks like the last four digits of my phone number were included in said leaked database as well. If they had the whole number, they would have used it. Maybe I can find out which leak exactly that might be.

Have a nice day, and be vigilant 😉

P.S. my apologies to everyone who is going to receive those videos of me “having fun” 😉

Nuclear Jet Propulsion – Atomic Bombers

Back in the days, in the beginning of the cold war, both U.S. and Russian engineers came up with the idea of creating a nuclear-powered aircraft. Such an aircraft would have the benefit of virtually unlimited operating range as it could stay airborne until the crew couldn’t take it any more.

Tupolev Tu-95LAL*

Both parties didn’t make it beyond testing and prototyping, however they came up with interesting problems and concepts. Both eventually built planes with nuclear reactors in them, which however were propelled by conventional engines, in order to test the manageability of running a nuclear reactor on a plane. The Russians built the Tupolev Tu-95LAL based on the Tu-95, and the Americans built the Convair NB-36H based on the B-36, which were their respective strategic bombers at that time. It is not entirely clear to me, however it seems that only the Russians had the guts to actually run the reactor during test flights.

Convair NB-36H with escort
(Picture by U.S. Airforce, Public Domain)

One major problem was shielding the crew from radiation emerging from the reactor; while land- or ship-based reactors are usually shielded with heavy concrete walls, water and lead, this wasn’t feasible on an airplane due to weight restrictions. They came up with combinations of different materials such as sodium and paraffin wax, which apparently are somewhat effective in absorbing neutron radiation.

Nuclear reactor of the Tupolev Tu-95LAL*

The other concern was how to convert nuclear energy into thrust. Candidates were ramjet, turboprop or turbojet engines – all of these rely on expanding gas, conventionally generated by combustion of jet fuel, in this case by heating up air by nuclear means. To accomplish this, there were two main approaches – the so called direct cycle, and indirect cycle which involved a heat exchange system.

HTRE-3 Engine (Public Domain)

In the direct cycle approach, air would be compressed and fed into the reactor core, acting as coolant to the reactor and being heated up, the hot air then would go back to the turbine to produce thrust. The downside of this approach is that the air is more likely to get contaminated in the process, the airplane would constantly be spewing radioactive air out of the exhaust. One such engine was the HTRE-3 shown in the picture to the left.

In the indirect cycle approach, the reactor would heat a coolant which would then transfer the heat to compressed air using a heat exchange system. Unfortunately this approach apparently didn’t turn out to be feasible and never came near to be flight-ready.

Eventually, the projects were stopped as strategic bombers were made obsolete by land- and submarine-based ICBMs.

I recommend watching this documentary on YouTube:

Here is a nice overview on the whole Soviet nuclear aircraft program. This web page has some more photos of the Tupolev Tu-95LAL. More information on the Tupolev, in Russian.

Project PLUTO, nuclear ramjet engines for cruise missiles.

*) I did not find copyright information for the Tupolev pictures. But I think this counts as fair use if not public domain.