Hi everyone!
I wanted to share a custom PCB I designed around the ESP32-C6. My goal was to create a high-performance sensor node that communicates entirely over Thread, making it a future-proof addition to my Home Assistant setup.
Hardware Specs:
MCU: ESP32-C6 (supports Wi-Fi 6, Zigbee, and Thread/Matter).
Presence Detection: HLK-LD2450 (24GHz mmWave radar) for high-accuracy human tracking and zones.
Temperature & Humidity: Sensirion SHT41 (very high precision).
Light Sensing: Adafruit BH1750 (Lux sensor).
Connectivity: Running over a Thread network for low-power, mesh connectivity.
If you don’t mind, could you show the YAML for this?
Of course, here is the code:
esphome:
name: bijkeuken-unit
friendly_name: Bijkeuken Unit
on_boot:
priority: 600
then:
- delay: 2s
- number.set: { id: z1_xmin, value: -1400 } # Left
- number.set: { id: z1_xmax, value: 2228 } # Right
- number.set: { id: z1_ymin, value: 5 } # Near (Y1)
- number.set: { id: z1_ymax, value: 2981 } # Far (Y2)
esp32:
board: esp32-c6-devkitc-1
framework:
type: esp-idf
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
- platform: esphome
password: !secret ota_password
network:
enable_ipv6: true
openthread:
tlv: !secret openthread_tlv
device_type: FTD
uart:
id: uart_ld2450
tx_pin: GPIO18
rx_pin: GPIO17
baud_rate: 256000
rx_buffer_size: 1024
parity: NONE
stop_bits: 1
ld2450:
id: ld2450_radar
uart_id: uart_ld2450
i2c:
sda: GPIO19
scl: GPIO20
scan: true
id: bus_a
output:
- platform: gpio
pin: GPIO06
id: status_1
script:
- id: blink_script_led_status_1
mode: restart
then:
- switch.turn_on: led_status_1
- delay: 600ms
- switch.turn_off: led_status_1
switch:
- platform: output
output: status_1
id: led_status_1
restore_mode: ALWAYS_OFF
number:
- platform: ld2450
ld2450_id: ld2450_radar
presence_timeout:
name: "Radar Timeout"
zone_1:
x1: { name: "Zone-1 Left (X1)", id: z1_xmin }
y1: { name: "Zone-1 Near (Y1)", id: z1_ymin }
x2: { name: "Zone-1 Right (X2)", id: z1_xmax }
y2: { name: "Zone-1 Far (Y2)", id: z1_ymax }
binary_sensor:
- platform: template
name: "Bijkeuken Zone 1 Occupancy"
device_class: occupancy
filters:
- delayed_off: 30s
lambda: |-
if (std::isnan(id(t1_x).state) || std::isnan(id(z1_xmin).state)) {
return false;
}
if (id(t1_x).state > id(z1_xmin).state && id(t1_x).state < id(z1_xmax).state &&
id(t1_y).state > id(z1_ymin).state && id(t1_y).state < id(z1_ymax).state) {
return true;
}
return false;
sensor:
- platform: sht4x
temperature:
name: "Temperature"
humidity:
name: "Humidity"
- platform: bh1750
name: "Lux"
address: 0x23
update_interval: 60s
on_value:
then:
- script.execute: blink_script_led_status_1
- platform: ld2450
ld2450_id: ld2450_radar
target_1:
x:
id: t1_x
internal: true
y:
id: t1_y
internal: true
Hi Bootsma!
I came across your project and I have to say I’m genuinely impressed! Combining an ESP32-C6, LD2450 radar and ESPHome over Thread is a really interesting idea. I’m actually surprised this project hasn’t received more attention here, because I think it opens up some exciting possibilities for DIY smart home devices.
I’m particularly interested in using Thread for custom ESPHome devices with Home Assistant. For me, Matter over Thread and ESPHome over Thread are both very attractive approaches. I don’t really need Apple Home or Google Home compatibility, since Home Assistant is the central platform in my smart home.
I’d love to hear how your sensor has worked in everyday use. Have you been running it continuously since building it? How stable is the Thread connection? Have you encountered any issues or limitations with ESPHome over Thread? And how well does the LD2450 perform in practice, especially with zone configuration and presence detection?
Also, do you have any plans to share the PCB design files, or is there a way to obtain the board? A compact PCB version would be a great bonus for anyone wanting to reproduce your project.
Thanks for sharing your work! I think projects like this are a great way to explore the possibilities of Thread beyond commercial Matter devices.
I have been working something very simmilar. The one significant difference is I am only supporting Zigbee and will use a BME280. I hope this topic is something were we can coolaborate. I should for warn you I am an elect eng about to retire. No, I am not loosing my touch. I still want things to work right, that is why my repo’s are still private. Were we might be able to help each other is figuring out how the LD2450 works. I have gone so far as to construct a couple of targets, PVC pipe for a stand, a cheap stepper motor controlled by a C6, and a crumpled sheet of foil. For the LD2450 “quirks” the latest is if a target splits there is a period of time where there is one target reported that dances back and forth before being reported as two targets. Do you have any interest in the LD2450 quirks?
Steve
Hi!
Thanks for your kind words and for taking such an interest in my project!
I’ve been running the sensor daily, and so far it has been working reliably without any problems. The ESPHome over Thread connection has been very stable, and I haven’t experienced any unexpected disconnections or connectivity issues.
One of the design choices I made was to place the ESP32-C6 on the back of the PCB to keep the overall design as compact as possible. Initially, I was a little concerned about heat development and whether this position might affect the wireless signal. Fortunately, neither has been an issue. Temperatures remain perfectly fine, and the Thread connection is stable.
The LD2450 also performs reasonably well in everyday use. Presence detection and zone configuration work quite well, although I still see some room for improvement in making the zone detection more precise. That’s something I’d like to refine further.
What particularly interests me about ESPHome over Thread is the possibility of combining modern wireless technology with a fully local Home Assistant setup. I like the idea of developing my own devices and keeping control over how everything works, without depending on cloud services or being tied to a particular commercial ecosystem.
If you’d like to know more about the project, feel free to ask. I’m happy to share more details about the design and the technical choices behind it.
Hi Steve,
Your project sounds very interesting, and I think there could be quite a bit for us to learn from each other.
I’m also using the LD2450, but in my setup I handle the zone detection in ESPHome using the coordinates reported by the radar. I define the X and Y boundaries for each zone and use template binary sensors to determine whether a target is inside a particular area.
For example, I have separate zones for the main area of the utility room and the back door. Each zone has its own detection logic and off-delay, depending on how I want the presence detection to behave. This works quite well in everyday use, although I can see opportunities to make the detection even more precise.
I’m particularly interested in how you’ve structured the software side of your project. How do you process the LD2450 data, handle multiple targets and implement your zone detection? Are you using the standard ESPHome LD2450 component, or have you developed your own processing logic?
I’d also be interested in seeing how you approach filtering and handling the occasional inconsistencies in target tracking.
Regarding your experiments with target splitting, I find that particularly interesting. I’d like to understand how much of this behaviour comes from the radar itself and how much can be handled or improved through software.
I think comparing our approaches could be very useful. We’re using different wireless technologies, Zigbee and Thread, but the radar and the challenges around target detection are largely the same.
If you’d like to know more about my setup, feel free to ask. I’m happy to share more details about the design and the software behind it.
A link to the project may help.
