Introduction: ESP8266 HM-10 IBeacon Proximity

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

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("");
    }
}

Comments

author
moldava made it! (author)2017-02-17

Thanks!!!!!

16763445_1447482361960424_1046789_o.jpg
author
Swansong (author)2016-12-21

Thanks for sharing :)

About This Instructable

1,651views

9favorites

License:

Bio: Arduino maniac and owner of IoT company. IT Enterprise Architect
More by cdafalias:ESP8266 HM-10 IBeacon Proximity
Add instructable to: