ESP8266 HM-10 IBeacon Proximity

6,427

13

2

About: Arduino maniac and owner of IoT company. IT Enterprise Architect

With this tiny project you will be able to detect the nearest iBeacon Device to your thing.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: List of Materials

You need:

1. One NodeMCU

2. One HM-10

3. Four Dupont wires female-female

4. One PC

5. One USB Micro Cable

6. Arduino IDE

7. Library from https://github.com/dinosd/BLE_PROXIMITY

Step 2: Connecting Things

NodeMCU 3V3 to HM-10 VCC

NodeMCU GND to HM-10 GND

NodeMCU D5 to HM-10 TX

NodeMCU D6 to HM-10 RX

Step 3: Sketch

#include <SoftwareSerial.h>
#include <CDBLEProx.h>
void ble_event(BLE_PROXIMITY_EVENT eventArgs);
SoftwareSerial sw(D5,D6);
CDBLEProximity ble(&sw,ble_event);
void setup() {
  Serial.begin(57600);
  ble.begin();
}
void loop() {
  ble.update();
}
void ble_event(BLE_PROXIMITY_EVENT eventArgs) {
    if (eventArgs.eventID==BLE_EVENT_ON_DEVICE_LOST) {
        Serial.println("No device");  
        Serial.println("");
    }
    if (eventArgs.eventID==BLE_EVENT_ON_DEVICE_APPROACH) {
        Serial.println("New device");
        Serial.print("MAC: "); Serial.println(eventArgs.device.mac);
        Serial.print("HL : "); Serial.println(eventArgs.device.hilo);
        Serial.print("HI : "); Serial.println(eventArgs.device.hi);
        Serial.print("LO : "); Serial.println(eventArgs.device.lo);
        Serial.print("SIG: "); Serial.println(eventArgs.device.rssi);
        Serial.println("");
    }
    if (eventArgs.eventID==BLE_EVENT_ON_DEVICE_MOVED) {
        Serial.println("Device moved");
        Serial.print("MAC: "); Serial.println(eventArgs.device.mac);
        Serial.print("HL : "); Serial.println(eventArgs.device.hilo);
        Serial.print("HI : "); Serial.println(eventArgs.device.hi);
        Serial.print("LO : "); Serial.println(eventArgs.device.lo);
        Serial.print("SIG: "); Serial.println(eventArgs.device.rssi);
        Serial.println("");
    }
}

1 Person Made This Project!

Recommendations

  • Assistive Tech Contest

    Assistive Tech Contest
  • Reuse Contest

    Reuse Contest
  • Made with Math Contest

    Made with Math Contest

2 Discussions

0
None
sachinr49

1 year ago

giving error

C:\Users\SACHIN~2\AppData\Local\Temp\arduino_build_449536\libraries\BLE_PROXIMITY-master\CDBLEProx.cpp.o (symbol from plugin): In function `CDBLEProximity::CDBLEProximity(SoftwareSerial*, void (*)(BLE_PROXIMITY_EVENT))':

(.text+0x0): multiple definition of `CDBLEProximity::CDBLEProximity(SoftwareSerial*, void (*)(BLE_PROXIMITY_EVENT))'

C:\Users\SACHIN~2\AppData\Local\Temp\arduino_build_449536\sketch\CDBLEProx.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\SACHIN~2\AppData\Local\Temp\arduino_build_449536\libraries\BLE_PROXIMITY-master\CDBLEProx.cpp.o (symbol from plugin): In function `CDBLEProximity::CDBLEProximity(SoftwareSerial*, void (*)(BLE_PROXIMITY_EVENT))':

(.text+0x0): multiple definition of `CDBLEProximity::CDBLEProximity(SoftwareSerial*, void (*)(BLE_PROXIMITY_EVENT))'

C:\Users\SACHIN~2\AppData\Local\Temp\arduino_build_449536\sketch\CDBLEProx.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\SACHIN~2\AppData\Local\Temp\arduino_build_449536\libraries\BLE_PROXIMITY-master\CDBLEProx.cpp.o (symbol from plugin): In function `CDBLEProximity::CDBLEProximity(SoftwareSerial*, void (*)(BLE_PROXIMITY_EVENT))':

(.text+0x0): multiple definition of `CDBLEProximity::sendEmptyEvent()'

0
None
Swansong

2 years ago

Thanks for sharing :)