esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
411 stars 26 forks source link

[Sensor Component][Ultrasonic Distance Sensor] Add serial port mode support #2090

Open ESP4Ever opened 1 year ago

ESP4Ever commented 1 year ago

Describe the problem you have/What new integration you would like

Widely used ultrasonic ranging sensors like US-100, JSN-SR04T etc. can work in a serial port mode (Mode2 and 3) which seems to be more precise and less resource consuming but this mode is not implemented in ESPHome (only Mode1 "HC-SR04" supported). Can you please add it?

Please describe your use case for this integration and alternatives you've tried:

Additional context

Mafus1 commented 8 months ago

Hi, I added support for serial polling mode. I also opened a PR here: https://github.com/esphome/esphome/pull/6023 I'm just waiting for somebody to review it. If you have a JSN-SR04T lying around, I would appreciate it if you could test my implementation. Just add it as a custom component.

external_components:
  # use jsn_sr04t from my fork in GitHub
  - source:
      type: git
      url: https://github.com/Mafus1/esphome # ESPHome fork
      ref: add-component-sensor-jsnsr04t # branch with new components
    components: [ jsn_sr04t ]

uart:
  tx_pin: 17
  rx_pin: 16
  baud_rate: 9600

sensor:
  - platform: "jsn_sr04t"
    name: "Distance"
    update_interval: 1s