Help integrating DFRobot_C4001 (12m) with ESPHome

Hi everyone,

I’m currently trying to integrate the DFRobot_C4001 ultrasonic sensor (12m version) into ESPHome.

I already have a working Arduino sketch, but I’m having trouble converting it into a working ESPHome configuration. I’m still quite new to ESPHome, so I might be missing something obvious.

Right now, I’m using an ESP32 for testing purposes, but I plan to switch to an ESP8266 later on.

Has anyone already integrated this sensor into ESPHome or has any idea how I can achieve this? I’d really appreciate any help or suggestions!

Thanks in advance
Luca

You should try searching, third result in Google

Here’s a wiring diagram and config adapted for Wemos D1 mini (ESP8266): GitHub - kaminoer/SEN0609-D1-mini: ESPHome configuration for presence detection in Home Assistant with DFRobot C4001 (SEN0609) and Wemos D1 mini (ESP8266)

Just got a DFRobot C4001 (SEN0610), that is the 12m version, attached to an ESP32-C6, with a VEML7700 for good measure, and had some troubles finding a working config, with ESPHome 2026.1.4, because of the external components required for it to work.
So for anyone else looking, i thought to revive this post.
Note that the VEML7700 was not recognized at first, because it was powered by an external source (3.3V) instead of the ESP.

esphome:
  name: office-mmwave
  friendly_name: Office mmWave
  on_boot:
    priority: 600
    then:
      - delay: 3s
      - uart.write: "setUartOutput 1 1"

external_components:
  # https://github.com/ssieb/custom_components
  - source: external_components/components
    components: [ serial ]

esp32:
  board: esp32-c6-devkitc-1
  framework:
    type: esp-idf
i2c:
  - id: bus_a
    sda: GPIO21
    scl: GPIO22
    scan: True
    frequency: 100kHz

uart:
  id: uart_bus
  tx_pin: GPIO16
  rx_pin: GPIO17
  baud_rate: 9600

text_sensor:
  - platform: serial
    uart_id: uart_bus
    name: UART Text
    id: UART_Text
    icon: "mdi:format-text"
    internal: true
    on_value:
      lambda: |-
        if (id(UART_Text).state.substr(0,6) == "$DFHPD") {
          if (id(UART_Text).state.substr(7,1) == "1") {
            if (id(uart_presence).state == false) {
              id(uart_presence).publish_state(true);
            }
          }
          if (id(UART_Text).state.substr(7,1) == "0") {
            if (id(uart_presence).state == true) {
              id(uart_presence).publish_state(false);
            }
          }
        }

binary_sensor:
  - platform: template
    name: "Presence"
    id: uart_presence
    device_class: occupancy

sensor:
  - platform: veml7700
    i2c_id: bus_a
    address: 0x10
    update_interval: 30s
    gain: 1X
    integration_time: 100ms
    #glass_attenuation_factor: 1.0

    ambient_light: "Ambient light"