I am using a Particle Boron to integrate with a Smart lock but I am not being able to do it. I'm using Particle's BLE interface to connect to bluetooth and start sending messages to the lock, and a callback to 'listen' for the lock's response, but I get no response. I don't know what I I'm doing wrong since it seems to be pretty straight forward:


#include "libsodium.h"
#include <string.h>

const size_t SCAN_RESULT_MAX = 30;
bool _utopicPaired = false;
BleCharacteristic utopicPairingCharacteristic;
BleUuid foundInitService;
BleUuid mldpDataPrivateChar("00035b03-58e6-07dd-021a-08123a000301"); // notify, write
BlePeerDevice utopic;
BleAddress utopicAddress;
BleScanResult scanResults[SCAN_RESULT_MAX];
int bleDevices = 0;
size_t nameLength = 0;
char nameBuffer[BLE_MAX_ADV_DATA_LEN];

void onDataPairedUtopic(const uint8_t* data, size_t len, const BlePeerDevice& utopic, void* context) {
  Serial.print("UTOPIC LEN CALLBACK: ");
  _utopicPaired = true;

  utopicPairingCharacteristic.onDataReceived(onDataPairedUtopic, NULL);

void loop() {
    bleDevices = BLE.scan(scanResults, SCAN_RESULT_MAX);
    for (int i=0; i<bleDevices; i++) {
      nameLength = scanResults[i].advertisingData.deviceName(nameBuffer, BLE_MAX_ADV_DATA_LEN);
      String name = scanResults[i].advertisingData.deviceName();
      size_t svcCount = scanResults[i].advertisingData.serviceUUID(&foundInitService, 1);
      if (nameLength > 0 ) {
        if (strcmp(nameBuffer, "UTOPIC") == 0) {
          utopic = BLE.connect(utopicAddress);
          if (utopic.connected()){
            if(utopic.getCharacteristicByUUID(utopicPairingCharacteristic, mldpDataPrivateChar)){
              while (_utopicPaired == false)
                size_t msgOk = utopicPairingCharacteristic.setValue("!");
                Serial.print("\nMessage ok UTOPIC: ");
            } else {
              Serial.printlnf("Characteristic UTOPIC not found");


I emailed the smart lock's support and they told me they do not give permissions to any other bluetooth devices except mobile phones. How can they know what type of device it is? Is there any way to make the lock think my device is a phone?

  • How did you work out which characteristics do what, and what messages you need to send? It makes sense to do more than just basic BLE pairing/encryption for a Lock – hardillb Jun 22 at 13:52
  • @hardillb I have an Android code provided by them, I took those values from there. First you have to send "!" value to ask for the lock's key, and once you get lock's response with they key you can start the pairing process. They issue is that I never get a response. – Mauricio Jun 23 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.