Thursday, March 27, 2014

WebCamp KL Internet of Things

WebCamp KL is LVL KL now
WebCamp KL changed it's name to LVL KL (Level up KL?), each speakers has 18 minutes to talk.

The kickstart for 2014 event is on 27 Mar, Internet of Things (IoT). The speakers are Ikhwan, Mike Smith, Swee Meng, Calvin Tee, Chern Shue and Sathyvelu K.

Below is my version of the summary. I pick up those content that I like, and add-on a little bit.

What is the Internet of Things (IoT)?
Connect all devices, other than PC and mobiles to the Internet. Common examples are TV, refrigerator, less common example is temperature sensor to report temperature to the internet.

Ikhwan shares what he saw at Mobile World Congress 2014. The use of NFC, sensors used in cars, and android wear.

How can we build our own IoT?
Swee Meng brief on the hardware available like Arduino, Raspberry Pi, BeagleBone etc. Calvin Tee shows a live demo on remote control the room lighting through network. The lighting device is build with Tiny85 chips (which cost $2 USD only), can be programmed with Arduino software.

What is Arduino?
Arduino is a low power microcontroller, it connect to sensors, can be easily programmed by Arduino Software. Arduino is open-source platform, the hardware circuit design is freely available. It means anyone can use the design and manufacture their own arduino.

Use Arduino to build Segway

Arduino vs Raspberry Pi
Raspberry Pi is a low cost credit card size PC board. It doesn't have hard disk, but use SD card as external storage for OS system and data. Raspberry Pi can be used as a microcontroller like Arduino, to connect sensors, but many people use it as a PC eg. make it into a media streaming box.

The different for me is, Arduino is much simpler, but it is slightly more expensive than Raspberry Pi. For Arduino UNO, the cheapest you can get is about USD29, but it doesn't come with ethernet port. Raspberry Pi price is USD25 for version A, USD35 for version B.

BeagleBone Black vs Raspberry Pi
BeagleBone is a low cost, credit card size pc board like Raspberry Pi, BeagleBone Black price is close to Raspberry Pi (still a little bit higher). BeagleBone is open hardware, but Raspberry Pi is not.

Personally I still prefer Raspberry Pi as it has a better software support. Raspbian is a debian linux optimize for Raspberry Pi hardware.

ATtiny85 microcontroller is from Atmel. You can program ATtiny85 with Arduino Software like you are programming with Arduino. ATtiny85 is very limited compare with Arduino, but very much cheaper as well. ATtiny85 is about USD $2-$3 compare with Arduino UNO cost USD29. As the lighting device shown by Calvin Tee, he just need a ATtiny85 will do.

How to shrink an Arduino project to ATtiny85? Refer here.

How IoT apply to our life?
Sathyvelu K. shows us the Nest thermostat.

Some of you might already heard of Nest, it was created by Tony Fadell, the engineer who created Apple iPod. Google acquired Nest for 2.3b USD in January 2014.

Copenhagen wheel is superpedistrian now. It is a rear bicycle wheel, it works together with your smartphone apps. It learns how you cycle, and the electric motor will kick in automatically when you cycle uphill.

I find this interesting, it doesn't change a lot to the existing system, but with little modification, it improve with today's technology. But I doubt the Copenhagen wheel can be easily installed on all bicycle.

Thermostat and bicycle is not that common in Malaysia here, and people already done it. What else we can do here?

Home appliance
Chern Shu gave a good example. Many household installed with alarm system, many have auto gate as well. But the auto gate system don't talk to the alarm system.

I think you can build a "Nest" for alarm panel, or build a TV set top box as the hub of all the home appliance devices.

What was missing?
What was missing in the IoT talks? No one talks about protocol. When you connected all devices together, they need to communicate with each other. How your alarm controller knows the auto gate has open for more than 5 minutes? You need a protocol, a protocol like MQTT-SN.

Wednesday, March 19, 2014

How youtube works on LG SmartTV

Youtube sure works on Smart TV, as long as your smart tv build in with youtube function. Input text with your smart tv controller is a pain, by pointing the soft keyboard button one after another.

While following the Malaysia airlines MH370 missing news. I am trying youtube on a LG Smart Tv. I notice how youtube works on LG smart tv. Instead of input your name and password through the software keyboard, you login the youtube on LG smart tv with mobile phone (or desktop).

When you login youtube on LG smart tv, the system provide an access code, and ask you to access‎. You activate your device (the smart tv) with the access code provided on the web. The LG smart tv will automatically login for you.

Finally someone has made the process right.

In mobile and PDA, the 4 basic apps are calendar, contact (address book), todo list and notes (memos). In smart tv the basic apps should be video (youtube), photos (flickr, picasa etc), music (iTunes?) and ... let the smart tv vendors figure out the rest.

Thursday, March 13, 2014

Rocky Byun balance a notebook on rock

This is just for fun.

Rock balancing is an art. Rocky Byun is a rock balancing performer, he can balance a notebook like this:

Rocky Byun balance a notebook

This is not an illusion, but you need a lot of patient and practice.

Rocky Byun is so good that he appear in the promotion video for Seoul tourism. He was invited to Dubai for performance too.

The Seoul balancing expert

Rocky Byun Dubai performance

Saturday, March 08, 2014

Tutorial Simple makefile and automake

This tutorial is to help beginners a quick start on Makefile and automake.


Before we started using makefile, this is how we compile program every time after we changed the program:

$ vi hello.c
int main()
printf("Hello, world!\n");
return 0;

$ cc hello.c -o hello

If you have more than 1 source file:

$ cc hello.c foo.c bar.c -o hello

If you have some compiler parameter:

$ gcc -Wall -g -O2 hello.c foo.c bar.c -o hello

You get what I mean. Even with the help of readline (with doskey like) function, compilation will be a pain. When your project is getting complicated, you need makefile to help you to do the job.


This is how a simple Makefile looks like:

$ vi Makefile
# This is a simple makefile

Program = hello

all: $(Program)

    cc hello.c -o hello

$ make [-f Makefile]

cc hello.c -o hello

Makefile is collection of rules. The rule looks like this:

target: dependencies
[tab] system command

The white space before the command is tab. If you encounter error *** missing separator. Stop. Change the white space to tab before the command.

When you type make command. The make program look for all: target, which depends on hello. If the file hello is not there or out dated, the command for target hello will be executed.

There are more features for Makefile like implicit rules and internal macros, but not cover here.


Different unix system may use a different C compile, different parameter option for the compiler. For example, gcc has a -Wall option but Sun Workshop C compiler don't have -Wall option.

The Free Software Foundation (FSF) created an automake software tools to generated Makefile on different unix system. The configure script which will detect the system setting and generate the Makefile accordingly.

How to generate configure script?

Step 1:
Crete these 2 files:

To generate
autoscan -> configure.scan ->

$ autoscan; mv -i configure.scan
$ vi
AC_INIT([helloworld], [1.0.0])

# Checks for programs.


If you are using, it is old. The new version use
If system complain no Just create 1. $ touch

$ vi
bin_PROGRAMS = hello
hello_SOURCES = hello.c

Step 2:
Before you continue further, make sure you have automake and autoconf software installed.

$ aclocal
$ autoconf
$ automake --add-missing --copy --include-deps error: required file './AUTHORS' not found error: required file './ChangeLog' not found

The software should install the missing files. If it still complains some missing files, just create it manually. You might want to have your own COPYING and INSTALL file.

$ touch AUTHORS ChangeLog
$ automake --add-missing --copy --include-deps

$ ./configure

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
config.status: creating Makefile

$ make

gcc -g -O2 -o hello hello.o

Automake is much more powerful that what I have shown you here. This is just to show you a very simple way to quick start a Makefile or automaker.

Thursday, March 06, 2014

Apple CarPlay runs with BlackBerry QNX platform

Okay, Apple's CarPlay which announced earlier, is not just an iOS software, but it runs together with QNX infotainment system in the car. It is confirmed by QNX’s Paul Leroux (read here). Apple is listed as one of the partners of QNX. (check here)

What is QNX? Many users and consumers know little about QNX, especially before BlackBerry acquired QNX in 2010 to build BlackBerry's tablet. QNX is a unix-like operating system (or should I say POSIX?), it is small and fast. There are sources saying that QNX is just about 100k lines of source code. QNX has been there for many years (since 1980s), so it was proven that QNX is stable.

QNX is a real-time operating system as well. Real-time means the system will response in expected time frame. Since QNX is small and fast, it was used in embedded devices, a good example will be network routers. I heard QNX was used in nuclear plant system as well.

Back in year 2000s, QNX release a demo version of their software which can fit into 1 (or 2?) 1.44Mb diskette. The system includes the OS, a GUI (like X-Window) and a browser which works on an Intel platform. It doesn't matter for today's environment as mobile phones and embedded devices storage are counted by gigabyte, but it is a breakthrough at that time as the Palm PDA is 16Mb (not gigabyte) in size.

QNX runs on many hardware devices includes Intel and ARM (which is more than enough). BlackBerry bought QNX to build their tablet (and mobile platform). The BlackBerry tablet failed, but QNX is still strong in some embedded devices, eg. car infotainment system (the car dashboard).

Now it make sense that Apple CarPlay works together with BlackBerry QNX. QNX is stable and proven as a real-time system, needed to monitor the various status of the car. QNX is strong in car infotainment system. Apple iOS as a feature rich system (eg. Siri voice interface), can just plug in and work together will QNX infotainment system as a good match.

Saturday, March 01, 2014

Tutorial: Create fonz fun plug package for DNS-320 NAS

What is fun_plug?
fun_plug is a (hacking) script which will be extracted and executed after the DNS-320 (and other similar NAS) booted. The fun plug package by Fonz which includes the telnet sever, allow user to telnet to the NAS, and use it as a server.

It is safe to install fun plug. Delete the fun plug files, the modification is gone.

funpkg and slacker
funpkg like dpkg, it is a package installer. You can use funpkg to install and remove software. Slacker is the software management tool with (a text-base) user interface.

$ funpkg -i helloworld.txz # install
$ funpkg -r helloworld # remove

There are many ready packages to be downloaded and installed. Refer here.

If the packages are not available, you might want to create you own fun plug package.

Create fun plug package
You need to install fun_plug (0.7), gcc, binutils and other packages (list of software for compile environment refer here).

Once you have setup the compilation environment you are ready to go. Take a hello world example.

$ tar xzvfp helloworld-1.0.0.tar.gz
$ cd helloworld-1.0.0
$ [CFLAGS=""] ./configure --prefix=/ffp
$ make
$ DEDSTDIR=/tmp/helloworld make install

$ cd /tmp/helloworld
$ ls
ffp/bin/ ffp/lib/
$ makepkg
makepkg <name> <version> <release>
$ makepkg helloworld 1.0.0 1
==> /tmp/helloworld-1.0.0-arm-1.txz
$ funpkg -i /tmp/helloworld-1.0.0-arm-1.txz
helloworld installed.

gcc compiler option for DNS-320
I get this from Internet.
CFLAGS="-march=armv5te -mtune=arm926ej-s -msoft-float -mfloat-abi=soft -fno-tree-sink -O0"

DNS-320 cpu is ARM926EJ. ARM926EJ implements the ARMv5TEJ technology.

What is soft float and hard float abi? Hard float abi is a vfp floating point register to process floating point. In Debian Linux define armhf is refer to ARMv7.