Monday, February 19, 2018

Create a powerful Bluetooth based Network of Beacons

Beacons are not just for increasing sales or giving out more interactive physical environment to enhance user's experience. Beacons can be a powerful tool to detect patterns before a major catastrophe can happen resulting in the protection of properties and life.

A network of sensors for monitoring temperature and humidity, detect if an object has moved when should not have moved, an employee forgot to close the window or door, an employee stayed too long at the pantry or know how many customers checked a certain product are just a few of the useful data that can be collected with the networked beacons.  

The above figure shows all the necessary beacon types one will need to implement a networked beacons. 

Here are the actual images of the sensors and the gateway:

The Kit:(This is a great package to test a lot of use case scenarios. Available at olx.)

The Kit includes the following beacons(excluding the Apps Factory Beacon):


Size: 90 x 60 x 4 mm
Ibeacon Only
Disposable(Battery can not be replaced)
This is an ideal substitute to rfid badges

Size: 72 x 72 x 18mm
Ibeacon + EddyStone
External ON/OFF switch
Battery can be replaced


Size: 42.5 x 23.5 x 5.3mm
Ambient Light Sensor
Battery can be replaced


Size: 150 x 150 x 36mm
Bluetooth to Wifi Gateway
MicroUSB Power Input(5V1A)

Size: 72 x 45 x 22mm
Ibeacon Only
200m Range
Battery can be replaced

Size: 50 x 50 x 15mm
Ibeacon + EddyStone + Accelerometer
External On/Off Switch
Battery can be replaced


Size: 70.6 x 38 x 17.8mm
Ibeacon Only + EddyStone + Temperature + Humidity Sensor
Battery can be replaced

Apps Factory Beacon with Buzzer:

Wednesday, February 14, 2018

IT Company and Manpower Agency

An IT Company develops its own products and sells them to end users. They own the copyrights and their products are original.

A Manpower Agency recruits individuals and deploy them to their so called "client". These manpower agencies always dominate job sites and facebook groups for programmers.

There is a big question why manpower agencies name their companies as IT Companies to disguise themselves as IT Companies. A big question is why do they do this? This tactics originates from the USA and usually funded by the Chinese with Indians as their partners where ponzi schemes abounds.

I was lured into this because I was really in need of money and these scammers offers job with no interviews but offers no security but I was in it for the quick cash and I am not ignorant that these people are actually scammers they will say they are an IT Company which I dont believe or shoyld I say never believed at all. These are usually females walking all over the metro they easily fill in any available space like when you're eating at a mall and there is a vacant seat, 99% of the time, it will be filled up by a female recruiting or selling anything under the sun or when you ride an fx or jeepney, 99% of the passengers is always females. I am not a female hater I have just observed that their numbers is way too much to take. It is just too abnormal and vommiting. My mom does not go out much nor my relatives nor our neighbors. Is living in a small space makes them go out and hunt for something all the time? Is there someone that tells them they should always stay on the street? I dont see them buying, they just walk all over  and keep on riding public transport. I just wonder what they feed on.

These females are so proud of their jobs, I've read an article written by these females and they think of themselves as IT managers as she wrote, the client complained that she gave them a junior but they asked for a senior. I just could not imagine that they treat programming jobs as a commodity this female described in her article how she was able to pull out the junior and replaced him with a senior. It was a glorified scamming scheme and yet she's so proud of it.

Monday, February 12, 2018

An Update to the Ibeacon Scanner App for Android

I have found a time to review the source code of the Ibeacon Scanner App and it would be easy to add the feature to include scanning Eddystone Beacons. To do this, the file needs to be modified to detect the 3 Eddystone frames(UID, TLM, URL).

Here is the portion of the file that needs to be modified:

public void onLeScan(final BluetoothDevice device, final int rssi, final byte[]                             scanRecord) {
           int startByte = 2;
           boolean patternFound = false;
           while (startByte <= 5) {
           if ( ((int) scanRecord[startByte + 2] & 0xff) == 0x02 && //Identifies an iBeacon
                //Identifies correct data length
                ((int) scanRecord[startByte + 3] & 0xff) == 0x15) {
                 patternFound = true;
        if (patternFound) {
            //Convert to hex String
           byte[] uuidBytes = new byte[16];
           System.arraycopy(scanRecord, startByte+4, uuidBytes, 0, 16);
          String hexString = bytesToHex(uuidBytes);

        //Here is your UUID
       String uuid = hexString.substring(0,8) + "-" +
                             hexString.substring(8,12) + "-" +
                             hexString.substring(12,16) + "-" +
                             hexString.substring(16,20) + "-" +
       mRSSI[mElems]= String.valueOf(rssi);
     //Here is your Major value
        int major = (scanRecord[startByte+20] & 0xff) * 0x100 +                                                                    (scanRecord[startByte+21] & 0xff);

     //Here is your Minor value
        int minor = (scanRecord[startByte+22] & 0xff) * 0x100 +                                                                     (scanRecord[startByte+23] & 0xff);
       runOnUiThread(new Runnable() {

The variable  patternFound was used to detect the ibeacon pattern and the scanRecord variable currently contains the data being processed and which is being examined whether it contains the ibeacon pattern. And from this, we can already insert the code to identify the current contents of scanRecord if it is an Eddystone pattern.

Thursday, December 28, 2017

Eddystone URL Encoding : A Beginner's Guide

For beginners who need to know how to convert url into UINT8_T, This can be a very helpful information:

To begin with, beginners need to know exactly what the URL frame contains and here is the details:

The first 9 bytes of the frame are just prefix. To check the content of the prefix value, see the picture below:

The 10th and 11th byte is constant having the value "AAFE". And starting on the 12th byte is the actual eddystone frame which is broken down into the following:

Frame Specification

Byte offsetFieldDescription
0Frame TypeValue = 0x10
1TX PowerCalibrated Tx power at 0 m
2URL SchemeEncoded Scheme Prefix
3+Encoded URLLength 1-17

The URL prefix have constant designated values:

URL Scheme Prefix

The URL Scheme Prefix byte defines the identifier scheme, an optional prefix and how the remainder of the URL is encoded.

The URL Expansion also have constant values:
14..320x0e..0x20Reserved for Future Use
127..2550x7F..0xFFReserved for Future Use

And the remaining strings in url are converted to hex ascii codes. The URL is 17 bytes including the expansion value.

Here is the raw data from nRF Connect App:

And here is the actual raw data:

To Interpret the data
Byte offsetFieldValue
0Frame Type0x10 
1TX Power0x04 
2URL Scheme0x00 = "http://www."
3+Encoded URL0x06D696E65777465636807
The last 2 digits "07" is the URL extension for ".com"
0x06D696E657774656368 when converted to string is "minewtech". I used the foloowing website for the conversion:

Combining the decoded data that we will get ""

Sunday, December 24, 2017

Google Nearby Troubleshooting Guide and the Minew Eddystones

This serves as a continuation of my post Google Nearby 101. As I have mentioned in my previous post, there are a bunch of cons that a developer should be aware of using Google Nearby. In summary, here are the cons:

  1. smartphone has to be connected to the internet
  2. the screen must be opened to receive the notification
  3. bluetooth and location services must also be turned on
  4. notification had no sound
  5. the notification disappears all by itself after 10 to 20 minutes(sometimes less than 2 minutes)
  6. once the notification is deleted, it will not reappear too soon because of google's standard notification backoff policy

One important information that I have not mentioned in my previous post although it is not con but it is very important is that the URL must be "https" other than this, the configuration will not work.

Knowing the cons can help in speeding up the development of Apps. Another important aspect to take note of is that the Nearby Service is not in the hands of developers and there are occasions when Google shuts down the service which may trick other developers which will make them think that Google NearBy is not stable. Based on my personal experience this is how I was able to determine that when my smartphone is not able to get the notification and the cause is that the Google Nearby Service is not running is as follows:

I used several apps to check if my eddystones are working like the following: 
  1.  Ibeacon Detector. This app when run in Android 6.0 shows the different frames coming from the eddystones by refreshing the screen each time it receives the new frame. If there is no new frame received, the screen does not refresh so I know when the eddystones is not working.
  2.  nRf Connect App. This app does the same thing as the Ibeacon Detector app but it identifies the frame type and shows each values it receives with proper labeling like the temperature, uuid, instance id, etc. so this is better the Ibeacon Detector App.
  3. BeaconSet+. This app shows all the frames it received and it does not refresh the screen. It will not be able to detect the eddystones if the datat it receives is incomplete.
 I use these 3 apps to confirm if the source of error is coming from the Google Nearby Service using the logic: "My eddystones are working but I am not able to receive the notification but I confirm that a few minutes ago, it was working fine."

The Hardware
For some other reasons, knowing better the Eddystone being used can also be very important. As a developer, your knowledge of how the eddystones work should be at leas above average or at least know more than the end-user. You should be very familiar how it operates and know when the battery is still fully charged.

The eddystones I am using(Minew I6 models) operates this way:

  1. Upon insertion of the battery, it goes to connectible mode for 1 minute. During this mode, it will not transmit the URL and TLM frames. 
  2. You can use the nRF Connect to configure the eddystones while in connectible mode.
  3. Google Nearby will not work during this 1 minute period.
  4. I determine if the battery charge is weak when I put 2 beacons in close range which will make them compete to get their signals be received by other devices, and the ones that loose is the one with weak battery charge. Although the measured battery charge level shown in nRF Connect can also be accurate.
For now, all of this information is based on my personal experiences which I am so willing to share.

Wednesday, December 20, 2017

Locating a Point Using 3 Beacons

Beacons can be used to track the movement of object on a given space like in our example, is perhaps a Fashion Store with a regular  rectangular shape. Assuming the object is a smartphone with a beacon app installed and has stable internet connection to transmit data back to the shop owner's back end app. These data will be the rssi(received signal strength) of each beacons received every 1 second.

The back end app by default, knows exactly the position of the three beacons.

So with these sets of data available, the location of the smartphone can be traced every second using trilateration algorithm which is a process of finding the location of the point using the geometry of circles, spheres and triangle. More information about trilateration is in wikipedia.

Using the rssi transmitted by the smartphone, and since we know the distance of each beacon from each other(d and e), we have a lot of data to use in determining the exact location of the point. We will also assume that all points of interest in the scenario lie on the same plane. The formula for computing distance in meters from  rssi is as follows:

RSSI = -20 * log10(distance in meters) + RssiAtOneMeter
distance in meters = pow(10, (RssiAtOneMeter - ReceivedRSSI) / 20)

source: Evaluation of the Reliability of RSSI for Indoor Localization

In the above picture, we can easily determine the value of x and y by Trigonometry's Pythagorian Theorem:

Using the eaquation:


Sunday, December 17, 2017

Google Nearby 101

It has been a huge challenge for business owners how to get people download their apps so that they can send notifications containing rich information about their products, services and promotions. One of the best idea how to get people's attention is to send them notifications even if they have not downloaded the app. This is a good idea aside from hiring somebody to be stationed in front of the store to convince people download the app and giving away flyers. The advantage of the electronic form is that it can be done 24/7 all year round.

Google introduced sometime in 2016 the Physical Web integrated with Chrome Internet Browser and using Eddystones. But the transmission and detection is intermitent and unreliable so it did not became very popular. About 7 months ago(not so sure) Google introduced the Nearby Messaging Service to replace the Physical Web and I only got to know about this 3 days ago and since then, I had been experimenting with it. Based on my tests, this is more stable and reliable even though the greatest setback is that the smartphone has to be connected to the internet to retrieve information about the beacon and in order to receive the notification, the screen must be opened and bluetooth and location services must also be turned on. But at least the service is consistent and stable. I also noticed that the notification had no sound at least on my cherry mobile flare xl 2 and the samsung s8 which I experimented with at the concept store and the notification disappears all by itself after 10 to 20 minutes. I wonder why google did not made the notification the same as receiving an sms message. The aliexpress app had the same notification characteristics as the sms messaging. Or at least google provided a way to let users configure it that way. And lastly, do take note that once the notification is deleted, it will not reappear too soon because of google's standard notification backoff policy. I figured a way to make the notification reappear quickly by disabling - enabling the bluetooth service.

All android smartphones with at least KitKat(4.43) version had this Google Nearby. And are ready to receive the Eddystone signal. The photo below is the screenshot of my SKK Android Kitkat showing the notification from google nearby and the physical web software. Both notifications came from the same eddystone beacon. In this device, both google nearby and physical web are not reliable. I just forced both software to detect the beacon signal.

Here is how I made the google nearby worked:

1. I created a Google Cloud Platform Project. This should be easy because if you are in the Beacon Dashboard which can be found here link, The first screen will abvice you to create a project.:
And here is the project I created:

2. After you created the project, it will take you back to the first screen and click your project to select it.

3. Download the Beacon Tools app in Play Store to register the beacon. Open the app and it will ask you to choose your project. Just select your project and the next screen will detect your beacon unregistered. The screen shot below shows the Eddystone URL frame. This frame cant be registered in Google Nearby. Only the UID or EID frames are allowed which I already did. Just make sure that the eddystone is in connectible mode.

And here is the registered UID Frame:
And here is the registration screen:

I only populated the Description field and saved the registration on this android app.

4. I went back to the Beacon Dashboard and clicked on the project and it has taken me to the screen that lists all active beacons on that project.

5. I clicked the active beacon I registered in the Beacon Tools app, and has taken me to a screen that allows me to further configure the beacon:

In this screen, I populated all the fields and added just one property and went to the second tab(create attachment).

 Even though I had no idea what it is for, I just created a dummy data:

And here is the attachment I created:

And lastly, I created the Nearby Notification:

I saved the data I entered. My main objective here is to just send a notification message which when clicked, will open my blog to an internet browser on the smartphone.

And here is the final result showing the Eddystone URL link:

I have not explained in detail what each fields are for because I am also a beginner trying to make the Google Nearby work and so that I can check if it is stable and yes it was! There are other message types that will allow the user to open the app of the eddystone owner if it was already installed or will open the google play store which displays the app and the user will have to click the download button and install the app.

To complete my experiment, I went to a nearest Samsung Concept store and brought along my Eddystone to check if other android smartphones can detect the signal without doing any configuration and it was a success, I did not took any picture because I did not bring along my phone so that I can fully test it. Bringing along my phone could influence the result.

I still see a lot cons than pros but the best part of it is that the service is very stable and reliable and google has solved the huge problem how to get people' attention to get them download the business owner's app.