Read Part 1 here

I have updated the Pulse Sensor project to give the Pulse Receiver a GPS. 

Now the Pulse Sender (the wearable that you will strap on your wrist) will send your pulse rate to the Pulse Receiver (which you will wrap around your waist) and then, apart from learning about your pulse rate, it knows where on earth you are.


I added a NEO-6M UBLOX module that I purchased from Taobao. It uses the TinyGPS++ library. 


How It Works


The Espressolite is a ESP8266 based microcontroller and the one that I feel the most passionate about; it is built as a collaboration between Espert Pte Ltd, a Singapore company, the folks from Chiang Mai Maker Club in Thailand, and based on the popular ESP8266 chip, developed by EspressIf Systems, based in Shanghai and also founded by a Singaporean. The Espressolite is manufactured by Cytron Technologies, from Penang in Malaysia. Whenever I need to tell a story about a collaborative invention, I share about the Espressolite. 

Thanks to Google Cloud Platform's free tier and $300 credit, I have been spending more time building on GCP. As I start to call GCP home, it's time to dress it up. My objectives are as follows:

  1. Setup a web-based configuration tool. I lived through the command-line era of MS DOS in the 80s and 90s but like most people, have long gotten used to the point-and-click interface. This will help me get productive again. Webmin is free and received a nice face-lift recently.
  2. Give my VM its own domain name - GoDaddy sells them cheap for the first year. 
  3. Do SSL.


SSH into your VM. Edit your source list:

Use Case

My buddy, Mark and I have been hanging out on supper dates for the past 18 years. Sometimes he pays first and I forget to pay him back. The reverse happens at other times. We don't trust each other to maintain an Excel file to capture the records. I mean, look, what if Mark doctors the Excel file when I am not looking. This is obviously a great candidate for blockchain - now our records becomes immutable and the history of our misspending are forever etched in the blockchain.

This is what I set out to achieve in my Go-Dutch contract:


Mahesh Murthy has an amazing tutorial to setup an Ethereum environment to develop Truffle Dapps on the Ethereum blockchain. You can read it here. Part 1 of the tutorial explains the architecture of the Ethereum platforms and lets you execute a smart contract via a simple web page that runs locally. The blockchain runs locally using testrpc.

In the second tutorial, Murthy deployed the smart contract on Ropsten, Ethereum's testnet blockchain and runs a Truffle Dapp web application to allow users to interact with the smart contract. The Dapp runs locally.

Like how new recruits in the army are required to do a few pull-ups before lunch, I make myself complete at least 2 Codility challenges a week. If nothing, it helps to keep the mind thinking algorithmically - which I believe is a good thing.

This challenge requires one to cycle through a series of numbers in an array for N times. For example, given the array A = [3,8,9,7,6], to cycle this function once, it becomes A = [6,3,8,9,7]. Notice that the last element becomes the first, and then every other element moves 1 place up. 

To cycle it twice, it becomes A = [7,6,3,8,9].

To cycle it thrice, it becomes A = [9,7,6,3,8]. 

In essence, you are removing the last element, and then moving every element up by 1 place, and then putting the last element back into the first place. 

To achieve this, I used 2 loops, one to iterate through every element in the array and moving them up, and another one to do it n times.

Can a $5-a-month virtual server run an OAuth2 Server? My virtual server has been my testbed for many IoT projects that make Web API calls to the web services that I have developed. None of these were as secure as I want them to be because I have never gone around implementing an OAuth2 server. Instead, I had mostly depended on POST with username and password to authenticate a user. This is not optimum and definitely not elegant. How do I even sleep at night!?

My $5-a-month virtual server runs PHP and MySQL, so I set out to find out if a PHP implementation of an OAuth2 server will allow me to authenticate my Web API calls. B. Shaffer's OAuth2 PHP Library is what I used:, and this is a documentation of how I did it.

What I Did

The 2nd Codility lesson is to search for the odd number of elements in an array that cannot be paired with any other element. Codility provided this example.

A[0] = 9, A[1] = 3, A[2] = 9
A[3] = 3, A[4] = 9, A[5] = 7
A[6] = 9

Apart from A[5], every other element has a match. The first thought is to iterate through the array and look for the pair and remove both elements once it is found. When an element cannot find its pair, break from the loop and return the element. Simple enough, so I coded. 

It works for a small number of elements but Codility needs this to run in less than 1 second when tested in big random sets with 999,999 elements. My solution runs in time for only tests with 2,001 elements or less. 

And this become a revision for bitwise operators after reading the comments in Codility. This was the final answer, adapted from what another programmer shared.

Codility is where programmers receive programming tests as interview questions. This is also where programmers could learn to code. I am at lesson 1 on Iterations, and here's my answer. It finds the binary gap of a number. A binary gap is the longest sequence of 0 of a number converted to binary. For example, the number 5 is 101 is binary, and it contains 1 zero, so it's binary gap is 1. The number 1041 is 10000010001 in binary. It contains 2 sequences of 0, the first of which is 5 zeros long and the second is 0 zeros long. So its binary gap is 5, since the first sequence is longer than the first.

I got 100% and did it in 15 minutes and....2 tries. During my first try, I got excited and forgot to initialize my numZero variable back to 0 after it found each sequence of zeros. Careless me!

I maintain sanity by running little projects in the evenings after the family goes to bed. Over the years, I wrote codes, built little gadgets and fiddled with anything that interest me at one particular point of time. Some of these projects eventually becomes part of what I use for my day job teaching technology in my school. Others become starting points for company-based projects.

I think it will be fun to document this process as I learn as I have become a lot more active in building stuff lately. If you find something you like or want, or if you found that I have been quite wrong to attempt things the way I did, feel free to tell me. 

If you are a company who sees commercial value in what I do, come and take it.

If you want me to do something for you, feel free to ping me.