ESP32 Enclosure With OLED SH1106 And LD2410B 3D Printer Model

Author: @
License: CC BY-SA
File formats: stl
Download type: zip
Size:52.2KB

The file 'ESP32 Enclosure With OLED SH1106 And LD2410B 3D Printer Model' is (stl) file type, size is 52.2KB.

Summary

ESP32 enclosure with OLED SH1106 and LD2410B sensor.

LD2410B: https://s.click.aliexpress.com/e/_DEQTDlT
OLED SH1106: https://s.click.aliexpress.com/e/_DEqTrBP
DUPONT 5PINS: https://s.click.aliexpress.com/e/_DEGiwmv
ESP32: https://s.click.aliexpress.com/e/_DDOKYT7

Example code:

esphome:
name: "dashboard-desktop"

esp32:
board: esp32dev
framework:
type: esp-idf

Enable logging

logger:

Enable Home Assistant API

api:

ota:

  • platform: esphome
    password: "xxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Bluetooth Proxy

bluetooth_proxy:
active: true

FONTS

font:

gfonts://family[@weight]

  • file: "gfonts://Doto"
    id: doto60
    size: 60
  • file: "gfonts://Doto"
    id: doto40
    size: 40
  • file: "gfonts://Doto"
    id: doto20
    size: 22
  • file: "gfonts://Doto"
    id: doto15
    size: 15

Bus i2c OLED

i2c:

  • id: bus_a
    sda: GPIO19
    scl: GPIO18

Sensors from Home Assistant

text_sensor:

  • platform: homeassistant
    id: temp
    entity_id: sensor.temp_hum_x
    internal: true

  • platform: homeassistant
    id: hum
    entity_id: sensor.temp_hum_xx

    • platform: homeassistant
      id: date_date
      entity_id: sensor.time_formatted_date_x
    • platform: homeassistant
      id: date_weekday
      entity_id: sensor.time_formatted_weekday_x
  • platform: homeassistant
    id: date_time
    entity_id: sensor.time

  • platform: homeassistant
    id: dbmeter
    entity_id: sensor.dbmeternew_db_soundesp

Display

display:

  • platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SH1106 128x64"
    id: display
    address: 0x3C
    pages:
    • id: page1
      lambda: |-
      it.print(0, 0, id(doto15), "Temp");
      it.printf(14, 20, id(doto40), "%.0f C", id(temp).state);
    • id: page2
      lambda: |-
      it.print(0, 0, id(doto15), "Hum");
      it.printf(14, 20, id(doto40), "%.0f %%", id(hum).state);
    • id: page3
      lambda: |-
      it.print(5, 10, id(doto40), id(date_time).state.c_str());
    • id: page4
      lambda: |-
      it.print(0, 10, id(doto15), id(date_weekday).state.c_str());
      it.print(0, 25, id(doto20), id(date_date).state.c_str());
    • id: page5
      lambda: |-
      it.print(0, 0, id(doto15), "dB Meter");
      it.printf(14, 20, id(doto40), "%.*s dB", 2,id(dbmeter).state.c_str());

interval:

  • interval: 2s
    then:
    • display.page.show_next: display
    • component.update: display

UART for LD2410

uart:
tx_pin: 17
rx_pin: 16
baud_rate: 256000
parity: NONE
stop_bits: 1

ld2410:

Params for LD2410

sensor:

  • platform: ld2410
    light:
    name: light
    moving_distance:
    name : Moving Distance
    still_distance:
    name: Still Distance
    moving_energy:
    name: Move Energy
    still_energy:
    name: Still Energy
    detection_distance:
    name: Detection Distance
    g0:
    move_energy:
    name: g0 move energy
    still_energy:
    name: g0 still energy
    g1:
    move_energy:
    name: g1 move energy
    still_energy:
    name: g1 still energy
    g2:
    move_energy:
    name: g2 move energy
    still_energy:
    name: g2 still energy
    g3:
    move_energy:
    name: g3 move energy
    still_energy:
    name: g3 still energy
    g4:
    move_energy:
    name: g4 move energy
    still_energy:
    name: g4 still energy
    g5:
    move_energy:
    name: g5 move energy
    still_energy:
    name: g5 still energy
    g6:
    move_energy:
    name: g6 move energy
    still_energy:
    name: g6 still energy
    g7:
    move_energy:
    name: g7 move energy
    still_energy:
    name: g7 still energy
    g8:
    move_energy:
    name: g8 move energy
    still_energy:
    name: g8 still energy

Opt values Home Assistant

  • platform: homeassistant
    id: temp_x
    entity_id: sensor.temp_hum_x
    internal: true

  • platform: homeassistant
    id: hum_x
    entity_id: sensor.temp_hum_xx
    internal: true

Main params for LD2410

binary_sensor:

  • platform: ld2410
    has_target:
    name: Presence
    has_moving_target:
    name: Moving Target
    has_still_target:
    name: Still Target
esp32_enclosure_lid.stl 110.3KB
esp32_enclosure_OLED_SH1106_LD2410B.stl 92.1KB