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.

Thursday, February 5, 2015

Vision Impaired Guiding Device with Text-to-Speech, Distance Sensing, Object Detection and Face Recognition

Persons with disabalities are often labeled as unproductive since they could no longer live on their own without the proper care and guidance of normal people. They either lack one or more of the six senses or some of their body parts are mutilated or not functioning properly. But nowadays, with the advancement in electronics and robotics, some of these people are now able perform those tasks that they can't perform because of their disabilities.

I too got an idea of helping those people who have problems in seeing the world which prevents them from crossing the street or seeing objects that they encounter and not able to see the shape, colors or even the name of the person that goes near them.

Object recognition, distance sensing, electronic compass, gps receivers, face detection and recognition, text-to-speech are already common technologies and when put together in one device that will be managed and controlled by coin sized but very powerful computer for the purpose of helping these people can be so easy.

With such device, blind people can now move independently and become a less burden if not a highly productive individual that can already compete with normal people.

Friday, January 30, 2015

Hacking the 1.44" TFT LCD for my Smart Watch Project

I have several stocks of these cute lcd's and for months they've been there neglected. And then one day, I came up with an idea of why not make my own smartwatch by using this lcd, it rung a bell on my head and yeah, why not, it is quite an exciting project. There are so many uses of small lcd aside from making them as watches or pendants. This one cool project at the Discovery Wall at Weill Cornell Medical College is just one of them.

(Credits to the owner)

So I begun to dig into it to find more information about this tft lcd. And here is what I have found out:
1. The tiny lcd is being driven by ILI9163 chip and several arduino users have created libraries so that it will be a lot easier for others to use this lcd. I am not very good at creating my own library so this is an advantage of being an arduino fan, things can be so easy. And yep it is really easy, here is my first round of testing:

So now that I was able to make it work, I need to dig deeper to get more information, My project is a smartwatch so I need to keep it as thin as possible and the red pcb where the lcd was attached is quite thick so I will have to remove the lcd from it without harming it. The lcd has very few external components so getting rid of the pcb will not be a big problem. Here's the progress of my work:




And like I said, the circuitry is very simple so all I have to do is copy the schematic diagram in KiCAD so that I can integrate it easily with other modules. Here's the schematic diagram:

As I was checking further, I realized that the Arduino running at 16Mhz can really be very slow so I thought of using the teensy 3.1 which runs at 72Mhz. And another user has published his code that runs the adafruit library on the teensy 3.1. This did not only copy the adafruit library, he optimized it and the result is a super fast graphics library.

Here is the video of the optimized library in action:

Sunday, November 9, 2014

Tapping the cheap energy to power our gadgets

Vibrations which is always present in the environment can now be harnessed to power our gadget. Just imagine while you are walking, try to move your arms or when the wind is blowing, vibration is produced and thus can be converted into electric energy. Free electricity is also a good term for this.

What is needed to convert these vibrations into electrical energy is the piezo vibration sensor.  An example of a piezo electric sensor is like this:
 
 
This typical sensor can produce low alternating current but large voltage ranging from 1v up to 90v. The electrical energy produced by the sensor goes out of the 2 leads. There is an integrated circuit designed specifically to regulate the output of the sensor, I am referring to LTC3588. This system on chip electronic component requires minimal external component and the typical circuit provided by the manufacturer is in the following circuit diagram:
 
 


This is basically a piezoelectric energy harvester with 9V battery as back up power. There are also other implementations like Sparkfun's  LTC3588 breakout board uses solar energy as power source instead of the piezo vibration sensor. This works like you have to set a certain output voltage, the role of the solar panel is to charge the super capacitors connected in series, if the voltage across  the input of the breakout board reaches the preselected voltage output, the LTC3588 circuit will be awaken and start to power a device connected to its output, if the supercaps were fully discharge or their output voltage is less than the preselected output voltage, then the circuit will enter the sleep mode.
This technology can really be a must have for everyone who uses gadgets that requires electricity such as mobile phones. If 5million uses this technology, perhaps our fossil fuel consumption will be reduced and will be a huge savings for a nation where 95% of the population are struggling to make both ends meet.

Friday, November 7, 2014

Using Ibeacons as Land Mines in a Simulated Military Game

We often hear about simulated military games involving land mines as major obstacles. Land Mines in real sense is an explosive buried underground to disable vehicles of the enemy. In simulated military games, we can use the ibeacons instead as land mines.

One common problem encountered is the complexity of how land mines are distributed in a given space. In a mathematical sense, this can be rephrased as what is the optimal or fairest possible distribution of land mines in order to give the highest unpredictability of locating such weapons in a given space. The space is large but quantifiable.

One possible solution is the Simulated Annealing Algorithm. Annealing in metallurgy is the process of heating and controlled cooling in order to strengthen further the metal. So in the algorithm, it is basically providing a series of solutions until an optimal solution was reached with the goal of evenly distributing the land mines in such a unpredictable pattern.

Let us just imagine the mine field as rectangle where we need to distribute land mines which in this case are the ibeacons in a random pattern where the transmission range never overlaps.