For a work-related project, I developed a program using the ESP32 DevKitC V2 to scan for smart-beacons with specific MAC-Addresses. Everything was working fine until I decided to buy some DevKit V4. On the DevKit V4, it still scans some BLE signals but somehow not anymore from the smart-beacons I need to track. The smart-beacons are the "Smart Beacon Go Mini" from blukii (https://blukiishop.com/blukii-SmartBeacon-Go-Mini/en). The smart-beacons only act as BLE advertisers and advertise every second. I'm not trying to connect to them.
My questions are:
- Do the DevKit V4 have different BLE capabilities than the V2? (somehow it seems but couldn't find anything googling)
- Any idea to solve this problem?
I develop using Platformio on VSCode.
platform.ini:
Code: Select all
[env:esp32dev]
framework = arduino
platform = espressif32
board = az-delivery-devkit-v4
board_build.partitions = huge_app.csv
monitor_speed = 115200
lib_deps =
h2zero/NimBLE-Arduino@^1.4.0
Code: Select all
#include <Arduino.h>
#include "NimBLEDevice.h"
const int NUMBER_SCAN = 40; // number of scans to perform
const int SCAN_DURATION = 1.1; // duration of a scan in seconds
NimBLEScan *pBLEScan;
void collectAdvertisingPackets()
{
// scan NUMBER_SCAN times
for (int i = 0; i < NUMBER_SCAN; i++)
{
NimBLEScanResults result = pBLEScan->start(SCAN_DURATION);
// number of advertising devices found
int count = result.getCount();
Serial.printf("Total devices found: %d\n", count);
// for each device found
for (int j = 0; j < count; j++)
{
NimBLEAdvertisedDevice device = result.getDevice(j);
std::string macAddress = device.getAddress().toString();
Serial.println(macAddress.c_str());
}
pBLEScan->clearResults(); // delete results from BLEScan buffer to release memory
}
}
void setup()
{
// baudrate for serial communication
Serial.begin(115200);
// BLE scan
NimBLEDevice::init(""); // initialize the ESP32 microcontroller as a BLE device
pBLEScan = NimBLEDevice::getScan();
}
void loop()
{
collectAdvertisingPackets();
}