Xiaomi Sherlock Smartlock

Hi guys, I’ll explain you how I got to control the lock with an esp8266.

  1. I disassembled the lock trying to find some wires or some possibility to control the motor with MQTT protocol.

  2. I found four wires going from the main board to the touch switch. (You can see them in the photo from zanerv)
    7fd6a745184983ef3d359c32a5f99d76b46035de_1_666x500

  3. I checked the wires and I realized about the code color: red -> positive, ground -> negative, withe -> data and yellow -> data. After this I tried to decode the protocol connecting the data wires from the touch switch to a ftdi usb adapter. I realized that when I pushed the switch to open it sent an 0 and when I pushed it to 1 it sent an 0 too, so I was confused.

  4. After I have tried with serie protocol, I used a logic analyzer, and I realized that when I pushed to open, the switch down pulse from the yellow wire during 19 ms and when I pushed to close the pulse was down during 43 ms. So I discovered how it worked.
    photo_2018-12-19_12-09-24
    photo_2018-12-19_12-09-33

  5. Knowing how it worked, I got a ESP8266 and I developed a program with arduino IDE to send both pulses to one pin depending of an mqtt message. This is the code: Xiaomi Sherlock MQTT code

  6. I added also to the code the possibility to continue detecting the touch switch. So the pinout of the esp8266 will be the next:

  7. I put the esp8266 out from the lock and the wires over the plastic case:

  8. Take attention that it’s necessary to connect the positive and negative directly to the lock battery.

  9. I attach also two photos with circuit finished and with the case closed:


  10. And finally the project is finished, I tried to be as much specific as I can, if you need some more details just tell me and I’ll explain you! I don’t know if this one is the best solution but I have done it some days ago and until now it’s working really good :slight_smile:

11 Likes