diff --git a/components/grove-tb6612fng.rst b/components/grove-tb6612fng.rst new file mode 100644 index 000000000..6810233d6 --- /dev/null +++ b/components/grove-tb6612fng.rst @@ -0,0 +1,133 @@ +Grove TB6612FNG Motor Drive +=========================== + +.. seo:: + :description: Instructions for setting up Grove TB6612FNG Motor Driver in ESPHome. + :image: grove_tb6612fng.jpg + +The Grove TBB6612FNG a runs over I²C bus and has the capability to control DC and Stepper motors. +At the current stage of implementation only DC motor is implemented. + +.. figure:: images/grove_tb6612fng.jpg + :align: center + :width: 50.0% + +.. code-block:: yaml + + # Example configuration grove motor + grove_i2c_motor: + id: test_motor + name: motor_outside + address: 0x14 + + # Example switch trigger + switch: + - platform: template + name: open_vent + id: open_vent + optimistic: True + on_turn_on: + then: + - grove_i2c_motor.run: + channel: 1 + speed: 255 + direction: BACKWARD + id: test_motor + - delay: 10s + - switch.turn_on: stop_motor + - switch.turn_off: open_vent + +Configuration variables: +************************ + +- **id** (**Required**, :ref:`config-id`): The id to use for this TB6612FNG component. +- **address** (*Optional*, int): The I²C address of the driver. + Defaults to ``0x14``. +- **name** (*Required*, boolean): The name of the component + +.. grove_i2c_motor.run: + +``grove_i2c_motor.run`` Action +------------------------------------ + +Set the motor to spin by defining the direction and speed of the rotation, speed is a range from 0 to 255 + +.. code-block:: yaml + + on_...: + then: + - grove_i2c_motor.run: + channel: 1 + speed: 255 + direction: BACKWARD + id: test_motor + + +.. grove_i2c_motor.stop: + + +``grove_i2c_motor.stop`` Action +------------------------------------- + +Set the motor to stop motion but wont stop to spin in case there is a force pulling down, you would want to use break action if this is your case + +.. code-block:: yaml + + on_...: + then: + - grove_i2c_motor.stop: + channel: 1 + + + +.. grove_i2c_motor.break: + + +``grove_i2c_motor.break`` Action +-------------------------------------- + +Set the motor channel to be on break mode which it ensure the wheel wont spin even if forced or pushed + +.. code-block:: yaml + + on_...: + then: + - grove_i2c_motor.break: + channel: 1 + id: test_motor + +.. grove_i2c_motor.standby: + +``grove_i2c_motor.standby`` Action +---------------------------------- + +Set the board to be on standby when is not used for a long time which reduces power consumptions and any jerking motion when stationary + +.. code-block:: yaml + + on_...: + then: + - grove_i2c_motor.standby + id: test_motor + +.. grove_i2c_motor.no_standby: + +``grove_i2c_motor.no_standby`` Action +------------------------------------- + +Set the board to be awake, every esphome is restarted the default mode is set to standby to ensure the motor wont spin accidentally + +.. code-block:: yaml + + on_...: + then: + - grove_i2c_motor.no_standby + id: test_motor + + +See Also +-------- + +- :ref:`i2c` +- :doc:`switch/gpio` +- :ghedit:`Edit` diff --git a/components/images/grove_tb6612fng.jpg b/components/images/grove_tb6612fng.jpg new file mode 100644 index 000000000..53569c726 Binary files /dev/null and b/components/images/grove_tb6612fng.jpg differ diff --git a/images/grove_tb6612fng.jpg b/images/grove_tb6612fng.jpg new file mode 100644 index 000000000..53569c726 Binary files /dev/null and b/images/grove_tb6612fng.jpg differ diff --git a/images/motor.png b/images/motor.png new file mode 100644 index 000000000..8b05cb514 Binary files /dev/null and b/images/motor.png differ diff --git a/index.rst b/index.rst index 5567ae5f6..d6b3c72f8 100644 --- a/index.rst +++ b/index.rst @@ -580,6 +580,13 @@ Button Components Factory Reset Button, components/button/factory_reset, restart-alert.svg, dark-invert Wake-on-LAN, components/button/wake_on_lan, power_settings.svg, dark-invert + +Motor Components +---------------- + + Grove TB6612FNG, components/grove-tb6612fng, motor.png + + Fan Components --------------