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.

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.

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” 😉


At the beginning of the 20th century, people inspired by the big progress made by mankind through industrialization and science weren’t shy to think big. Like, really big.

German architect Herman Sörgel came up with the idea to build a hydroelectric dam across the Strait of Gibraltar and some additional dams, thereby lowering the surface of the whole Mediterranean Sea by 200 meters. The dam would provide electric power, and the lowering of the surface would open up formerly submerged lands for settlement and agriculture.

The utopian goal was to bring Europe together as a whole, and unite Europe with Africa into Atlantropa, or Eurafrica, thereby staying competetive with the Americas and emerging Pan-Asia.

Atlantropa – artist’s impression by Wikipedia user Ittiz, license CC BY 3.0

The perils of this venture though were barely assessable. The dam would be  prone to tsunamis. It would have had a vast impact on the environment. The change in pressure on the plates may have caused shifts, volcanic eruptions and earthquakes. The surface of the other oceans might have raised for one meter. The impact on the economy of the surrounding countries due to change of borders and new trade routes was likely to be severe.

Digital Dementia

I just came across this article on Psychology Today on “Digital Dementia”, a term to describe overuse of digital technology which results in a breakdown of cognitive abilities. Apparently this is really a thing, not only perceived, but observed in studies.

For instance, the article hints that action video gaming has an impact on the volume of different parts of the brain, which in turn are linked to an increased risk of various mental disorders, such as depression and schizophrenia.

Moving to Thailand

Well, I didn’t add any posts for a couple months. That was because I didn’t feel right and had to change something. So, I quit my job and moved to Thailand. Sounds easy, right? Well, I put together what I did – and I will update this as I go.

Find out where you want to go

Buddhist monks

First you need to know where you want to go. Thailand has many different places. Meaning different in style and culture. I recommend you travel to Thailand a couple times and actually go beyond the “touristy” places before you make a move. You need to know that Thailand is not all beaches, hookers and Indian guys selling suits. It is a proud country with rich culture looking back at thousand years of history. For me, the decision was easy, because I have friends in Chiang Mai. And everything is easier with friends.

Learn Thai

You absolutely should learn at least some basic Thai language. As a tourist, you will get by with English – but be aware that most people who have no higher education and are not involved with tourism usually do not speak English at any useful level. I use thaipod101.com, also there are many YouTube videos with basic language training. I learned many words but I’m still far from actually speaking Thai. However, it helps to understand the concept of the language and to know most of the basic words when you’re communicating with people who do not speak English well.

Get rid of all your shit

Because come on, you know that you don’t need it. I wanted to start with a clean slate. I sold, gave away or trashed almost everything I owned. This is a straight forward process. For every item you own, you decide: keep – sell – give away or trash. I ended up with two suitcases which I took to Thailand, and a couple things which I stored at or lend to family members. When I left, all I owned fit into two suitcases… one check-in and one cabin luggage.


There are many approaches to staying in Thailand long term. I will go with Single Entry visas for now. These are valid for 60 days and can be extended once by 30 days at the immigration office (I will write an update when I do this for the first time). After that time, you have to leave the country and get a new visa, which I will do. You need to apply for a visa at your local Thai consulate or embassy. Acceptance criteria vary by country, but generally you will need to prove that you have some (relatively small) amount of money and that you have a job. I will not go into more detail here as the details apparently change a lot and depend on your country of residence or the local consulate. Most important is that you definitely do not want to overstay as you might be restricted from entering the country again. Also be aware that you are not allowed to work in Thailand on a tourist visa.

Renting a house or apartment

My house in Chiang Mai

If you google for rental apartments or houses in Thailand, you will mostly find offers targeted at wealthy foreigners, and end up paying two times as much as a Thai would. You’re better off if you know Thai people who can help you find something. Fortunately my friends in Chiang Mai had me covered and found a really nice little house for me. I signed a standard lease agreement at the terrific price of 10’000 THB per month.

Residence Certificate and TM30 Form

If you want to open a bank account or register a vehicle to your name, you will need proof of residence in Thailand. For this purpose there is the so-called residence certificate, which can be applied for at the office of the immigration police (this may vary depending on you location).

But first you will need a TM30 form – this is proof that your landlord (or your hotel?) registered you at the immigration office. Your landlord (or hotel) is responsible to register your stay within 24 hours at the office of the immigration police, and they will get this form in return. I got a copy of my TM30 form from my landlord.

Now you can apply for the residence certificate with the following documents:

  • Photocopy of your lease agreement
  • Photocopy of the TM30 form signed by your landlord
  • Photocopies of the following passport pages, all pages signed:
    • Main/picture page
    • Visa page
    • TM6 (Departure card)
  • Two passport photos (I’ve seen claims it must be with blue background, but they accepted my white background ones)
  • Your original passport

At the immigration office, they will let you fill in the registration form. Along with your personal data, you will need to know your address and phone number. Be aware that most immigration offices have different counters for different purposes – when I went to the immigration office in Chiang Mai, there was a huge waiting area with queue numbers for the TM30 form counter (which I got from my landlord) and, besides others, a specific counter for the residence certificate which had no queue at all, I was served immediately.

In Chiang Mai, you can apply for the residence certificate at Promenada Mall, at the office of the immigration police on the second floor of building A, every day between 9am and 11am. Be aware that the mall only opens at 11am so you will find closed main doors – however there is a small door at ground level between the two buildings. Immediately behind the door is the ground level immigration office which is not what you are looking for (this one is for visa-related stuff), you go up the escalators to the top floor and then to the right.

After I handed in all my documents, I got a small piece of paper with my pickup date – which was three weeks later. The office is open for certificate pickup only in the afternoon, from 2pm. I walked in 1:50 and I was second in queue. They handed me my certificate.

Buying and registering a vehicle

I bought a pre-owned motorbike, a Suzuki V-Strom 650cc. The previous owner of the bike had paid taxes and insurance for the bike until May (two months from now), so I didn’t have to care about that for now. Also, the number plate was already on the bike and as it was registered in Chiang Mai, I won’t need to get a new one. With the bike I received a green booklet where the official owners of the bike are noted, also an insurance form (proof of insurance) and an empty form for change of ownership. With these documents, a copy of my Passport (including all visa pages), and my residence certificate, I went to the Chiang Mai Provincial Land Transportation Office. After a short inspection of my motorcycle, I was sent back to the counter, where I had to pay about 1350 Baht – this is calculated based on the buying price of the bike – and got a piece of paper with a number and was asked to come back Monday next week to pick up my booklet.

Internet Connection

Of course I want a proper broadband connection in my house. My house apparently had existing cable TV lines and a phone line which I don’t use, but I wanted fiber. So I went to a mall and checked out some of the ISP stores there. I found that 3bb offers 100/30 Mbps fiber connections for 749 Baht per month (that’s the lowest speed available at this time). Unfortunately, I absolutely had to buy their combined Wifi router and modem for another 2000 Baht (I’d prefer a simple media converter providing me with an Ethernet port). Also they made a copy of my passport, and I had to pay six months in advance, because as a foreigner I might otherwise flee the country and never pay, I guess. They asked me to pick a Wifi SSID and password which they would preconfigure on the router, and agreed to run a fiber to my house in less than a week.

And, lo and behold, one week later they called me in the afternoon to announce that a technician would show up in thirty minutes. And they did. I showed them where I’d want the router to be installed, they agreed and got to work – by pulling a cable from the next crossroads up to my house. They came with a pickup and bamboo ladders. Starting from the next crossroads, they climbed up every utility pole and fixed the fiber there, until they reached my house after about 20 minutes.

Once there, they climbed under my roof to get from the cable entry point to my office (which is on the other side of the house) and drilled a hole through the ceiling; then they installed the router on the wall. All this work of five people was included in the router price and monthly rate. When done, they asked me to check the Wifi and promised that internet access would work within 30 minutes. Actually it already worked when I checked, and a speed test showed that it was 100/30 as advertised.

Opening a bank account

Right after I got my residence certificate at the immigration office at Promenada mall, I went straight to the Bangkok Bank office across the floor and asked to open a bank account. They asked me for my passport, the residence certificate, and had me fill in a couple forms where I had to put my foreign residence address and some information like source of funds, net worth, monthly income etc.

They took a copy of my passport, and initially, they wanted to keep the original residence certificate – however I’ll need that to register my motorcycle. After I asked, they agreed to keep just a signed copy of the certificate. I received a small savings booklet and a debit card right on the spot, so now I had a Thai bank account.

I hope this was helpful and I wish you a great time. If you have any suggestions or corrections please tell me!

Why Nuclear Crypto-Buddha?

Hello dear reader, my name is Daniel, and with this first post I am entering the blogosphere. I am a software engineer based in Zurich, Switzerland. I’m a general science and technology nerd, and in this blog, I am going to talk about and discuss the topics which come up on my way to enlightenment.

My first endeavor was to pick a name, and I came up with this, the Nuclear Crypto-Buddha. The name incorporates three things which concern me quite a bit, but the list is not exhaustive. I’m going to give a quick overview on each of the topics below.

Why Nuclear?

When I was seven years old, the Chernobyl Disaster happened, and the world once again became aware of the dangers of the nuclear age. Being a child, I was not able to understand the problem back then, but I was frightened. I wanted to know everything about it, which turns out to be a good way to handle fear.

So I went and started reading about how nuclear power plants and nuclear bombs work; I read about all the science and all the disasters, the well known and the lesser known ones, some of which I am planning to cover in the blog some day. In 2009, I finally visited Chernobyl myself, which was quite an experience.

Now I can say that I feel safe again, but I have lots of largely useless knowledge about everything nuclear.

Why Crypto?

While cryptology played an important role in many ways along my way of becoming and working as a professional software engineer, my main concern of this topic is based on a relatively new phenomenon, namely cryptocurrencies and the concept of blockchains.

While I heard of the infamous Bitcoin early on and even owned some back when they were of little worth, I only later really grasped the concept and the significance of blockchains. Meanwhile, I have invested some money and also I am running an Ethereum node. The picture on the left shows my original Mt.Gox YubiKey.

I am pretty sure that blockchains will play an important role in the future of information technology, and therefore, some of my hopes rely on crypto.

Why Buddha?

Right after my midlife-crisis it struck me, that in the end, every one of us is striving for happiness. Some may not know it, and many confuse it with wealth, but that is what we all want: we want to be happy.

As it turns out, this is neither an original insight, nor is it an easy to pursue goal to become truly happy. It requires work.

Fortunately, there was one guy who had it all figured out a long time ago. His name was Śhakyamuni Buddha. While this guy is often referred to as”the Buddha”, the original teacher and founder of Buddhism, “Buddha” itself actually is a title for someone who is enlightened, it simply means “the awakened” or “the enlightened”.

There is also the term “Crypto-Buddhist“, which refers to someone who secretly is Buddhist. I’m not going to further comment on this 🙂

The guy in the picture on the right is me, on the second day of a stay in at Wat Tan Dong, a secluded Theravada Buddhist temple in the forest far south west of Chiang Mai, Thailand. I had to use that chair because sitting and sleeping on the floor hurt my bones. By the way, that was before I lost more than ten kilos.


So it has been quite a ride so far, and I want to share my experience and knowledge with you. The journey has just only begun. Hang on tight!