Project

General

Profile

Wiki » History » Version 8

Frédéric Blanc, 2023-11-17 13:20

1 3 Frédéric Blanc
h1. accelstepper
2
3
https://www.arduino.cc/reference/en/libraries/accelstepper/
4 2 Frédéric Blanc
5 1 Frédéric Blanc
<pre><code class="cpp">
6
7
8
9
#include <AccelStepper.h>
10
11
// for the Arduino Uno + CNC shield V3 + A4988 + FL42STH47-1684A
12
13
#define MOTOR_X_ENABLE_PIN 8
14
#define MOTOR_X_STEP_PIN 2
15
#define MOTOR_X_DIR_PIN 5
16
17
AccelStepper motor_X(1, MOTOR_X_STEP_PIN, MOTOR_X_DIR_PIN); 
18
19
20
void setup()
21
{
22
  motor_X.setEnablePin(MOTOR_X_ENABLE_PIN);
23
  motor_X.setPinsInverted(false, false, true);
24
  motor_X.setAcceleration(20);  
25
  motor_X.move(200);
26
  motor_X.setMaxSpeed(100);
27
  //motor_X.setSpeed(100);
28
  motor_X.enableOutputs();
29
}
30
31
void loop()
32
{
33
  motor_X.run();
34
}
35
</code></pre>
36 4 Frédéric Blanc
37
h2. Arduino CNC Shield V3
38
39
!clipboard-202311161621-jcg62.png!
40
41
!clipboard-202311161620-ib4yo.png!
42
43
!clipboard-202311161619-rxiam.png!
44
Arduino CNC Shield Scematics V3
45 5 Frédéric Blanc
46
h2. Driver MOTOR
47
48
h3. A4988
49
50
!clipboard-202311171114-jwo7q.png!
51
52 6 Frédéric Blanc
h4. Courant MAX
53
54 5 Frédéric Blanc
Vref mesure tension entre GND et le potard
55
MaxCurrent=Vref x 2.5
56
1A => 0.4V
57 6 Frédéric Blanc
58
h4. Microstepping
59
60
|MS1	|MS2	|MS3	|Résolution Microstepping|
61
|Low	|Low	|Low	|Pas complet (full step)|
62
|High	|Low	|Low	|1/2 pas|
63
|Low	|High	|Low	|1/4 de pas|
64
|High	|High	|Low	|1/8 ième de pas|
65
|High	|High	|High	|1/16 ième de pas|
66 7 Frédéric Blanc
67
h3. TMC2208
68
69
h4. Courant MAX
70
71
!clipboard-202311171315-ibiy9.png!
72
73
Irms = (Vref * 1.77A) / 2.5V = Vref * 0.71
74
Vref = (Irms * 2.5V) / 1.77A = Irms * 1.41 = Imax
75
Vref -> Voltage on Vref pin
76 1 Frédéric Blanc
Irms -> RMS (Root Mean Square) current per phase (Irms = Imax / 1.41)
77 8 Frédéric Blanc
Imax -> Maximum current per phase (Imax = Irms * 1.41)
78
79
80
|MS2(-)|MS1(-)|Steps(-)|Interpolation(-)|Mode(-)|
81
|GND|VIO|1⁄2|1⁄256|stealthChop2|
82
|VIO|GND|1⁄4|1⁄256|stealthChop2|
83
|GND|GND|1⁄8|1⁄256|stealthChop2|
84
|VIO|VIO|1⁄16|1⁄256|stealthChop2|