Sunday 23 July 2017

Klang Valley MRT Opens, a Project Ends


Page 3 of the Sin Chew

17 July 2017 was opening day, and it was supposed to be a doddle. We had finished a month ahead of schedule; but then they ordered 4 more escalators at the last minute.

The fastest way to get around was to use the MRT itself. On opening day I finished up at Station 5 and was expecting to take the train to Station 26 but there was a snag: the trains did not run all the way from Stations 5 to 34. The new segment only went from 16 (Museum Negara) to 34 (Kajang).

Station 5

So at opening time 16:00 hours I was at  Museum Negara and went through as fast as I could. A reporter took a picture as I went through and the next day, it made page 3 of the local Chinese paper, the Sin Chew Jit Poh

Post Project Blues

Project C1313K started in 2013 and required remote control of over 200 escalators over 34 stations spanning an area of over 50km. The feature did not exist so it would have to be designed, built and tested on the fly. 
Senior R&D Engineer Edward Boo at ease

For the last 2 years we ate, slept and dreamed C1313K. There were setbacks, attrition, additional requirements, variation orders, but these are teething pains. You focus: eyes on the prize...

The team in 2015


You get used to being occupied by a design for years. Then it is over. OK, it succeeded, it works and is delivered on time and we get to fight another day. There is the high, the celebration, the adrenaline rush.  

Northern Zone passed Field Tests Oct 2016
Southern Zone passed field tests May 2017


So where do you go from there? It is strange not to think about C1313K when you get up or just before you go to sleep. Welcome to the Post Project Blues.

 

Reprieve

 And then you get days like these, 18 July 2017 when you make page 3 of a national paper. Did I say life was good?

Moving On

Time for MRT2 (KVMRT SSP Line) then. Goodbye, C1313K.

But with the word the time will bring on summer,
When briers shall have leaves as well as thorns,
And be as sweet as sharp. We must away;
Our wagon is prepared, and time revives us:
All's well that ends well; still the fine's the crown;
Whate'er the course, the end is the renown.
- William Shakespeare


Sunday 16 July 2017

Webserver Follies

In the winter of 1996 my friend and former boss Wiljan Derks introduced me to Linux. By the following spring I picked up a Walnut Creek Slackware 1.0 CDROM and installed it from a stack of some 13 3.5" floppy disks. My desktop was a 33MHz Zeos 80486DX souped up to a giddy 66MHz with an 80486DX2 CPU



I had a website, running at tripod, back then one of the first sites to offer free webhosting. Next was a Malaysian pay webhosting site costing some RM300 a year, which proved short-lived. After the site raised its charges by a few hundred percent, and with 3 years of Linux under my belt I hosted the website at home on my trusty Zeos over a 512Kbps broadband line. It was a joy- Linux was a natural fit as a webserver, and without needing to share the server with other websites, performance jumped.

From 1998, home was on top of a little hill in Seremban, which seemed to be a magnet for lightning.No way a little bit of natural static electricity was going to stop me, right? For 20 years I fought the good fight. First I just repaired the procession of stricken modems, routers, network hubs, desktops and  implacably put them back on line. Then I realized that the lightning caused so many power outages I needed an uninterruptible power supply.

The UPS solved the power outage problem, but made the lightning problem worse. With the web server running through the storm the lightning strokes frequently ran through the telephone landline into my power grid Earth, often passing through the surge arrestors in the modem. This made for a lot of dead modems. Sometimes the strikes hit the lamp or telephone post in my compound(don't even talk to me about the gatepost lights) and even damaged monitors, network switches and network cards.

WiFi brought some hope - there is now no direct link between the server and the modem. True, modems still died at the usual rate of some 4 or 5 a year but the server was usually fine. This meant the UPS had to be up-sized especially if the storm occurred on a weekend and we were not at home to reset the mains breaker. Even with an out-sized UPS, the battery replacement costs were roughtly RM800 over 2 years. It made more sense to downsize the server to the ARM-based beaglebone. The Raspberry Pi seemed even better, but try as I might it would not run WiFi reliably.      

 Currently the web server runs on a Beaglebone original, a 720MHz 256MB ARM Cortex-M3 (Zeos was 66MHz 16MB and used bucketloads of power), hacked to run Slackware. A WiFi modem supplies 4MBps bandwidth (512Kbps uplink) and the hacked APC Matrix 3000 can pretty much power the setup for a week, but Fate intervened.




After so many years, the wife have had enough of the lightning strikes taking out the modems and interrupting her Facebook sessions. She had taken to disconnecting the telephone line from the modem before the storms which saves the modems but do not do much for server uptime.

So it is time for paid webhosts again. I signed up for Amazon's AWS and after a full year's free trial it is time to move the website, this time to AWS with docker and Wordpress, the latter to to sex up the 20-year old website a little.

About time, don't you think?

Saturday 1 July 2017

The "TWO Groups" Section Switch and the Internet of Things

The wife bought a fancy lamp for the gatepost which changes color when the power switch is flipped off and on quickly. I got a chance to look at it when it got damaged by a nearby lightning bolt. It turned out there were two LED lamps inside, one white and the other yellow. An electronic module switches one or the other or both based on the number of times you flipped the power off and on.


Now this is a great way of powering an Internet of Things remote device on the cheap. Say you want to install a WiFi camera and you want to be able to switch it on together with a nearby lamp (for night use), or to turn on just the camera without the lamp, or just turn the light on without turning on the camera. You install this Section Switch so that it powers both the lamp and the camera.

I dismantled the gatepost lamp, and the wife took it back to the shop where she bought it, where she had it repaired for RM20 (less than USD5). The shop replaced the section switch, and returned the defective section switch as proof of repair. You can buy it online (or at your friendly lighting shop) for RM18.

Warning - do not attempt this yourself unless you have had specialist training in switch-mode power supplies. There are lethal voltages in this module.

I thought I would fix the Section Switch just to see how it worked. It is easily opened- just press firmly at the base of the long side of the module and the base plate pops out.



The lights are switched by two 12V relays controlled by an integrated circuit, the JY2608. I am afraid the datasheet is in Mandarin, but don't let that stop you. The original website is a bit spotty- if you cannot get the datasheet place a comment here and I'll email you my copy.

The datasheet has a sample circuit for the JY2608 and it looked like the manufacturer has copied it lock stock and barrel. Here is the sample circuit from the datasheet:



Now the problem with the Section Switch was when switched, the lights took a very long time (sometimes hours) to come on. So we know the problem is related to the power section.

I powered up the defective module with this setup:


Note the use of an isolation transformer (the box with the white power dial) and and a portable ELCB for safety. The Section Switch has no transformer, so the semiconductors are connected directly to the mains power - in this case 230Vac. Some types of faults can cause the module to explode or catch fire if connected directly. Here, the isolation transformer limits the mains power to less than 20W. An isolation transformer can break the Earth connection to your house ELCB, so use an extra ELCB to protect yourself.

I have also secured the wires to a strip of screw terminals for extra safety.

OK, back to the input power problem. I measured the input power to the IC (the JY2608 is a 12V device) at D1 the 12V zener diode's anode and it read 5.8V. That is very far from the 12V it needs. Actually the JY2608 will work at 2V but the relays need at least 9V to switch.

I replaced the 12V zener with an 1N4742A and powered on, but the voltage stayed at 5.8V. So it is not the zener diode but something closer to the input power.

A closer look at the circuit showed that the bridge rectifier (four diodes in the shape of a diamond) is powered by C1 and R1 in parallel, a 1.5uF capacitor and 330KOhm resistor. I tested the resistor using the multimeter (the black and orange thing in the foreground) and it reads correctly at 330K.

Next I replaced the capacitor with a 1uF capacitor I had handy, and now the Section Switch powers up nicely at 12V and the relays clicked when I flipped the mains power off then on. 230V appeared on both outputs so the repair is done.

Now the repair costs some RM3 for the 1uF 400V film capacitor, and it only cost RM18 to buy, not to mention the hazards involved. But that is a little bit of electronics saved from the scrap heap.

The next step would be to hook it up to power an IoT device, so stay tuned!

[2021-05-01 Update] The section switch in the other gatepost failed: when the main lamp is turned on it started flashing, with the section switch clicking away briskly on its own. A diode (D4) in the mains bridge rectifier was shorting. Replaced that with a 1N4007 and it worked like before. In all fairness it is fairly reliable despite its cheap price. My gatepost lamps are exposed to the elements; alternately wet from driving rain and hot from the greenhouse effect of the glass lamp housing. Myriad bugs occasionally lived (and died) there.