Update Stepper_A3967.md

This commit is contained in:
HomeSpan 2023-07-01 16:23:42 -05:00 committed by GitHub
parent 935104570c
commit 82e6d9683c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 29 deletions

View File

@ -1,43 +1,32 @@
# Stepper_A3967
TO BE EDITED
This is a derived class of **StepperControl** designed to operate stepper motors driven by an [Allegro A3967](https://www.sparkfun.com/products/12779) chip. To use, add `#include "extras/Stepper_A3967.h"` to the top of your sketch.
This is a derived class of **StepperControl** designed to operate stepper motors driven by a [Toshiba TB6612](https://www.adafruit.com/product/2448) chip, either with or without the use of ESP32 PWM pins. To use, add `#include "extras/Stepper_TB6612.h"` to the top of your sketch.
The Toshiba TB6612 is a generic motor driver providing direct control of two full H-bridges. Wiring is as follows (using Toshiba's names for each pin):
The Allegro A3967 is a specialized driver designed for stepper motors. It contains a built-in PWM generator and pre-programmed stepping modes. Wiring for the [EasyDriver Sparkfun](https://learn.sparkfun.com/tutorials/easy-driver-hook-up-guide?_ga=2.152816825.1841726212.1688220137-156607829.1686369274) board that uses this chip is as follows:
#### **Power Connections**
* *VCC* - connect to +3.3V on ESP32
* *VM* - connect to external DC power supply that will drive stepper motor (5-13V)
* *GND* (and *PGND1/PGND2*) - connect to GND on the ESP32, and to ground of external DC power supply
* *GND* - connect to GND on the ESP32, and to ground of external DC power supply
* *M+* - connect to external DC power supply that will drive stepper motor. An on-board regulator also uses this supply to provide VCC to the rest of the board. For use with an ESP32, you must short the 3.3V/5V jumper with a blob of solder to select 3.3V
#### **Motor Connections**
* *AO1, AO2* - connect to the "A" coil of the stepper motor
* *BO1, BO2* - connect to the "B" coil of the stepper motor
* *Motor A* - connect to the "A" coil of the stepper motor
* *Motor B* - connect to the "B" coil of the stepper motor
#### **Control Connections**
* *AIN1, AIN2* - connect to two digital pins on the ESP32 - will control direction and state of coil *A*
* *BIN1, BIN2* - connect to two digital pins on the ESP32 - will control direction and state of coil *B*
* *PWMA, PWMB* - if using PWM, connect to two digital pins on the ESP32; if not, connect to +3.3V on ESP32 to pull high
* *STBY* - connect to +3.3V on ESP32 to pull high
* *ENABLE* - connect to a digital pin on the ESP32 - used to enable/disable to motor driver
* *STEP, DIR* - connect to two digital pins on the ESP32 - used to step the motor and set the direction
* *MS1, MS2* - connect to two digital pins on the ESP32 - used set the step mode
* *SLEEP, RESET* - already pulled high on the EasyDriver board, so no connection neeed. If using a different driver board, ensure these pins are pulled high, else connect to VCC
* *PFD* - not used
The **Stepper_A3967** class includes two constructors:
* `Stepper_TB6612(int AIN1, int AIN2, int BIN1, int BIN2 [,{uint32_t priority, uint32_t cpu}] )`
* controls the driver board using only 4 digital pins from the ESP32, where the parameters specify the pin numbers. Supports the following step type modes:
The **Stepper_A3967** class includes the following constructor:
* `Stepper_A3967(int M1, int M2, int STEP, int DIR, int ENABLE)`
* controls the driver board using 5 digital pins from the ESP32, where the parameters specify the pin numbers. Supports the following step type modes:
* FULL_STEP_ONE_PHASE
* FULL_STEP_TWO_PHASE
* HALF_STEP
* `Stepper_TB6612(int AIN1, int AIN2, int BIN1, int BIN2, int PWMA, int PWMB, [,{uint32_t priority, uint32_t cpu}])`
* controls the driver board using 4 digital pins and 2 PWM pins from the ESP32, where the parameters specify the pin numbers. Supports the following step type modes:
* FULL_STEP_ONE_PHASE
* FULL_STEP_TWO_PHASE
* HALF_STEP
* QUARTER_STEP
* EIGHTH_STEP
Both constructors support an *optional* final parameter consisting of a *brace-enclosed* pair of numbers. The first number in the braces specifies the *priority* of the background task used to control the stepper motor. The second number in the braces specifies the CPU (0 or 1) that **Stepper_A3967** will use to run the background control task (this number is ignored for single-processor chips). The default (and recommended) value of this optional final parameter is {1,0}.
❗Note: The A3967 chip does not support a short brake state. Calls to the `brake()` method, as well as setting the *endAction* parameter in the `move()` and `moveTo()` methods to **StepperControl::BRAKE** have no effect on the motor driver.
---