Tuesday, December 8, 2015

OPENCV on Python on my WIndows 8.1 tablet

I have just installed OPENCV on Python on my WIndows 8.1 tablet and I have been playing with it like crazy. Opencv is a powerful tool to programmatically manipulate an image. It is like a low level version of Photoshop. And what happens when a programmer gets to programmaticaly manipulate an image? The possibilities are endless.

I had skipped the "hello world" part because I am not new to opencv and here is what I have tried to develop as part of my learning: finding the exact location of a small image taken from a larger image.

This ois the large image:

And obviously this is the small piece of image:

 And here is the result:

And here is the python code I used:
# import the necessary packages
import numpy as np
import cv2

# load the big_image  and small_image  images
big_image = cv2.imread('C:\\Users\\mybook\\Documents\\alpha.jpg')
small_image = cv2.imread('C:\\Users\\mybook\\Documents\\piece.jpg')
(small_imageHeight, small_imageWidth) = small_image.shape[:2]

# find the small_image in the big_image
result = cv2.matchTemplate(big_image, small_image, cv2.TM_CCOEFF)
(_, _, minLoc, maxLoc) = cv2.minMaxLoc(result)

# grab the bounding box of small_image  and extract it from
# the big image
topLeft = maxLoc
botRight = (topLeft[0] + small_imageWidth, topLeft[1] + small_imageHeight)
roi = big_image[topLeft[1]:botRight[1], topLeft[0]:botRight[0]]

# construct a darkened transparent 'layer' to darken everything
# in the big_image except for small_image
mask = np.zeros(big_image.shape, dtype = "uint8")
big_image = cv2.addWeighted(big_image, 0.25, mask, 0.75, 0)

# put the original small_image  back in the image so that it is
# 'brighter' than the rest of the image
big_image[topLeft[1]:botRight[1], topLeft[0]:botRight[0]] = roi

# display the images
cv2.imshow("Big_Image", big_image)
cv2.imshow("Small_Image", small_image)
This may a simple app but it can be useful for game development, or it even be further developed and improved to create an image search engine.

Thursday, December 3, 2015

Using my Windows 8.1 Tablet Pc as Raspberry Pi 2 Model B Monitor

The raspberry pi is a tiny pc running on linux based operating system with gpio pins. It is like having an arduino and a personal computer. Unfortunately, the rpi does not have a builtin screen and having to connect it on a huge monitor does not make it a tiny pc anymore. But more recently, I discovered that I can use my Windows 8.1 tablet as my rpi's monitor and take note, the connection is over wifi.

With this configuration, I can access my rpi anywhere even when I will just leave it at home. To access the rpi from my tablet, I used xming and putty. Both software can be downloaded free of charge from the internet. It only took me a few minutes to figure out how to make it work, thanks to those numerous how-to guides on youtube. Without them my mini project would have never been possible.

Here is my setup:

So now, I can some python programming with image processing usin my raspberry pi and the wimdows 8.1 tablet pc during my spare time at work.

Tuesday, November 24, 2015

A Desktop CNC is almost an all-in-one Machine

I have always been dreaming of a machine that can do almost anything I want it to do. For example, I want a fried chicken so all I have to do is put a live chicken into the machine and 1 minute later, it comes out as a perfectly cooked fried chicken. But of course this machine is still light years away from becoming a reality. But as an electronic hobbyist,this machine is almost a reality when it comes to creating an electronic device and this is the Desktop CNC Milling Machine.

The cnc machine can enable me to create a small fully functioning electronic device faster using the materials of my choice. For example, I need to create a robotic gripper, if I dont have this machine with me, I will have to take my file to a laser cutting service provider but it is very seldom that the service is reliable I had found one but they are very far and will not respond to emails which means I will have to go there personally to transact business and that still depends on the availability of their machines and another disadvantage is it will be a lot more expensive not to mention that the material is limited to acryllic. What if I want to use aluminum so the robotic gripper will never become a reality. And what if I made a simple error or need to do small adjustments? It can be worse if I am going to create devices that involves pcb. I really dont like the idea of using Ferric Chloride to get good results.

Friday, September 25, 2015

Ibeacon with thin form factor and that really works!

My ibeacon orders just arrived recently after a few months of bumps and so happy to check whether it really work just as the manufacturer had claimed. So here's the result of my testing and review.

Form Factor and Design.
The ibeacons have rectangular shape with thin form factor. It comes with just one neutral color and that is white. The ibeacons that I ordered are boxed in bundles of ten. My impression is that this ibeacon really means business because the packaging alone is absolutely looks expensive.

The ibeacons with my itag:

 The form factor is well suited for applications such as when it is used to be given away to employees to easily track their movements within certain locations because they can be easily inserted in the wallet or be attached at the back of identification cards. The white color is very neutral and can be easily redecorated with stickers or through silkscreen printing.

It can still be modified further by using a higher capacity battery like the CR2032(240mAH) which stores energy 2.5 times more than the CR2016(90mAH) and this ibeacon casing can be an excellent substitute for the newly modified and upgraded ibeacon:

If the pcb is taken out from the 3.3mm thick casing, its thickness is about 0.8mm including the soldered compoments which means, it can be easily inserted inside any device that one needs to modify. Thinner(0.5mm thick) rechargeable batteries at 0.1mAh capacities can used to power the ibeacon. The 0.1mAh is enough to power the ibeacon for about a few days or more. The thin battery is absolutely fine when you want to hide the ibeacon inside the device that is being modified.

source: Thinergy

Even without the thin battery, the whole ibeacon can be inserted inside a cellphone with plastic casing like Samsung J7. Here's how I did to turn my cellphone into a an ibeacon:

Removing the pcb from the casing is not easy. I almost destroyed the casing when I attempted to open it the first time.

The Hardware.
The ibeacons are powered by Nordic nRF51822. Nordic is a Europen electronics company. They have impressive wireless product lines and of course, nRF51822 chip is one of those. The nRF51822 has an arm-based microcontroller as its core. This should make the ibeacons more responsive. It is also equiped with an excellent power management circuitry that should make it consume less power enabling batteries to last longer.
The internal construction is well thought of design which means it gives the impression that it was not created in a small garage by a bunch of college dropouts.

The Software
Configuration software is easily downloadable from the IOS AppStore and Android Playstore. My main focus in rating whether the software is really working are as follows:
1. Password can be easily changed.
2. The name of the Ibeacon can be changed
3. UUID, Major  Minor can can be changed
4. Transmission Power can be adjusted
5. Advertising Frequency is fully adjustable
6. Should have transmit only mode when already deployed.

All of the above is supported by the software and to add a few more good impressions, the software is very easy to use and provides tips to help newbies to get started quickly.

The configuration software also allows the changing of the measured power. I used to think that this parameter is not that important but when I tried to experiment with it using the Estimote software, I realized that this cool feature should not be ignored. Based on the results of my experiment, as I decreased the value, the Estimote software is able to tell more accurately the distance between the phone and the ibeacon. This feature calibrates the ibeacon.

The Power Consumption
Actual power consumption of the ibeacon is accurately adjusted based on the configured transmission power and the rated I think based on the measured power, the battery(CR2016) will last at least 6 months. Here is the comparison of the 3 ibeacons that I have:

The HM10(IBEACON) and Axaet Ibeacons(ziruzbeacons) and the minew ibeacons(1313_48278) have the following configurations:
1. Configured Transmission Power:

  1. HM10 = -23dBm
  2. Axaet Ibeacons = -23dBm
  3. minew ibeacons = -16dBm

2. Measured Transmission Power:

  1. HM10 = -59dBm
  2. Axaet Ibeacons = -86dBm
  3. minew ibeacons = -59dBm

3. RSSI:

  1. HM10 = -54dBm
  2. Axaet Ibeacons = -85dBm
  3. minew ibeacons = -72dBm

In ths case, the Minew Ibeacon with thin profile is the clear winner in terms of power consumption efficiency.

Overall impressions, the ibeacons are not just gorgeously designed but are really fully functioning devices that does its jobs very efficiently just as it is expected.

Tuesday, June 16, 2015

Customizing the HM-10 BLE Module Firmware

There were a lot of complaints regarding the power consumption of HM-10 ble module during sleep mode. My formula for computing how long the battery will last when the HM-10 is configured as ibeacon is quite close to being accurate but surprisingly in the real world, the module does not performed as described by the manufacturer. As proof I took a screenshot of the HM-10(IBEACON) and an AXAET Ibeacon(ZIRUZBEACONS). Both ibeacons having the identical configuration(TX Power= -23db and Advertising Frequency=1200ms) but the rssi and measured power had huge differences which indicates that the HM-10 is not performing as expected.

There are many work arounds to make the HM-10 consume less power and one of them would be to flash new firmware to the TI CC2541 chip using BlueBasic. Uploading a new firmware is quite risky and very challenging but if you succeed in this endeavor, it will be very rewarding because you can access all of the available resources on the TI CC2541 chip. You can even take the customization further to add buzzer, temperature sensors, heart rate monitors, monitor the current battery charge level and many more without the need of external microcontroller.

Here is how to connect the cc debugger to HM-10 BLE Module:

The downside of this is like saying good bye permanently to the original firmware that came with the ble module but in terms of benefits, it is well worth it.

Wednesday, June 3, 2015

Pass2U Pass Issuance Service Integrated with Ibeacons

I was searching for existing ibeacon apps that offers a complete working system that should allow small shop owners jump start their mobile marketing strategies when I stumbled upon the app Pass2U created by a Taiwan Based Software Development Company MicroMacro Mobile. It fits my search criteria and almost(70%) meet the features I mentioned in my previous article(Ibeacon Apps Must Not Be Unique).

The android app is like an organizer that lets users keep all of their discount coupons, loyalty cards, event coupons, debit cards, boarding passes, movie tickets and other offerings in a single app. The good thing about this is when one of the passes stored was created by a merchant from the same website(pass2u.net) and has enabled the ibeacon feature, the user will receive a notification telling the user that he is near the merchant's shop.

For those who are not yet familiar about digital passes, here is some information about it:

What’s a Pass and How do I Use One?

A pass is a digitally signed document such as a ticket, membership card, or coupon that can be distributed by email or a web download. It can be opened with the Passbook app on iOS or with an app like PassWallet on Android. On iOS, a pass can also be linked to a companion app, for example the Eventbrite app which allows you to buy tickets and add them to your device’s Passbook, but that’s not mandatory.
Apple’s specs outline four main pass types:
  • Boarding passes
  • Event tickets
  • Retail coupons
  • Store cards
There’s also a Generic pass type that covers other purposes, and this the type of pass I’m using here.
Each pass contains various bits of data. Some, such as a member name and bar code are displayed visually on the “front side” of the pass. Other data is located on the “back” of the pass and triggered by the “i” icon. Passes can also contain some hidden information such as a time and location which can be used to display relevant notifications.
Source: sitepoint

I tried to explore the whole system and experimented with their store card to check if it's really working and how easy it is to navigate throughout their system, and I have confirmed that yes, it really works and very easy to use with their very good user interface design. Anybody who can read and write and knows how to click buttons can easily get used to the whole system.

Here is a sample loyalty card created from pass2u.net:

Here is the sample notification I received:

Up to 10 ibeacons can be added for a single pass:

What Pass2U missout is a small app that could be integrated with their android pass wallet app is an ibeacon pass issueing/dispensing app. What it basically do is to give away passes to people who downloaded the app each time they pass by the shop and when their smart phone has detected the ibeacon signal.

Friday, May 29, 2015

HM-10 Over-the-Air Configuration Software from the Manufacturer

About 3 months ago, I attempted to test the available software provided by the manufacturer of HM-10 modules, and I failed to make it work but today, I tried to experiment with it and to my surprise, I was able to make it work! This probably because the software has been updated or it could be that my previous configuration of HM-10 was wrong, but I am quite sure that I used the same configuration as before.

The first step I did was used my configuration as indicated in my previous article(Configuring HM-10 to Support Over-the-Air(OTA) Update). Then, I downloaded the new apk from the manufacturer's website but I dont recommend downloading the software from there because they frequently update the files. Here is the apk file I used for my experiment and testing: http://bit.ly/1FkfwJ3. And check the screentshots below as a result of my successful testing:

The Initial Screen. I pressed the search button. 
The app found my ibeacon, I had to tap the ibeacon to configure:
The configuration screen appeared, The initial status message is "connecting to ibeacon....", so I had to wait until it connects to the ibeacon. This is where my precious testing fails, the app could not connect to the ibeacon. But today, it mysteriously connected successfuly.
I tried to type "AT" on the input text and pressed the send button next to it, and the ibeacon responded "OK":

All AT commands should work with the software except those that will affect the ibeacon module's connectivity.

Friday, May 22, 2015

Configuring the Axaet Ibeacons

I have recently acquired several units of Axaet Ibeacons, the very colorful ibeacons with plastic shell casing available in different shapes. At first I thought the ibeacons were not working with the provided Ibeacon Management apps that I downloaded in the google playstore but through further reading and research, I have finally made it work. Here's how I made it work:

  1. I found the app by searching the google playstore using the keyword "axaet". There is only 1 app found so I downloaded and installed it immediately.
  2. I opened the app after installation.
  3. I turned on the ibeacon by pressing the function button for 3 seconds. The green led will light up for 2 seconds to indicate that the ibeacon has been turned on.
  4. I have to put the ibeacon into connectible mode by pressing the function button twice with  10ms intervals and long pressing it on the third time until the red led turns on for 2 seconds and after 1 second, the green led will turn on again.
  5. Press the clear screen button on the android app and wait  for the ibeacon to appear on the screen. "_n"  will be appended at the end of the ibeacon's name to signify that the ibeacon is in connectible mode.
  6. I just clicked on the connectible ibeacon and the screen that allows me to configure the ibeacon appears. At first the screen appeared as blank, but when I clicked the empty UUID text field, the current configuration values of the ibeacon I selected became visible instantly. 
  7. If I will click the other ibeacons, a popup message will appear telling me that I should make the ibeacon connectible.

Ideal Security Layer Implementation

The Axaet Ibeacons does not support Over-the-Air(OTA) update so it would be ideal to implement a spatial indexing algorithm, a programming algorithm designed specifically for location-aware devices.

Friday, May 15, 2015

Ibeacon Apps Must Not Be Unique

Stores or the Stand-Alone shops that caters to people residing near where it is located can really get smarter with beacons. But ibeacons could not work by itself, it is always accompanied by a customized app. If you could imagine a scenario wherein there are hundreds of shops operating in one location and each one of these shops has implemented ibeacons with the basic objective of attracting more customers. This would mean the consumers has to download all the customized apps from each one of the shops. Having to install all of the apps is not a good idea at all, and seriously will just eat up the memory of the smartphone and this could be disastrous. This scenario will just render the effort of implementing ibeacons useless not to mention the tons of notification that consumers will receive. It has been proven that consumers usually uninstall apps that sends irrelevant notifications.

But there is a number of solutions to this problem. The best solution that I can think of is to have a service provider similar to free blog hosting site blogger.com which provides a service that enable bloggers to start blogging in an instant.I really like the idea of blogger.com because I don't have to be very tech savvy to create  a nice blog. All I have to do is register, think of a good blog title, choose the template, create the article, and the next day, I am able to track how many visitors I had the previous day, how did they got into my blog and which article they were able to read, which country they came from and so many more.

Now in the case of the service provider that can host the ibeacon app, the shop owner could just register and be able to do the following:
  1. Integrate the app with their back-end system like SAP HANA, online payment system, or any other software.
  2. Enable shop owners customize their Ibeacon security implementations
  3. Create Loyalty/Rewards/Membership Cards
  4. Create Discount Coupons
  5. Other Promotional Gimmicks
  6. The notifications should be keyword based just like what I mention in my previous article(My Mobile Application Idea using Ibeacons)
The service provider may also provide other tools like data analytics, tracking tools, ibeacon management apps, ibeacon calibration tools, etc.

This solution can be later on integrated into the Operating System so that every consumers need not worry about doing anything. It could be very convenient to have all their loyalty cards kept in one place and it will also be cool if all the purchases of the consumer can be integrated into their personal financial software to enable them to track their expenses.

Thursday, May 7, 2015

Top 5 Benefits for Students can get from Ibeacons

Students are like employed people busy building up their skills, preparing for an exam, collaborate with colleagues to work on a group project, or had to stay on the lab to help Professor X finish his latest bionic brain designs. They have to work hard in order to pass their subjects. With their busy lifestyle, there are still so many grunt works that needs their attention and there may be social events and promos that they might miss. These could be very important for every students to bond with friends and cement connections. Thank God, Ibeacon technology is here to make sure every important events at school is not missed. I think these are the following top 5 benefits for students can get from ibeacons:

1. Receiving notifications and reminders using location specific devices coupled with visually appealing apps can truly make schools interactive and will captivate the students' fascination which will increase the students' desire to learn.

2. Getting every students' preference can help School Administrators send relevant notifications. It can also help Guidance Councilors formulate better career guidance program for every students.

3. In the classrooms, attendance can be taken automatically as the student enters the classroom, students can request the teacher's assistance while doing some experiments, resulting in a much better teacher-student relationship.

4. As mentioned above, with the help of ibeacons, important social, organizational, and/or sporting events can never be missed by the students because they could receive relevant reminders and notifications related to such events.

5. A truly interactive game that can help students learn with the help of ibeacons can also be developed. The interactive game could be related to improving and honing the students' social skills, or help them develop interest in solving some of Math's unsolved problems.

Wednesday, May 6, 2015

Another Effective Guide on How to Maximize the Use of Ibeacons

When trouble comes, there could be something wrong with what you're doing this is especially true for newbies. Ibeacons do sometimes have trouble but there will be some solutions to every unique problems encountered. Sometimes electronic devices fail to operate on certain conditions so these tips can be a good guide to ensure that ibeacons will not fail.

Q: My battery is 180mAH and I expect it to last 15 days but it wont even last for 1 day, what's the problem?
There are a number of reasons why this happens, try these
  1. Batteries of this size is very vulnerable to overcharging and frequent full discharging so avoid overcharging and full discharging the battery
  2. If it does not last for 1 day, see my article A Closer Look at How Ibeacons Consume Power. If you have followed the configuration in this article Configuring HM-10 to Support Over-the-Air(OTA) Update, then you should adjust the rated power transmission power to -23dB by invoking AT+POWE0
  3. If the problem still exists, try adjusting the advertising frequency to 1228mSeconds by invoking AT+ADVI9
  4. Make sure that it sleeps by invoking AT+SLEEP
  5. Enable the Ibeacon's security features AT+TYPE2 and AT+PASS000000("000000" is the default. You may change it to your preferred passkey
This is another informative tip on how to effectively use your ibeacons.

Wednesday, April 29, 2015

A Closer Look at How Ibeacons Consume Power

A lot of people think that if its a low energy device would automatically mean the device will consume less energy and therefore, battery life will be longer. This is partially true but grossly incomplete so one can't just conclude from only one set of data. Several factors could affect the device power consumption other than its Low Energy Rating, so this is my main goal to clarify certain concerns about battery life of the ibeacon.

There are a number of factors that affect the battery life, and these are the chip itself, its firmware, the pcb design, error in the device's configuration, environmental temperature, the housing, and so on and so forth. First lets have a look at an ideal condition where the environment is perfect and predictable so that we can easily create formula at how the device can consume power. In a perfect environment we can easily say that Battery Life(in Days) =  Transmission Rate(mSeconds) * Rated Transmission Count where Rated Transmission Count = Battery Rating(in mAH) / Current Draw per Transmission where Current Draw per Transmission = Power Consumption per Transmission(in dBm converted into µWatts) / Voltage.

Sample Computation:
1) Battery Rating = 260mAH
2) Device Rated Transmission Power = -23dBm = 3.33µW(AT+POWE3)
3) Transmission Rate = 564mseconds(AT+ADVI5)
3) Voltage Applied to the iBeacon = 3.3V

Current Draw per Transmission = 3.33 µW / 3.3V = 0.1 µA (assuming that 3.3v is constant)
Rated Transmission Count = 260 mAH / 0.1 µA = 2600000
Battery Life = 564mseconds * 2600000 / 86400 = 16.97 days
The ibeacon consumes 0.18mA during sleep mode, to compute the battery life:
Total Transmission Current Draw Per Hour = 0.1 µA * 564mseconds * 3600 = 0.203mA
Using the formula from digikey:
Net Battery Life = (((260 mAH / (0.18 mA+0.203mA)) * 0.7)/24 = 13.86 days(estimate only)

Please note that Battery Rating in mAH is not actually the amount of electrical energy stored by the battery, it is the maximum current that can be drawn from the battery continuously in one hour. So we will just assume that the battery has already been fully discharged after an hour of giving off 260mA.

These formulae is based on perfect conditions, but because of some other factors that I enumerated above, these result could vary by as much as 50%(with the exception of the error in the device's configuration that could result up to 1000%)when all other factors are considered in the calculation.

I could not site a reputable link that there was indeed a scientific study to confirm my observation, it was based solely on my actual experience with electronic devices that I have worked on the past 5 years.

Configuring the Ibeacon to Detect other BLE(Bluetooth 4.0) Devices with Raspberry Pi and Python

The Ibeacon from Ziruz Technologies is not just simply an Ibeacon, it can also be configured to detect other Bluetooth Low Energy(BLE) devices. And more recently, one AT command has been added to make the Ibeacon detect other Ibeacons, but the HM10 module will need a firmware upgrade so that the new command will be available for use.

We can use the previous setup we used in my previous article(Configuring Ibeacons using Raspberry Pi B+ and Python) so that all we need to do is create a python program. And here is the python program I used to scan other BLE devices:
import serial
import time
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=3.0)
rcv = port.readline() 
print rcv
rcv = ""
rcv = port.readline() 
print rcv
rcv = ""
rcv = port.readline() 
print rcv
rcv = ""
rcv = port.readline() 
print rcv
rcv = ""
rcv = port.readline() 
print rcv
rcv = ""
while True:
    rcv = port.readline() 
    print rcv
    rcv = ""

The AT+DISC will scan all BLE devices and will just return the MAC address, the newest firmware version has the command AT+DISI? and this command will return the UUID, RSSI, Major, Minor, Measured Power and the MAC Address. The command AT+DISI? is available with firmware version V539, to check the version of the firmware use AT+VERS?

If your current Ibeacon does not support the latest version, you can update the firmware by following this procedure.

Sunday, April 19, 2015

Configuring Ibeacons using Raspberry Pi B+ and Python

CP2104 Module is the perfect way not only to configure the ibeacons by connecting it to the usb port as described in my previous post (How to connect Ibeacon V2.0 to a PC with CP2104 USB 2.0 to TTL Converter) but can also be used to check the battery charge level of the ibeacon's battery as well by checking the brightness of the led on the module while the ibeacon is connected. But I have run out of stock and these modules are not readily available, so once they're gone, they're gone. But I have learned that the raspberry pi which is a small pc and can be used like an arduino can be an excellent substitute. Raspberry is readily available so configuring the ibeacon should not be a problem.

Here's how to use the raspberry to configure the Ibeacon:
1. The Connection. Connect the ibeacon module(HM10) to the UART/Serial port of the raspberry pi, see illustration below:

2. Raspberry Pi Set-up. The raspberry pi will still need to be set up because by default, the uart port serves as another gateway for controlling the computer remotely, so all bootup sequences and messages are being transmitted on the port, but all we need is to configure the  uart port to configure the ibeacon so we will need to eliminate this unwanted data. Here is how to do it:
  1. Modify the file /boot/cmdline.txt by removing console keyword related to the serial port. Typically the file looks like this: "
    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 ....". Just remove the part in bold letters.
  2. The next step is to modify the file /etc/inittab by commenting the line "
    T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100". You could just add "#" at the beginning of the line.

    Restart the raspberry pi
Further reading:  RPi Serial Connection

3. The Python Code.  And finally we are ready to configure the ibeacon. I used the following python code to achieve this:
import serial

port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=3.0)

while True:
    rcv = port.readline() 
    print rcv
    rcv = ""
    rcv = port.readline() 
    print rcv
    rcv = ""
 Just follow the rest of the configuration process as described below:


for more detailed instructions you may check this website .

The ibeacon should respond to every command sent by the python program.

Saturday, April 18, 2015

Using Ibeacons with Internet of Things(IoT) Devices

It's the 22nd century, it is the time when technology has improved so much that made living healthy and happy accompanied by convenience improved so much too. But there are certain issues like knowing in real time the food inventories inside the refrigerator for busy hardworking moms and dads that has yet to be addressed by technology even though these issues can be easily solved nowadays with the help of Ibeacons and Internet of Things(IoT) enabled Devices.
source:Smart Fidge

Let's have a look at the problems of storing foods and the current issues:

  1. Without proper monitoring, some foods inside the fridge gets rotten.
  2. Some of the foods even if not yet rotten, are already expired.
  3. You got surprised visits from friends or relatives.
  4. You know that your fresh milk needs to be replenished but you forgot because you are busy.
  5. Mom asked you to buy a rare vinegar but you forgot again
  6. You happen to drop by after an office hour in a huge grocery store, you are tired and exhausted and you find it too difficult to find the product that you are supposed to buy.
Here's how technology make things convenient:
  1. Get an IoT enabled refrigerator, it is a smart machine fully equipped with barcode scanners and connects to an inventory apps. You may choose to have this monitored by your personal food supplier and what they do is if they detected that you need to replenish your milk, they will either notify you and if you approve, they will instantly deliver the product to your door or you may eliminate the process of approving, and you just pay them on a monthly basis. 
  2. You found out that having a personal food supplier is too advance and that you enjoy going to the grocery to buy them by yourself but you are busy and needs some form of assistant to remind you. But luckily, grocery stores use ibeacons and they have an app that can also access the contents of the smart fridge, so if you happen to pass by the grocery, the app will instantly remind you that you need to replenish your fresh milk.
  3. Obviously, the smart fridge can detect if there are rotten or expired stocks and sends an alarm to your smart phone and  if you haven't taken any action, the grocery store or your personal food supplier can detect this and will send a reminder.
Aren't these ideas cool?

Friday, March 6, 2015

Securing Your Ibeacons

Hi tech hackers are constantly looking for vulnerabilities and definitely ibeacons are not exempted from being the target in fact because its new, it is often become the primary target. Securing the ibeacon is perhaps the number 1 goal of every business just like any other IT implementation projects.

Ibeacons constantly advertise their signatures, this mainly composed of UUID, MAC Address, Minor and Major. If the app you design is dependent only on these parameters, then the ibeacon security implementation is very weak and is very vulnerable to all sorts of hacking methods. So an additional security layer is needed. There can be a number of ways to do this. The following are my ideas of securing the ibeacon implementation:

  1. Most Ibeacons can be configured over the air(OTA), it would be wise to always enable the password protection features of the ibeacon so that it can only be accessed by qualified and authorised administrators. 
  2. With Ibeacons' signatures publicly advertised, without having an additional security layer, hackers and competitors can easily device new ways to either clone the ibeacon's signature and create push messages that will show up their own advertisements.  To prevent this from happening, a security layer must be implemnented. A good example is by letting your customers register before they can use the mobile app. Another good example is adding additional validations such as how did your client came in to your store, there must be a pattern, they could have passed through McDonald before they came in and it's just so happen that McDonalds have implemented ibeacons and was detected by your customer's smart phone and was logged by your mobile app. The creation of additional security layer depends on your creativity.
  3. The APK must also be secured to prevent hackers from reverse engineering the app. If hackers have access to the source code of your app, the security layer implemented will be exposed. 
Always remember that as the technology becomes more sophisticated, hackers can be one step ahead, but you still can beat them if you know how to stop them.

Sunday, March 1, 2015

How Ibeacons Will Change the Rules in Retailing

The retailing business is extremely competitive. Not many people succeeds in this kind of business. A carefully crafted marketing strategy and with the help of the latest gears and gadgets can help improve the business' chance of survival.

Studies shows that a more personalized service, the introduction of new ways to attract foot traffic, analyzing people's movement inside the store and getting to know more about each one of your customers personal preference can help in the creation of strategies to get these customers to spend at the right time.

Just like for example a teen-age girl happens to pass by a Starbucks, and she really liked to try a newly introduced strawberry flavored coffee but she is short of $1, and all of a sudden, a popup screen on her phone informed her that she has a $2.50 discount coupon and she can even get another $2.50 discount if she invites a friend. So immediately, she invited her best friend who happens to live just a block away to join her. The popup screen appeared because her phone detected the presence of ibeacon.

The sale could have never happened if the discount coupon was just advertized on a magazine.

Another case study is integrating the Beacon Hands Free payment system by Paypal aimed at targetting busy urban professionals. One scenario is that a busy working mom who loves to take with her a coffee with Belgian waffles which is available at Grandpa's Coffee Dine that is always full of people like her. She had to spend 30 minutes every morning just to get her favorite food but now, with the help of Paypal's Beacon Hands Free Payment system, she can put her order and pay online and when her smart phone detects the ibeacon of the store, the store keeper will be notified and will just take her already prepared order outside just a minute before she passes by and and when she's in front of the store, the store keeper will just hand over the coffee and the waffle to her. She may do this only once and each time she passes by the store every morning, the store keeper will always be there to give her favorite coffee and waffle.

Update: With the upcoming release of Apple's Iwatch which is capable of receiving ibeacon signals, receiving discount coupons and other promotional campaigns to improve brand recognition and gathering data of customers' buying habits will now even be so much easier.

Friday, February 27, 2015

Configuring HM-10 to Support Over-the-Air(OTA) Update

One of the key features of Ibeacons is the ability of apps to manage them remotely or via over-the-air update. This is true especially when maybe hundreds of ibeacons are deployed, there is just got a way to manage them remotely. HM-10 is surprisingly has this feature as well. Other advantage of OTA is that it will allow HM-10 to toggle between an Ibeacon and a regular Bluetooth module which can enable it to gather information on its surroundings and transmit it to a server without the need for an external microcontroller.

My previous post(The proper way of turning the HM-10 into Ibeacon) only dealt with(obviously from its title)how to configure HM-10 into ibeacon. But it did not mentioned about how to configure it to support Over-The-Air update which I still do not know during that time of writing. So now, I am willing to share with my readers and visitors how to really turn HM-10 into a real ibeacon.

Actually, it is very simple to do it, HM-10 should be connectable and be able to receive incoming data while broadcasting the ibeacon signal. By turning these off, we are sacrificing the few milliAmps of power consumption, but trade-off is really worth it. Here is the procedure:

I have proven this to work by modifying the source code of the android app that I used in my previous post(More Fun with HM-10). To describe in more detail the modification I made, I just replaced the following line(in bold letters)) in DeviceControlActivity.java:
private void makeChange()
string str=RGB[0] + "," + RGBFrame[1] + "," + RGBFrame[2] + "\n";
with this new code(in italics)to turn off the ibeacon:
private void makeChange()
string str="AT+IBEA0";

(credit to 

The effect of my change is that each time the value of any of the led dimmer slider control changes, the android app will send the command "AT+IBEA0".  

For security reasons, just enable password protection so that accessibility can controlled and restricted.

Wednesday, February 18, 2015

A Simple Ibeacon Scanner App in Android

I have written several articles about the possible uses of Ibeacons but I have never tried to develop a demo software to show how Ibeacons really work so I decided to develop my own app. This app will run at least on Android devices with Android Jelly Bean 4.3 operating system and equipped with Bluetooth 4.0 hardware.

I have never developed an Android App before so this is my first attempt to develop an app. I will be relying heavily from the search results that google will return and my prior experiences as a developer will not help me.

As a noob in this domain, I have to have a strategy to get this task running in 24 hours so I have identified the following steps:
  1. I will get the latest version of Android Studio, the official Android Development Environment.
  2. Watch some youtube tutorials how to properly setup this IDE.
  3. Complete at least 1 full basic tutorial Android Developer's Portal.
  4. I will use the source code of the Android app I used from my previous article More Fun with HM-10 and read something more about BlueTooth Low Energy API that is already inlcuded within the Android Studio.
  5. If all else fail, then it is a failure.
After 12 hours, I came up with a simple app capable of detecting Ibeacons and display them on screen. Here is a screenshot of the app:

The original app does not check whether the device it detected is an ibeacon so I did some research how to check if the device is an Ibeacon.

This is how ibeacons work:
Ibeacons continously transmit their identity(device name, mac address, uuid, minor, major, etc) which includes the pattern that makes it an ibeacon.

The ibeacon signal or the advertisement packet that we need to check is on the 6th byte of the transmitted signal ignoring the first few bytes which corresponds to the company or manufacturer identifier, the value should be equal to 0x02 and we need to confirm the length of the transmitted signal and it should be 0x15 which is located on the 7th byte.

The received bytes each time a bluetooth device is found is stored and can be processed within the callback component.

This app that I just developed provides a basic solution and can be further developed to meet almost every requirement for specific ibeacon application. Developing an full android app is not my expertise but I will continue to keep on developing this app until I become an expert. 

Update: If you are interested to check the app I created you may download it here: https://t.co/8XxjA8NGmh
And the source code can downloaded here : https://t.co/ryV9qT5QTW

The app frequently crashes because the code I inserted is still incomplete, it still needs further enhancement, error-catching routines to prevent it from crashing.

Saturday, February 14, 2015

How to connect Ibeacon V2.0 to a PC with CP2104 USB 2.0 to TTL Converter

I have just came up with a new version of Ibeacon to replace the old ibeacon. Some improvements I made are the following:
  1. It is now thinner at 12mm external thickness down from 18mm thick and is shorter by 10mm. 
  2. The battery I used is the expensive Ipod Nano replacement battery because this battery is very durable, it will not be damaged even if I connect the CP2104 Usb 2.0 to TTL Converter. 
  3.  I have added a new on/off switch to avoid damaging the HM10 module while charging the battery.
  4. I have also rearranged the the position of the four pins used for charging the battery and configuring the Ibeacon.
Here is the new Ibeacon:


I am not done yet with the design of the casing but I will be updating this blog when I am done with it.

To connect the new ibeacon to CP2104 USB 2.0 to TTL Converter, you may do the following connection:

Tera Term is the software I am using to configure the Ibeacon and this is an excellent article about how to use the software Tera Term Guide from Sparkfun

Update: I have just finished my casing design and here it is:

The design is very basic bit looks nice when 3d printed. I nwill still; have to add some design to make look nicer. I was inspired by this very basic design:

Credit to the Owner

Here's the actual 3d printed casing:

The charger or docking station will be finished soon and here is the draft design:

The four holes will be for the slots for pogo pins and the final connector is a standard female(full size) usb.