Web development (LAMP)

Most of my customers are SMEs and the software development budget is limited.  LAMP (Linux-Apache-MySQL-PHP) is a good choice for them. They are free, open source and many development resources available in the Internet.

Open source is important when you encounter a problem likely locating inside the framework. By tracing the source codes, you have chance to twist your workaround.

I use Linux a lot. My favorite distributions are Fedora Core, CentOS and Redhat. Fedora bundles with the latest software package. As a R&D developer, you have chance to test your source codes with the latest software technology, and avoid legacy coding style. I sometimes use Ubuntu for Android host development.

One of my latest projects is Moda Diet Consultation System.

By using this system, dietitian can monitor client’s diet, activity and weight efficiently.

Apart from the App development, I participated most in the REST OAuth2.0 API server using PHP. It is a fun project and it relates to your daily life.



Wearable development – Glance

Glance is a wearable brand initiated by Anvil Ng, who was the founder of CWB Tech Limited.  It is a hand band designed for runners who want to know more about his running performance.

Internally, it is an SDK for R&D team to capture motion sensor data. The SDK was also adopted by HKUST engineering school as a course equipment.

I have acquired two unique knowledge from this project. One is ultra low power design, the other is motion modelling.

In Glance SDK, I have to keep my pedometer algorithm active with power budget under 80uA@3.7V. In wearable world, power budget is the key success factor. If Apple watch play time can last for a week, I believe there will be much more consumers using it.

Motion analysis and modelling is an interesting topic. Here are some demonstrations of the experiment I conducted with Glance SDK. If you are interested, free feel to Skype me.

Knee shock experiment (click the image to view the video)

TaiChi workout (click the image to view the video)

(Special thanks to Master Titan Lam)

Snooker Waggle Analyzer

 Glance Waggle Feasibility Study

(Special thanks to James O’Shea)


Swimming motion capture is tricky because water absorbs most 2.4GHz wireless signals (e.g. Wi-Fi, Bluetooth, BLE and etc). You will need a non-volatile memory storage (e.g. SPI NOR) in your wearable.

This is my breaststroke motion capture. There are some swimming wearable in the market, which applies accelerator only. However, swimming is a combination of angular force and linear force. With the additional gyroscope sensor, much more information can be captured and analyzed.


Sleeping motion capture and analysis is relatively simple. All your concern is to keep the power consumption as low as possible and having an efficient data structure to store aggregated impulse information.


Pedometer algorithm is easy when the wearable is on your body trunk. There are a lot of research papers talking about it. However, when the wearable is on your wrist, there is additional hand movement force for the algorithm to handle.

Since the accelerator chip vendors (e.g. STMicroelectronics) have bundled pedometer algorithm in their solution, application software engineer needs not to touch the detail. However, it is still good to know how your walk/run motion look likes. In reality, the motion cycle is not just a peak and a valley. There are many walking gesture introducing multiple peaks. Traditional pedometer algorithm are especially weak in running (hand motion vector dominates) and walking while playing Pokemon Go (suppress motion amplitude to hold the mobile phone steady). There are still some room for pedometer market leaders to tune the algorithm.

Golf Putt

Putt with Glance is possible with similar accuracy. The major problem is that you cannot wear Glance at your wrist. It is because the golfer may twist his wrist during the swing and it is relatively difficult to model with my algorithm. In other words, mounting the wearable gracefully on the club is the remaining product design issue.

Gadget development – 3BaysGSA

The 3BaysGSA idea was from Marcus Lui, who was a golf fanatic. In 2010, there was no handy tools to measure golf swing gesture. He asked the R&D team to design (and deploy) a golf swing analyzer gadget with motion sensor technology.

In 2012 Q2, we deployed it to the golf gadget market and tt was launched successfully because the gadget was relatively accurate and portable to use.

The software R&D involved was very comprehensive. Let me quote some examples:

  • Firmware – low power consumption but working with high speed (e.g. 800Hz) motion sensors.
  • Connectivity – Bluetooth SSP with MFi. Data compression to improve data transfer rate. Re-transmission mechanism when some data trunks were missing or corrupted.
  • Algorithm – the computed golf swing parameters should be comparable to radar grade equipment, such as Trackman and FlightScope.
  • App – It touched various effort intensive topics – data sync between app and gadget, data sync with app and web backend, local database, bluetooth connectivity, ffmpeg, and OpenGLES(in Zone app).
  • Web portal – Frontend and backend.

You can find other resource or sharing from the Internet.  In this blog, I would like to talk about the algorithm research in this blog.

The algorithm tried to find the swing locus and the orientation of impact point. It started from the displacement equation that we learnt in the Physics lesson:

We have an assumption that the initial velocity is always 0. The accelerator can measure the linear acceleration and the gyroscope can measure the angular acceleration. By double integration, it can compute the displacement.

A high speed golf club movement photo captured by my stroboscope and DSLR.

Since the force applied in golf swing is huge and the motion sensor noise is limited, the signal to noise ratio is good for locus modelling. During the ball impact, the motion sensors record momentary big noise.  The following graph is a typical golf swing motion sensor graph:

Apart from golf swing analyzer, motion sensor gadget can be applied in many different areas. Locus (displacement) could be difficult if your signal to noise ratio is not good.  On the other hand, acceleration (and maybe velocity) algorithm should be easier to implement. There are various sport workout product available in the market in 2018.

I learnt golf when I led this project. I need to generate a lot of swing data capture and compared it to the results from the radars. However, I have no talent in golf. Not sure if I have chance to play it again in US.  😀





Android host development

Android phone development nowadays is easier. You hardware board always comes with good processor, reasonable amount of RAM and internal storage (e.g. NAND). The chip vendor Android SDK is very stable.

The peak period of my Android host development was in the age of Eclair, Froyo and Gingerbread. At that time, the flat-ship hardware was HTC Desire.  Hm…. slow in 2018? The application software requirements could be demanding because most of the apps were not integrated with hardware accelerated codec. The GPU performance was very limited and it could basically drive a SVGA frame buffer.  All developers were learning how to design a better smart phone. With the opportunities granted from the brands, we deployed ZenTouch2, W920 and xtraTV.  It was not easy to build an Android R&D team from scratch in Hong Kong.

One of the platforms I spent more time was Freescale (NXP) i.MX51.  At that time, the CPU was ARM A8 800MHz and the RAM was mDDR 256MB. Running early Android in this kind of configuration is always challenging.

Nowadays, the mobile processors are very powerful. They can accomplish the job at a lower voltage (by DVFS).  It will dissipate less heat.  On the contrary, in the old days, processors were always running at full force and generate much heat.  Heat dissipation was a big mechanical design issue.  Also, if you plan to acquire the Google certification, the CTS requires you to bundle quite a lot of hardware peripherals in your Android device. If the end-users turn them on at the same time, they can feel the heat immediately.  A defensive approach is to limit your CPU voltage when the temperature sensor reporting it is overheat.

Another common problem I came across was OOM.  Back in 2010s, the common RAM configuration is 256MB.  For a general purpose Android OS, the capacity is not much when the end-users operate multiple Apps (notice that there are system apps and background apps running as well).  The VM heap size for every App were very limited and it introduces tight memory requirement to Android App developers.

I would like to talk more about the xtraTV R&D, in which we learnt a lot from mistakes. xtraTV is a Android box connecting to TV.  It was a pioneer of similar products. At that time, there were a few Apps supporting large TV screen resolution (e.g. 720p or above). Not much chip vendor provided RTM Android SDK with HDMI interface. Google CTS did not grant such hardware configuration with Google Play, which implied that you have to maintain your App community. End-user expected free multimedia channels/content and your business could not ride on illegal Apps.

xtraTV did not generate good sales. It was too early to the market. Although the mission was very tough, I learnt a lot of cross-domain technical know-how with my old teammates.

 xtraTV@siukoonHome 2018

MP3/MP4 development

Before Apple dominates the mp3/mp4 market, I specialized in mp3/mp4 product integraion, and have enabled 5 millions+ players to the world.

In the old days, as a young engineer, developing consumer electronics gadget was challenging.  You have to evaluate the best development platform, assist hardware teammates to design schematics, board bring-up prototype, code your firmware with power consumption and RAM/ROM memory limitations, integrate connectivity (e.g. USB, bluetooth, BLE and etc) with the counterpart system.

I was lucky to be given the chances to work on new platform and new technology.  Although it was very challenging, it built up my knowledge in embedded system.

If you ask me which mp3 player I like most, I would like to nominate Sandisk Sansa Express and PD-03. The mechanical design and form factor is perfect.