DIY Project: Create a Tracking App Part 1

The discussion about mobile phone location tracking of people and tracing back to potential transmissions is one of the hot topics at moment. In Germany we could expect an app officially being launched towards end of April. I attempt to go through the technical considerations by myself. A hands-on coding excursion with Android to use Bluetooth to scan nearby devices and exchange data with them.

The most basic requirements for a tracking app to be successful:

  • A person need to posses and carry a switched-on mobile (smart) phone.
  • The phone must have GPS and Bluetooth feature and both being enabled.
  • The location need to be recorded as fine-grain as possible. Use of GPS is mandatory, the celldata is way too coarse (see previous post). Though we might consider to skip location completely and rely on the paring of fingerprints solely, depending on the approach.
  • Approach 1: We record the location and time of a device (aka person) and transmit the data to a server immediately and try to match data with other devices on the server. Hard to implement in a GDPR compliant way and users most likely wont buy in.
  • Approach 2: We record the location and time on the device and any digital fingerprint of devices nearby. This anonymous pairings we transmit to the server. Once one device is flagged as infected, the server can flag any other device “paired” previously and push (or pull) a notification to the impacted devices. This way most data remains on the device. A more GDPR compliant way of solving this. Some details need to be worked out though in regards of matching and informing the respective user.
  • Approah 3: Even better if we could rely solely on the fingerprint of nearby devices and the timestamp.
  • The more user we have in the system, the bigger the impact and the chance to trace and inform and potentially stop spreading further.
  • We must have a mean to report an infection and inform affected other users (and still stay within the boundaries of GDPR).

Before walking into the Bluetooth space, some facts:

  • The not-for-profit organisation Bluetooth Special Interest Group (SIG) is responsible for thedevelopment of Bluetooth standards since 1998. (Wikipedia)
  • There is a regular update to the Bluetooth standard, by January this year SIG released version 5.2. It takes time for the hardware manufacturers to adopt the newer standards.
  • We need to distinguish between Bluetooth Classic and Bluetooth Low Energy (BLE). BLE was introduced with version 4 and supported by Android 4.3.
  • Bluetooth Classic is designed for continous short distance two-way data transfer at a speed of up to 5 Mbps (2.1 Mbps with Bluetooth 4). BLE was made to work with other devices at a lower speed and greater distance.
  • Android 8.0 onwards support Bluetooth 5 which is a significant milestone for Bluetooth technology in terms of range, speed and power consumption.
  • It is not possible to programmatically check the supported Bluetooth version in Android, though you can check if BLE is available on the phone.
  • The MAC address of the Bluetooth adapter is fixed and can’t be changed (except for rooted phones). This way it becomes the digital fingerprint.

Are we running out of MAC addresses ?

MAC addresses (used by ethernet, wifi and bluetooth adapters), as per IEEE 802 definition, have 48 bits (6×8 bytes).
Sample AC:07:5F:F8:2F:44
This would result in some 281 trillion (2^48) possible combinations, but the first 3 bytes are reserved to identify the hardware manufacturer. For above sample AC:07:5F it is Huawei. The remaining 3 bytes are used as unique identifier, resulting in only 16 million (2^24) unique devices. Quite likely this number would be used up more or less quickly by a big manufacturer. In reality we also could have 16 million unique manufacturer ID’s, Huawei owns about 600 of these, giving a total of currently 10 billion devices. We need to consider this numbers when we talk about unique fingerprints (MAC), though it is unlikely at a country level to have duplicates. In Germany we have ~83 million citizens and about 142 million mobile phones from different manufacturers, small chance that two persons (actually using the tracking app) will have the same MAC address.
You can check/download the identifiers here.

Lets get started with some coding..

Basic: Android to list paired devices

Before we jump into the more complex discovering, pairing and communication between devices (using threads,) we start with the basics. Lets enumerate the paired devices.

Required Permission

At minimum access to coarse location (since Android 6) is needed since Bluetooth can be used to derive the users location. I skip the code to request the permission, only location access being a critical permission. (complete code will be pusblished at the end).

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Check and Activate Bluetooth Adapter

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "bt.MainActivity";
    private BluetoothAdapter bAdapter = BluetoothAdapter.getDefaultAdapter();

    protected void onCreate(Bundle savedInstanceState) {


            Log.i(TAG,"Bluetooth not supported.");
        } else {
            Log.i(TAG,"Bluetooth supported.");
				Log.i(TAG,"Bluetooth enabled.");
				if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE))
					Log.i(TAG, "BLE not supported.");
					Log.i(TAG, "BLE supported.");
			} else {
				Log.i(TAG,"Bluetooth not enabled.");
				startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE),1);

List existing pairings

Quite simple to iterate through the existing pairings and list their name and MAC Address

private void showPairedDevices(){
	Set<BluetoothDevice> pairedDevices = bAdapter.getBondedDevices();
	if (pairedDevices.size() > 0) {
		for (BluetoothDevice device : pairedDevices) {
			String deviceName = device.getName();
			String deviceMAC = device.getAddress();
			Log.i(TAG,"Device: " + deviceName + "," + deviceMAC);
I/bt.MainActivity: Device: HUAWEI P20,AC:07:5F:XX:XX:XX
I/bt.MainActivity: Device: moto x4,0C:CB:85:XX:XX:XX

In the next post we will discover nearby Bluetooth devices and setting up a communication channel between two devices.

Stay tuned for more tracking..


Image by Brian Merrill from Pixabay

Hands-On Amazon Echo Dot and Alexa

Amazon Echo, the voice-controlled and hands-free device/speaker was already launched in the US in November 2014, now 2 years later the Echo, and the Echo Dot second generation, is available in Europe. In Germany it was soft-launched in late October on an invitation base at Euro 59.99, the bigger Echo at Euro 179.-.

Amazon Echo Dot

Amazon Echo Dot

Curious enough about having a glimpse into our household and workplace (?) future I requested one and got it delivered last week Friday. At the size of a hockey puck, the device contains 7 microphones, a simple loudspeaker, WLAN and Bluetooth connectivity. No battery, so the Echo must be connected to a USB power adapter at all times. I must admit, the idea of having a “spy” device with microphones permanently listening into my room brings up some privacy concerns, though Amazon claims only the keyword (Alexa, Echo or Amazon) is activating the device, it’s LED ring starts to turn blue, and the spoken commands get transferred to the Amazon cloud, using the Alexa Voice Recognition Service, on which Amazon supposedly spend a 100 million dollars.

Amazon Echo Dot

Amazon Echo Dot

Here a first hands-on experience resume:

Being an Amazon user with a Prime account and already a Kindle and a Fire HD tablet at home, the setup takes less than 5 minutes, inclusive of setting up a WLAN connection from the Alexa App to the device, preparing the WLAN access from the device to your AP and connecting it via Bluetooth to the home theater system. The device is woken up with the keyword or by pressing one of the four buttons on top of it, followed by your question or command.

It does not run a conversational model in the basic use cases, though the skill sets support sessions ! You raise a question or trigger a command, that’s it. It wont ask back (yet). It will respond with the right answer or execute what you have asked for, or respond it if it does not understand you, sometimes it wont do anything at all after activation other than showing the blue ring (maybe due to noisy environment). The basic services available are rather simple or move around the Amazon product landscape, most prominently playing music on demand from the Amazon Prime Music offerings, ordering products from Amazon or responding with the weather info or respond to simple Wikipedia style questions. The power of the device is unfolding with the skill-sets that allow third parties to offer services based on the Alexa services. This can be house-automation, ordering pizzas and other consumer services. Being a regional feature there are about 3,000 skills available in the US but only about 2 dozens in Germany at the time of writing.

My kids had a Sunday afternoon fun time to play with it and trying to fool with it, though at this stage it wears out pretty fast after hearing “I don’t understand your request” and similar responses if you leave its pre-programmed comfort zone (it is interesting to observe how kids approach such a device). Be aware of the Eliza Effect using a device with a synthetic voice and human-like response.

What makes it particularly interesting to me is the evaluation of a completely voice based service and the platforms extensibility through the Alex Skill Set and the API’s that Amazon provides. You find lots of information at the Amazon developer portal and you can even join the Mashup Contest.

In short, right now it is still a toy but with lots of opportunities to come up in the near future. I will look at the potential use cases in a aviation environment, both operational and as passenger and keep you posted.

Amazon Echo Dot

Amazon Echo Dot

While using the Echo I feel a bit like talking to Hal 9000 in the 1968 film “2001: A Space Odyssey” directed by Stanley Kubrick. Echo does not yet have an attitude.

Hardware Hands-On

You have little chance today to get your hands dirty with electronics or computer hardware, either we deal with small devices like mobile phones, tablet and notebooks which are not made to be opened and tinkered with or our hardware is virtual only and sits in the cloud (no screwdriver required). Few people now still own a desktop size PC where one can add or change hardware (major hardware companies claiming massive loss due to dropping sales in this market).
During my studies in the 90’s we still dealt with CPU’s at a very low level which helped to ‘see’ and understand what’s going on.

If time allows I am doing some DIY  projects with Arduino or Raspberry Pi, 2 electronic platforms which seam to be similar at the first glance, but operating very differently.

The Arduino is a progammable microcontroller, designed to work with sensors or to control external components like relays or motors. Is a very hardware oriented device, no OS or whatsoever included. It does basically what you program it to do. More info and getting started at



The Raspberry Pi on the opposite end is rather a miniature computer, running an OS from a SD card and equipped with ethernet, HDMI and USB plugs. It is clearly more a software platform which can be used for more powerful applications than the Arduino. More info and getting started at

You have the option to combine both, to have processing power of a computer and the myriad of inputs and outputs to the real physcial world.

Raspberry Pi

Raspberry Pi

Crowdfunding Projects I back (2)

Another small project I backed is the Gamebuino, an Arduino based retro game console. Simple concept to pick up basic game programming with this 8bit gadget that reminds me of the Gameboy that Nintendo launched in April 1989. Amazing, the one-man project managed to gather 1.000% of the funding he asked for. The device was funded for 25$ as early bird backer.

Hardware History Lane – Casio Cassiopeia

Over the years we spend a lot of money into gadgets and electronics, only to see its value dropping to zero and being out-dated the moment you open the box the first time. While doing some spring cleaning I unearthed the  Casio Cassiopeia that I bought in 2001 (for ~800.- DM) , surprisingly it still charges and works.

Casio Cassiopeia

Casio Cassiopeia EM-500G

This is EM-500G, a slimmed down version of the E-125. Some specs:

  • CPU: NEC VR4122 MIPS (150 MHz)
  • Memory: 16 MB ROM
  • Display: LCD, 240 × 320 Pixel, 65536 Farben
  • Interfaces: Seriell/USB and IrDA
  • MultimediaCard Slot
  • Windows Poecket PC 3.0

Compared to todays mobile phone and tablet hardware seems like nothing (vs. eg. a dual-core 1.7 GHz and 2GB of a Samsung Sx phone).
I am just wondering what we gain in 13 year with CPU speed times 10 and memory times 100 from a user point of view ? Yes, we have Android and iOS with 1.000.000 applications to download, 3D Games on HD screens, music and videos (the Cassiopeia  can handle that too to some extent), but the basic features are still the same. I used the Cassiopeia that time to remote dial in into Unix servers, using a Siemens S35 as modem.

Casio Cassiopeia EM-500G


Crowdfunding Projects I back

Crowdfunding becomes more and more popular with many successful projects coming out of the various platforms in the web (most Kickstarter and IndieGoGo). I like the idea of independent smart people coming up with an idea and let a product or concept take off without backing by a huge MNC (though these companies might buy a crowfunded project and turn off supporters, but that is another story). I believe crowdfunding can be a source of genuine products which are not made solely to hog patents and increase shareholder values.

Doing panoramic and spherical photography for more than 15 years now, I am excited about the new ideas, technologies and products coming up.
Sometimes you should follow your ideas or visions, I did some basic research for an own panorama rig similar to the projects below back in 2007 (link), but did not really complete the project and with the requirement to export the images and stitch them in the PC it was not very practical. In 2007 I did not see the option to stitch with hardware on-board.

One already successful funded project is the Panono Camera Ball (a camera in the shape of a ball thrown into the air to snap an full spherical images with 36 small cameras built-in).


2 new projects that are still in the funding phase I back with 300 U$ each. Both try to create 360 degree images and videos

The CentrCam
At the time of writing the project still have to fund another 360.000 U$ in 6 days, seems to become unlikely being successful.

The 360Cam
which is already 280% founded.

Lets see who makes the race (they are not competing I guess) but is a bit strange that the 360Cam has a target of 150.000 $ only, with a much richer feature and quality list compared to the 900.000$ target of the CentrCam that would output video in a lower quality and smaller resolution. Anyway lets wait for the funding results, I am happy to support both (at least I add both to my panorama collection).