Here's what the TB6612FNG looks like from the top, annotated with the pin names (taken from http://www.embeddedrelated.com/showarticle/498.php):


Left side
- GND - Microcontroller ground
- VCC - VCC from microcontroller (2.7V-5.5V)
- AO1 - Output to (-) lead of motor A
- AO2 - Output to (+) lead of motor A
- BO2 - Output to (+) lead of motor B
- BO1 - Output to (-) lead of motor B
- VMOT - positive pole of motor battery
- GND - negative pole of motor battery
Right side
- PWMA - PWM pin on microcontroller
- AIN2 - digital pin on microcontroller
- AIN1 - digital pin on microcontroller
- STBY - digital pin on microcontroller, or tie to VCC
- BIN1 - digital pin on microcontroller
- BIN2 - digital pin on microcontroller
- PWMB - PWM pin on microcontroller
- GND - GND of micro controller
For my RPi, I hooked up
- GPIO2 - AIN1 (yellow)
- GPIO3 - AIN2 (yellow)
- GPIO4 - BIN1 (blue)
- GPIO17 - BIN2 (blue)
- VCC - PWMA/B (green)
- VCC - STBY (red)
Here's a picture of the wiring:
Note I have the LM2596S step down voltage converter on the bottom, to convert from the ~7.2V to 6 for the DC motors.
Here is the python code to drive it: https://github.com/gfxblit/mylatestmoneysink/blob/master/MotorDriver.py
No comments:
Post a Comment