Saturday, October 18, 2014

HM10 BLE Module with Ibeacon

Upon learning that somebody has just posted a HM10 BLE module at olx.ph, I immediately contacted the seller and bought 1 for my testing. HM-10 is not only just a Bluetooth low energy(ble) module but can be used as ibeacon as well.

It is so easy to use and adding an arduino is very easy. I used the following circuit diagram and it just so happened that my arduino pro mini is a 3.3V 8mhz which is just perfect for the HM-10.


I also bought a small lipoly battery(580mah) just to do some experiments on how much time it will take before hm-10 can drain the battery.

Here are some pictures of my setup:




 

As usual, I could have never done the soldering part without the help of my cellphone technician friend.

During my testing, the battery with 1 hour of charging could last up to 1 day, that is just probably at 15% charging, so may take a week when fully charged.

I used the following sketch to test the HM-10 Module with arduino:
#include <SoftwareSerial.h> 
int bluetoothTx = 2;  // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3;  // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
  Serial.begin(9600);  // Begin the serial monitor at 9600bps
  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);  // Start bluetooth serial at 9600
}
void loop()
{
  if(bluetooth.available())  // If the bluetooth sent any characters
  {
    // Send any characters the bluetooth prints to the serial monitor
    Serial.print((char)bluetooth.read()); 
  }
  if(Serial.available())  // If stuff was typed in the serial monitor
  {
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
  }
  // and loop forever and ever!
}

To test the sketch,  just open the serial monitor of the arduino IDE and type in "AT" at the text box then press the "send" button. If the HM-10 is connected properly, it will respond "OK". All AT commands are available at the datasheet which can be easily found on the internet.

I also tested the transmission range if it can reach 100meters, and here's the result on my android phone:

It was able to reach 125.5meters.

I am very satisfied with the results of my testing and this is really one of the best Ibeacons that is on sale at olx. But for some other purposes, like when you just need simple ibeacon apps that are short range these ibeacons can be very useful too:

1 comment:

  1. https://www.youtube.com/watch?v=a-e88G_YEsI

    ReplyDelete