esphome / feature-requests

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

Suppor for I2C Based motor controller #310

Open res2cpu opened 5 years ago

res2cpu commented 5 years ago

Describe the problem you have/What new integration you would like I would like some kind of support for some kind of I2C based motor driver like the WEMOS D1 MINI MOTOR DRIVE SHIELD.

Please describe your use case for this integration and alternatives you've tried: I have used this motor driver for roller blind controllers and as they use the I2C bus it saves pins, is small and cheap. In my use case i control 4 motors, with a traditional motor driver i would need a minimum of 8 pins, this way i only require 2.

Additional context A arduino library for this already exists here, but I've had no luck getting it to work with esphome (lack of knowledge on my part i believe)

kwdaily commented 4 years ago

I've been working on tackling this myself. I have the driver set up as a custom component for now as well as ESP Rotary library for encoder feedback, using custom home assistant services to start, stop, and reverse the motor. But so far I cannot get the motor driver to respond. Will post update when I have a solution working, hopefully in the next couple of days.

noxhirsch commented 4 years ago

@kwdaily Any news on this matter?

Th3H0ff commented 3 years ago

sigh Are you telling me this issue/request is two years old? I just posted a request myself basically requesting the same thing. Damn

Zhuaiz commented 2 years ago

same problem

kwdaily commented 2 years ago

No, I ended up writing my own driver using the I2C commands from the controller datasheet

On Mon, Jun 20, 2022 at 1:51 AM Zhuaiz @.***> wrote:

same problem

— Reply to this email directly, view it on GitHub https://github.com/esphome/feature-requests/issues/310#issuecomment-1160043776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7QUVSAJ24XMNRMWLV4SFDVQAIGVANCNFSM4H53SESQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Kenneth Daily @.***

inspectorgrowadmin commented 1 year ago

No, I ended up writing my own driver using the I2C commands from the controller datasheet On Mon, Jun 20, 2022 at 1:51 AM Zhuaiz @.> wrote: same problem — Reply to this email directly, view it on GitHub <#310 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7QUVSAJ24XMNRMWLV4SFDVQAIGVANCNFSM4H53SESQ . You are receiving this because you were mentioned.Message ID: @.> -- Kenneth Daily @.***

Dont suppose you mind sharing it, do you?

kwdaily commented 1 year ago

sliding_glass_door_lock_YAML_edited.txt sliding_glass_door_lock.h.txt

YAML is the config (minus my credential info), sliding_glass_door_lock.h.txt just needs the .txt removed to turn it back into a .h file, which is included with the YAML. Fair warning, I scrapped this approach for my application but it was working at the time. If you have any questions, I will do my best to answer them! Hope this helps!

inspectorgrowadmin commented 1 year ago

I managed to get them working by directly communicating with the 16-channel PCA9685 that sends PWM to the 2 x TB6612 on the board. Sending 0% or 100% PWM turns the channels off/on for the in1 and in2 for forwards and reverse and then variable PWM for the speed control pin on the TB6612s. No need to add libraries as the PCA9685 works with ESPhome already.

Forgot to mention that I'm using the Adafruit i2c Quad DC or two-channel Stepper Motor Driver Featherboard.