Showing posts with label hm-10. Show all posts
Showing posts with label hm-10. Show all posts

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.

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.


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.

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.

Friday, October 24, 2014

More Fun with HM 10

I got more curious about how to use the HM 10 BLE(Bluetooth low energy) module and asked myself if it will really be able to pair with arduino and instruct the arduino to do some tasks via an android phone. So did some research if anyone from the internet has posted similar project and I was so lucky that I found one that I thought is easy and would simply answer my question.

The original post can be found through this link: Control RGB lights from Android with Arduino & Bluetooth LE (BLE)

Aside from following the processes exactly as described in the article, I also did some twist to adapt it to what is available in my chest. The first thing I did is to deactivate the ibeacon function by issuing the following AT command:
AT+IBEA0
To check whether ibeacon function is activated or not, this AT command is used:
AT+IBEA? 
HM-10 will respond: OK Get 1|0

Ibeacon is activated if it returns 1 and deactivated when it returns 0.

Here are the materials and components I used:
1. HM10 BLE module
2. Arduino Pro Mini 8Mhz and 3.3V
3. Dupont wires
4. The RS232-TTL Adaptor that I used to upload sketch on the Pro Mini
5. Li-Poly Battery
6. BreadBoard

I will still be using the same connection just like what I did in my previous testing of HM-10 and was described in detail in my previous post. If you haven't read it yet, you may click on this link: HM10 BLE Module with Ibeacon .

With that set-up, all I need is to upload the sketch as described in the reference article but since I don't have an RGB LED, I could just use the LED in the arduino pro mini which is connected to digital pin 13. Digital pin 13 is not a PWM pin so I can only turn it on or off and not able to dim it.

I also downloaded the android app in the reference article and installed on my android phone.

Test Result:
It was awesome!!!

Here's the video of my testing:

This is the sketch that I used:
#include <SoftwareSerial.h> 
int bluetoothTx = 3;  // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 2;  // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
const int redPin = 13;
 const int greenPin = 5;
 const int bluePin = 6;
void setup() {
   // initialize serial:
   Serial.begin(9600);
   // make the pins outputs:
   pinMode(redPin, OUTPUT);
   pinMode(greenPin, OUTPUT);
   pinMode(bluePin, OUTPUT);
  bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  delay(100);  // Short delay, wait for the Mate to send back CMD
  bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity
  // 115200 can be too fast at times for NewSoftSerial to relay the data reliably
  bluetooth.begin(9600);
}
void loop() {
   // if there's any serial available, read it:
  
     if(bluetooth.available())  // If the bluetooth sent any characters
  {
  while (bluetooth.available() > 0) {
     // look for the next valid integer in the incoming serial stream:
     int red = bluetooth.parseInt();
     // do it again:
     int green = bluetooth.parseInt();
     // do it again:
     int blue = bluetooth.parseInt();
     // look for the newline. That's the end of your
     // sentence:
     if (bluetooth.read() == '\n') {
       // constrain the values to 0 - 255 and invert
       // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
       red = 255 - constrain(red, 0, 255);
       green = 255 - constrain(green, 0, 255);
       blue = 255 - constrain(blue, 0, 255);
       // fade the red, green, and blue legs of the LED:
       analogWrite(redPin, red);
       analogWrite(greenPin, green);
       analogWrite(bluePin, blue); 
 }
 }
}
}

I am still using the software serial library because that was my previous setup and I wanted to use the original serial port to communicate with the pc when ever it is needed or necessary.