Wiki » History » Revision 10
Revision 9 (Frédéric Blanc, 2023-11-17 13:21) → Revision 10/13 (Frédéric Blanc, 2023-11-17 14:07)
h1. accelstepper https://www.arduino.cc/reference/en/libraries/accelstepper/ <pre><code class="cpp"> #include <AccelStepper.h> // for the Arduino Uno + CNC shield V3 + A4988 + FL42STH47-1684A #define MOTOR_X_ENABLE_PIN 8 #define MOTOR_X_STEP_PIN 2 #define MOTOR_X_DIR_PIN 5 AccelStepper motor_X(1, MOTOR_X_STEP_PIN, MOTOR_X_DIR_PIN); void setup() { motor_X.setEnablePin(MOTOR_X_ENABLE_PIN); motor_X.setPinsInverted(false, false, true); motor_X.setAcceleration(20); motor_X.move(200); motor_X.setMaxSpeed(100); //motor_X.setSpeed(100); motor_X.enableOutputs(); } void loop() { motor_X.run(); } </code></pre> h2. Arduino CNC Shield V3 !clipboard-202311161621-jcg62.png! !clipboard-202311161620-ib4yo.png! !clipboard-202311161619-rxiam.png! Arduino CNC Shield Scematics V3 h2. Driver MOTOR h3. A4988 !clipboard-202311171114-jwo7q.png! h4. Courant MAX Vref mesure tension entre GND et le potard MaxCurrent=Vref x 2.5 1A => 0.4V h4. Microstepping |MS1 |MS2 |MS3 |Résolution Microstepping| |Low |Low |Low |Pas complet (full step)| |High |Low |Low |1/2 pas| |Low |High |Low |1/4 de pas| |High |High |Low |1/8 ième de pas| |High |High |High |1/16 ième de pas| h3. TMC2208 h4. Courant MAX !clipboard-202311171315-ibiy9.png! Irms = (Vref * 1.77A) / 2.5V = Vref * 0.71 Vref = (Irms * 2.5V) / 1.77A = Irms * 1.41 = Imax Vref -> Voltage on Vref pin Irms -> RMS (Root Mean Square) current per phase (Irms = Imax / 1.41) Imax -> Maximum current per phase (Imax = Irms * 1.41) h4. Microstepping |MS2(-)|MS1(-)|Steps(-)|Interpolation(-)|Mode(-)| |GND|VIO|1⁄2|1⁄256|stealthChop2| |VIO|GND|1⁄4|1⁄256|stealthChop2| |GND|GND|1⁄8|1⁄256|stealthChop2| |VIO|VIO|1⁄16|1⁄256|stealthChop2| <pre><code class="cpp"> void setup() { motor_X.setEnablePin(MOTOR_X_ENABLE_PIN); motor_X.setPinsInverted(false, false, false); motor_X.setAcceleration(2560); motor_X.move(25600); motor_X.setMaxSpeed(1000000); motor_X.setSpeed(25600); motor_X.enableOutputs(); } </code></pre>