2023-07-12 05:02:56 +02:00
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
2023-10-16 21:47:55 +02:00
# Example configuration
2023-07-12 22:13:53 +02:00
grove_tb6612fng:
2023-10-16 21:47:55 +02:00
- address: 0x14
2023-07-12 05:02:56 +02:00
id: test_motor
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 `` .
2023-07-12 22:13:53 +02:00
.. grove_tb6612fng.run:
2023-07-12 05:02:56 +02:00
2023-07-12 22:13:53 +02:00
`` grove_tb6612fng.run `` Action
2023-10-11 02:13:24 +02:00
------------------------------
2023-07-12 05:02:56 +02:00
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:
2023-07-12 22:13:53 +02:00
- grove_tb6612fng.run:
2023-07-12 05:02:56 +02:00
channel: 1
speed: 255
direction: BACKWARD
id: test_motor
2023-07-12 22:13:53 +02:00
.. grove_tb6612fng.stop:
2023-07-12 05:02:56 +02:00
2023-07-12 22:13:53 +02:00
`` grove_tb6612fng.stop `` Action
2023-10-11 02:13:24 +02:00
-------------------------------
2023-07-12 05:02:56 +02:00
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:
2023-07-12 22:13:53 +02:00
- grove_tb6612fng.stop:
2023-07-12 05:02:56 +02:00
channel: 1
2023-07-12 22:13:53 +02:00
.. grove_tb6612fng.break:
2023-07-12 05:02:56 +02:00
2023-07-12 22:13:53 +02:00
`` grove_tb6612fng.break `` Action
2023-10-11 02:13:24 +02:00
--------------------------------
2023-07-12 05:02:56 +02:00
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:
2023-07-12 22:13:53 +02:00
- grove_tb6612fng.break:
2023-07-12 05:02:56 +02:00
channel: 1
id: test_motor
2023-07-12 22:13:53 +02:00
.. grove_tb6612fng.standby:
2023-07-12 05:02:56 +02:00
2023-07-12 22:13:53 +02:00
`` grove_tb6612fng.standby `` Action
2023-07-12 05:02:56 +02:00
----------------------------------
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:
2023-07-12 22:13:53 +02:00
- grove_tb6612fng.standby
2023-07-12 05:02:56 +02:00
id: test_motor
2023-07-12 22:13:53 +02:00
.. grove_tb6612fng.no_standby:
2023-07-12 05:02:56 +02:00
2023-07-12 22:13:53 +02:00
`` grove_tb6612fng.no_standby `` Action
2023-07-12 05:02:56 +02:00
-------------------------------------
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:
2023-07-12 22:13:53 +02:00
- grove_tb6612fng.no_standby
2023-07-12 05:02:56 +02:00
id: test_motor
2023-10-16 21:47:55 +02:00
.. grove_tb6612fng.change_address:
`` grove_tb6612fng.change_address `` Action
-----------------------------------------
If you require connecting multiple boards at once, the address can be changed using this action. The address can be changed to a value in the range of `` 0x01 - 0x7f `` inclusive.
.. code-block :: yaml
on_...:
then:
- grove_tb6612fng.change_address:
address: 0x15
id: test_motor
2023-07-12 05:02:56 +02:00
See Also
--------
- :ref: `i2c`
- :doc: `switch/gpio`
- :ghedit: `Edit`