超声波测距传感器
超声波测距传感器HC-SR04
https://tasmota.github.io/docs/HC-SR04/
https://esphome.io/components/sensor/ultrasonic.html
超声波测距传感器HC-SR04
https://tasmota.github.io/docs/HC-SR04/
https://esphome.io/components/sensor/ultrasonic.html
0
# Example configuration entry
sensor:
- platform: ultrasonic
trigger_pin: D1
echo_pin: D2
name: "Ultrasonic Sensor"
sensor:
- platform: ultrasonic
trigger_pin: GPIO3
echo_pin: GPIO1
name: "Ultrasonic Sensor"
update_interval: 5s
filters:
- multiply: 4
- lambda: return 3 - x;
sensor:
- platform: ultrasonic
trigger_pin: D1
echo_pin: D2
name: 'My Ultrasonic Sensor'
update_interval: 1s
accuracy_decimals: 2
unit_of_measurement: cm
sensor:
- platform: ultrasonic
trigger_pin: GPIO12
echo_pin: GPIO13
name: "Ultrasonic Sensor"
update_interval: 1s
accuracy_decimals: 2
unit_of_measurement: m
board: esp32dev;
framework: espidf;
platform: platformio/[email protected]
Downloading & Installing platformio/framework-espidf @ ~3.40407.0
Downloading & Installing platformio/tool-cmake @ ~3.16.0
INFO ESPHome 2024.9.1
INFO Reading configuration /config/esphome/esp32-bluetooth-proxy-58d270.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp32-bluetooth-proxy-58d270 (board: esp32dev; framework: espidf; platform: platformio/[email protected])
--------------------------------------------------------------------------------
Tool Manager: Installing espressif/toolchain-esp32ulp @ 2.35.0-20220830
INFO Installing espressif/toolchain-esp32ulp @ 2.35.0-20220830
Downloading [############################--------] 80% 00:01:08
...
Tool Manager: Installing platformio/tool-cmake @ ~3.16.0
INFO Installing platformio/tool-cmake @ ~3.16.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
INFO [email protected] has been installed!
INFO ESPHome 2024.9.1
INFO Reading configuration /config/esphome/esp32-bluetooth-proxy-58d270.yaml...
WARNING GPIO12 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from 192.168.2.123 using esphome API
INFO Successfully connected to esp32-bluetooth-proxy-58d270 @ 192.168.2.123 in 0.158s
INFO Successful handshake with esp32-bluetooth-proxy-58d270 @ 192.168.2.123 in 0.321s
[02:51:57][I][app:100]: ESPHome version 2024.9.1 compiled on Sep 30 2024, 02:40:04
[02:51:57][C][wifi:600]: WiFi:
[02:51:57][C][wifi:428]: Local MAC: D0:EF:76:58:D2:70
[02:51:57][C][wifi:433]: SSID: [redacted]
[02:51:57][C][wifi:436]: IP Address: 192.168.2.123
[02:51:57][C][wifi:440]: BSSID: [redacted]
[02:51:57][C][wifi:441]: Hostname: 'esp32-bluetooth-proxy-58d270'
[02:51:57][C][wifi:443]: Signal strength: -70 dB ▂▄▆█
[02:51:57][C][wifi:447]: Channel: 6
[02:51:57][C][wifi:448]: Subnet: 255.255.255.0
[02:51:57][C][wifi:449]: Gateway: 192.168.2.1
[02:51:57][C][wifi:450]: DNS1: 192.168.1.1
[02:51:57][C][wifi:451]: DNS2: 192.168.2.1
[02:51:57][C][logger:185]: Logger:
[02:51:57][C][logger:186]: Level: DEBUG
[02:51:57][C][logger:188]: Log Baud Rate: 115200
[02:51:58][C][logger:189]: Hardware UART: UART0
[02:51:58][C][ultrasonic.sensor:045]: Unit of Measurement: 'm'
[02:51:58][C][ultrasonic.sensor:045]: Accuracy Decimals: 2
[02:51:58][C][ultrasonic.sensor:045]: Icon: 'mdi:arrow-expand-vertical'
[02:51:58][C][ultrasonic.sensor:046]: Echo Pin: GPIO13
[02:51:58][C][esp32_ble_tracker:658]: Scan Window: 30.0 ms
[02:51:58][C][mdns:116]: mDNS:
[02:51:58][D][ultrasonic.sensor:040]: 'HC-SR04 Ultrasonic Distance Sensor' - Got distance: 0.525 m
[02:51:58][D][sensor:094]: 'HC-SR04 Ultrasonic Distance Sensor': Sending state 0.52548 m with 2 decimals of accuracy
[02:51:59][D][ultrasonic.sensor:040]: 'HC-SR04 Ultrasonic Distance Sensor' - Got distance: 0.530 m
[02:51:59][D][sensor:094]: 'HC-SR04 Ultrasonic Distance Sensor': Sending state 0.52959 m with 2 decimals of accuracy