Working on a Bluetooth beacon game for a friend.

Last Updated or created 2025-06-15

Got some bluetooth beacons in the mail.

The plan is to hide these in the woods, and children have to find them using a scanner device.

3D printed scanner (model not mine, but changed to hold electronics

Using a ESP32 with bluetooth, using RSSI (strength of signal) I can limit the range of detection.

The order of finding the tags is important, so a hidden tag should not be found when another should be found first.

These tags, hidden in toys, should be placed in a treasure chest.
(In order)
Then lights and sounds should hint the kids that they have successfully completed the mission.

So same detecting but even shorter range ESP is hidden in the Chest.

Some leds or a single blinking one should give hints about the distance of the object.

=== Matching iTags ===
MAC: 5b:08:10:4d:2a:01 | RSSI: -47
MAC: 5b:45:aa:0d:f7:9c | RSSI: -31 #### NEAR 
MAC: 5b:88:fc:fc:e8:a9 | RSSI: -94 #### FAR AWAY
MAC: 5b:8b:00:00:1d:40 | RSSI: -66 

Some test code:

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>

int scanTime = 5; // seconds
BLEScan* pBLEScan;

void setup() {
  Serial.begin(115200);
  Serial.println("Starting BLE scan...");

  BLEDevice::init("");
  pBLEScan = BLEDevice::getScan();
  pBLEScan->setActiveScan(true);
  pBLEScan->setInterval(100);
  pBLEScan->setWindow(99);
}

void loop() {
  BLEScanResults results = *pBLEScan->start(scanTime, false);
  Serial.println("=== Matching iTags ===");

  for (int i = 0; i < results.getCount(); i++) {
    BLEAdvertisedDevice device = results.getDevice(i);
    String mac = device.getAddress().toString();

    if (mac.startsWith("5b:")) {
      Serial.print("MAC: ");
      Serial.print(mac);
      Serial.print(" | RSSI: ");
      Serial.println(device.getRSSI());
    }
  }

  Serial.println("======================");
  pBLEScan->clearResults();
  delay(2000);
}
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *