Adafruit DC + Stepper Motor Driver Feather/Shield I2C Board (PCA9685 + 2 x TB6612FNG)

Just wondering if anyone has got this working in ESPHome by directly communicating with the boards PCA9685 (it’s integrated with ESPHome already) to control the two onboard TB6612FNG’s?

Couple of reasons for using this is that instead of interfacing 4 TB6612’s to my central ESP32 uses up 3 pins per TB6612 (12) and with this i2c board it only uses two pins (SCL + SDA) for all 8 motors with room for expansion.

There is no DC + Stepper component so I thought I could do it this way. It discovers my two boards (0x60 and 0x61 with all call of 0x70) and they both work via IDE examples but cannot get them to work via Home Assistant. It uses the default address of 0x60 for this board even though its connection is with a PCA9685 which is normally 0x40 but that’s fine and have addressed it as 0x60 but could be why it’s not working as expected. I’m hopefully using it as intended for 4 motors, not 2 steppers by the way.

I’ve read that the PCA9685 is fine for using 100% duty to use as a GPIO pin for setting direction and then PWM on the normal pin.

The end goal is to use the 8 outputs (4 DC motors) on my 12v peristaltic pumps. Forward only, PWM to slow the output.

Schematic and details on the board are below along also my ESPHome .yaml for it. As I mentioned I matched the PCA9685 to the two TB6612 h-bridge’s in the yaml but no motor output on any of the motor outs?

Board general info: https://learn.adafruit.com/adafruit-stepper-dc-motor-featherwing/downloads

Schematic: https://cdn-learn.adafruit.com/assets/assets/000/034/460/original/feather_schem.png?1469829943

My ESPHome config with output set as switch @ 100% PWM for enable/PWM pin for testing:

esphome:
  name: feather
  friendly_name: Feather

esp32:
  board: um_feathers3
  framework:
    type: arduino

external_components:
  - source:
      type: git
      url: https://github.com/esphome/esphome.git
      ref: 2022.12.8
    components: [ pca9685 ]
      

# Enable logging
logger:
  level: VERY_VERBOSE

# Enable Home Assistant API
api:
  
ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Feather Fallback Hotspot"
    password: "5JEmaTMl9JkT"

captive_portal:

i2c:
  scan: True
  sda: 8
  scl: 9

# Example configuration entry 
pca9685:
  - id: pca9685_hub1
    address: 0x60
    frequency: 50

  - id: pca9685_hub2
    address: 0x61
    frequency: 50


# Individual outputs
output:
  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor1_pwm
    channel: 2

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor1_in1
    channel: 4

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor1_in2
    channel: 3


  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor2_pwm
    channel: 7

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor2_in1
    channel: 5

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor2_in2
    channel: 6


  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor3_pwm
    channel: 8

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor3_in1
    channel: 10

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor3_in2
    channel: 9


  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor4_pwm
    channel: 13

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor4_in1
    channel: 11

  - platform: pca9685
    pca9685_id: 'pca9685_hub1' 
    id: motor4_in2
    channel: 12

# Motor A
switch:
  - platform: template
    name: "Motor A"
    id: motor_a
    icon: "mdi:chemical-weapon"
    turn_on_action:
      # Clockwise direction:
      - output.set_level:
          id:  motor1_in1
          level: 100%
      - output.set_level:
          id:  motor1_in2
          level: 0%
      - delay: 500ms
      - output.set_level:
          id: motor1_pwm
          level: 100%
      - switch.template.publish:
          id: motor_a
          state: ON
    turn_off_action:
      - output.set_level: 
          id: motor1_in1
          level: 0%
      - output.set_level: 
          id: motor1_in2
          level: 0%
      - output.set_level: 
          id: motor1_pwm
          level: 0%
      - switch.template.publish:
          id: motor_a
          state: OFF

# Motor B
  - platform: template
    name: "Motor B"
    id: motor_b
    icon: "mdi:chemical-weapon"
    turn_on_action:
      # Clockwise direction:
      - output.set_level:
          id:  motor2_in1
          level: 100%
      - output.set_level:
          id:  motor2_in2
          level: 0%
      - delay: 500ms
      - output.set_level:
          id: motor2_pwm
          level: 100%
      - switch.template.publish:
          id: motor_b
          state: ON
    turn_off_action:
      - output.set_level: 
          id: motor2_in1
          level: 0%
      - output.set_level: 
          id: motor2_in2
          level: 0%
      - output.set_level: 
          id: motor2_pwm
          level: 0%
      - switch.template.publish:
          id: motor_b
          state: OFF

# Motor C
  - platform: template
    name: "Motor C"
    id: motor_c
    icon: "mdi:chemical-weapon"
    turn_on_action:
      # Clockwise direction:
      - output.set_level:
          id:  motor3_in1
          level: 100%
      - output.set_level:
          id:  motor3_in2
          level: 0%
      - delay: 500ms
      - output.set_level:
          id: motor3_pwm
          level: 100%
      - switch.template.publish:
          id: motor_c
          state: ON
    turn_off_action:
      - output.set_level: 
          id: motor3_in1
          level: 0%
      - output.set_level: 
          id: motor3_in2
          level: 0%
      - output.set_level: 
          id: motor3_pwm
          level: 0%
      - switch.template.publish:
          id: motor_c
          state: OFF

# Motor d
  - platform: template
    name: "Motor D"
    id: motor_d
    icon: "mdi:chemical-weapon"
    turn_on_action:
      # Clockwise direction:
      - output.set_level:
          id:  motor4_in1
          level: 100%
      - output.set_level:
          id:  motor4_in2
          level: 0%
      - delay: 500ms
      - output.set_level:
          id: motor4_pwm
          level: 100%
      - switch.template.publish:
          id: motor_d
          state: ON
    turn_off_action:
      - output.set_level: 
          id: motor4_in1
          level: 0%
      - output.set_level: 
          id: motor4_in2
          level: 0%
      - output.set_level: 
          id: motor4_pwm
          level: 0%
      - switch.template.publish:
          id: motor_d
          state: OFF

Log outputs no errors but can post up if needed.

Well I have managed to get them working now. It was a config error as I was following the correct guide but the person had used the wrong pins.

Do you have an example of an updated config?