esphome / esphome/feature-requests
Incremental encoder component
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem you have/What new integration you would like**
Currently, the integration of generic motors is lacking support: there is no generic H-bridge module. There are components for fan, light an a switch ones. However, this can be easily done with some custom code...
To do closed-loop control there is no proper **encoder reader component**. The closest existing components that can be used are the [pulse counter](https://esphome.io/components/sensor/pulse_counter) and [pulse meter](https://esphome.io/components/sensor/pulse_meter). Unfortunately, the pulse counter is not precise enough for high-speed readings and the pulse meter, although precise and can be used, can only measure time between _rising edges_ or _full pulses_. For an encoder _both edges_ are useful.
**Please describe your use case for this integration and alternatives you've tried:**
The use-case is an incremental encoder such as this: 
**Additional context**
By using the pulse meter it is possible to read the motor speed, but the precision is halved due to the fact that is only counts rising edges. It would be nice to have an explicit "incremental encoder" component. It's also important that it outputs zero when the encoder is not moving. For the pulse meter component the `timeout` field can be used (I had to set it to `100ms` or it would zero out all the time).
There's technically a way to get the speed _and_ direction by [using two sensors](https://en.wikipedia.org/wiki/Incremental_encoder#Quadrature_outputs), it'd be nice to have this option as well.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the linked pulse counter and pulse meter component documentation to understand the stated alternatives and their limits. Define the scope of an incremental encoder component around both-edge counting, zero output when stopped, and optional direction support; done means these requirements are specified and validated.
Written by the indexing model from the issue text.
Assessment
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100