找回密码
 立即注册

微信扫码登录

搜索
查看: 427|回复: 18

[硬件DIY] 室外传感器 再升级

[复制链接]

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
发表于 昨天 16:21 | 显示全部楼层 |阅读模式
用esp8266 做个光线传感器 温湿度传感器 雨滴传感器在室外已经稳定运行一年有余,夏天重庆室外温度太高,偶尔8266死机重启,其它还好,还有就是雨滴传感器是属于耗材,一直也没管他,最近闲来无事,打算把这个传感小小升级一下。

在一起的基础上加了一个mos开关 可以控制一个5V的风扇 在夏天的时候可以给他散热,加了一个海凌科2401的人体存在传感器,3.99包邮到家,一下,感觉这个成本就下来。

2401传感器 3.99元,d1mini:8.45元 dht11:2.3元,bh1750:4元,mos单路控制器0.95元,雨滴传感器:1.59云,万能版:1.83元(2块)全部成本不到25元。


由于现在esphome 的问题 现在esp-c3 有兼容问题 编译有点问题,暂时还用esp8266的板子,毕竟便宜。


IMG_20251021_160131.jpg
IMG_20251021_160148.jpg
IMG_20251021_160153.jpg
屏幕截图 2025-10-21 161723.jpg
回复

使用道具 举报

8

主题

297

回帖

3318

积分

论坛元老

积分
3318
金钱
3013
HASS币
0
发表于 昨天 16:34 | 显示全部楼层
这个怎么做。买了个领普的水侵
传感器放户外几个月坏了
回复

使用道具 举报

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
 楼主| 发表于 昨天 16:45 | 显示全部楼层
ilongjiang 发表于 2025-10-21 16:34
这个怎么做。买了个领普的水侵
传感器放户外几个月坏了

用亚克力 的盒子 装一下 比较有个光线传感器 当然要放在 雨淋不着的地方。反正我放在阳台上,只有夏天热死了几次,其它无问题。关键是国内有几个地方有重庆热。
回复

使用道具 举报

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
 楼主| 发表于 昨天 16:51 | 显示全部楼层
ilongjiang 发表于 2025-10-21 16:34
这个怎么做。买了个领普的水侵
传感器放户外几个月坏了

自己动手抄代码,万能版自己焊一下,拿个盒子装一下,放在一个避雨的地方就OK
回复

使用道具 举报

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
 楼主| 发表于 昨天 16:52 | 显示全部楼层
关键是现在海凌科2401的传感器太给力了,代码和2410可以通用,关机是价格一下就打下来了,4块钱包邮到家,差不多是2410的零头
回复

使用道具 举报

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
 楼主| 发表于 昨天 16:54 | 显示全部楼层
substitutions:
  device_name: d1mini室外传感器

esphome:
  name: esp8266monitor
  friendly_name: 室外光线,温湿度
  comment: 室外光线,温湿度

esp8266:
  board: d1_mini

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "838eYErKD************bDuogwLbErrSMeDc="

ota:
  - platform: esphome
    password: "5eb6***********cbd9db55acab"

wifi:
  ssid: "*****"
  password: "**********"
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Outside-Monitor"
    password: "88888888"

captive_portal:
  
web_server:
  port: 80

uart:
  id: ld2410_uart
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
ld2410:
  uart_id: ld2410_uart
  id: ld2410_comp

output:
  - platform: esp8266_pwm
    pin: GPIO2
    frequency: 2000Hz
    id: led_onboard
    inverted: True

light:
  - platform: monochromatic
    name: "LED On Board"
    output: led_onboard

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
    id: water
    name: "water_sensor"

  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
    out_pin_presence_status:
      name: out pin presence status


i2c:
  sda: GPIO4
  scl: GPIO5
  scan: true
  id: bus_a

sensor:
  - platform: bh1750
    i2c_id: bus_a
    name: "BH1750 Illuminance"
    address: 0x23
    update_interval: 30s
     
  - platform: dht
    pin: D5
    temperature:
      name: ${device_name} temperature
      filters:
        - filter_out: nan
        - heartbeat: 15s
        - sliding_window_moving_average:
            window_size: 2
            send_every: 2
            send_first_at: 1
        - lambda: return x * (9.0/5.0) + 32.0; # report temperature in Fahrenheit
      unit_of_measurement: "°F"
    humidity:
      name: ${device_name} humidity
      filters:
        - filter_out: nan
        - heartbeat: 15s
        - sliding_window_moving_average:
            window_size: 2
            send_every: 2
            send_first_at: 1
      accuracy_decimals: 1 # humidity gets 0 decimals by default
    model: DHT11
    update_interval: 30s
  
  - platform: ld2410
    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

switch:
  - platform: restart
    name: ${device_name} Restart   

  - platform: gpio
    id: relay1
    pin: D8
    name: "Relay"

number:
  - platform: ld2410
    timeout:
      name: timeout
    max_move_distance_gate:
      name: max move distance gate
    max_still_distance_gate:
      name: max still distance gate
    g0:
      move_threshold:
        name: g0 move threshold
      still_threshold:
        name: g0 still threshold
    g1:
      move_threshold:
        name: g1 move threshold
      still_threshold:
        name: g1 still threshold
    g2:
      move_threshold:
        name: g2 move threshold
      still_threshold:
        name: g2 still threshold
    g3:
      move_threshold:
        name: g3 move threshold
      still_threshold:
        name: g3 still threshold
    g4:
      move_threshold:
        name: g4 move threshold
      still_threshold:
        name: g4 still threshold
    g5:
      move_threshold:
        name: g5 move threshold
      still_threshold:
        name: g5 still threshold
    g6:
      move_threshold:
        name: g6 move threshold
      still_threshold:
        name: g6 still threshold
    g7:
      move_threshold:
        name: g7 move threshold
      still_threshold:
        name: g7 still threshold
    g8:
      move_threshold:
        name: g8 move threshold
      still_threshold:
        name: g8 still threshold  

text_sensor:
  - platform: wifi_info
    ssid:
      name: Connected SSID
      icon: "mdi:signal-variant"
    ip_address:
      name: IP Address
      icon: "mdi:ip-network"
    mac_address:
      name: Mac Address
      icon: "mdi:wifi-marker"

button:
  - platform: ld2410
    factory_reset:
      name: "factory reset"
    restart:
      name: "restart"
    query_params:
      name: query params

select:
  - platform: ld2410
    distance_resolution:
      name: "distance resolution"
    baud_rate:
      name: "baud rate"
    light_function:
      name: light function
    out_pin_level:
      name: out pin level
回复

使用道具 举报

193

主题

2918

回帖

9474

积分

元老级技术达人

积分
9474
金钱
6348
HASS币
80
发表于 昨天 16:56 | 显示全部楼层
我也想放室外,可惜没有合适取电的地方
回复

使用道具 举报

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
 楼主| 发表于 昨天 16:57 | 显示全部楼层
重要的事情说三遍!!!重要的事情说三遍!!!重要的事情说三遍!!!

海凌科2401 接3.3V电压!!海凌科2401 接3.3V电压!!海凌科2401 接3.3V电压!!
回复

使用道具 举报

64

主题

425

回帖

2061

积分

金牌会员

积分
2061
金钱
1572
HASS币
50
 楼主| 发表于 昨天 17:00 | 显示全部楼层
bugensui 发表于 2025-10-21 16:56
我也想放室外,可惜没有合适取电的地方

国际电工有种86插座,带5V usb插口的,价格也不贵,我放在阳台上几年了。没问题
回复

使用道具 举报

0

主题

82

回帖

203

积分

中级会员

积分
203
金钱
121
HASS币
0
发表于 昨天 20:29 来自手机 | 显示全部楼层
动手能力弱的玩不了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-10-22 20:17 , Processed in 0.082170 second(s), 6 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表