Reverse a BLE device to integration into Home-Assistant

Found the YouTube video How To Reverse Engineer A Bluetooth Device and started to follow it but it did not really work as expected so record all differences here.

  • The HCI snoop log were not available in \FS\data\misc\bluetooth\logs but rather in \FS\data\log\bt.
  • The bluetooth device was disabled on my Raspberry Pi 3, needed to run the following commands
    sudo rfkill unblock all<br />sudo hciconfig hci0 up
  • Scan for the device: sudo hcitool lescan | grep "C7:57"

Testing ESPHome Designer

I found https://github.com/koosoli/ESPHomeDesigner before Christmas and it seemed to be a really nice tool so decided to try it out. And soon I was contributing some. Here is some notes from that.

cd /tmp
git clone https://github.com/koosoli/ESPHomeDesigner.git
cd ESPHomeDesigner
git switch testing
git pull
cp -r custom_components/esphome_designer /homeassistant/custom_components

mm radar in Home Assistant

Hi-Link manufactures a number of different sensor modules with millimeter wavelength radars which are great to detect humans with.

Some time ago I read about these and they were did not cost much. I bought these from AliExpress. So I ordered some different ones. Recently I found some time to experiment with one of them, the LD2450 (The AliExpress item I bought). On the product page there is a link to a Google drive with documents and software for this module.

I had previously tried one of the others briefly but unsuccessfully. So this time I took a bit different path.

I read that several (maybe all?) of these has built in Bluetooth so I downloaded the HLKRadarTool (iOS or Android) to my phone and powered up the module and connected the phone to it. It worked directly and it was easy to evaluate how the device performed.

Once I know it worked well it was time to connect it to an ESP32. The manual made it easy to understand what pins to use on the radar module. I had some ESP32-C3 modules at home so I decided to use it. The model I had was Tenstar Robot Super Mini and the pinout made it easy to figure out how to connect RX and TX on the sensor to TX and RX on the ESP32.

I then used ESPHome device builder in Home Assistant and the information on the ESPHome LD2450 page to create and install a configuration for the sensor. And soon it appeared in Home Assistant.

After that I looked for a case and found a nice simple case that could easily be pointed in different directions but was not too bulky.

ESP32-CAM in HomeAssistant

I have an ESP32-CAM unit I wanted to try to connect to Home Assistant. This is how I managed to add it.

First I Googled and found the esp32_camera component for ESPHome so it was a natural start since I already have several other ESPHome devices.

After a while I found that the esp32_camera component came with a number of configuration examples. After a little investigation among checking the https://github.com/raphaelbs/esp32-cam-ai-thinker project I realized that I should be able to use the Ai-Thinker Camera-example.

I also wanted to be able to control the LEDs on the board, both the status LED and the Flash and added those as well.

This was my final yaml configuration which I added to the rest of the ESP yaml in the ESP Builder

esp32_camera:
  name: ESP32 camera
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  resolution: 1600x1200 # Native resolutions CIF 400x296, SVGA 800x600, UXGA 1600x1200
  jpeg_quality: 10
  vertical_flip: false
  horizontal_mirror: false

output:
  - platform: gpio
    id: camera_flash_led
    pin: GPIO04

light:
  - platform: status_led
    name: "Camera status LED"
    pin: 
      number: GPIO33
      inverted: true

  - platform: binary
    name: "Camera Flash LED"
    output: camera_flash_led