Project

General

Profile

Wiki » History » Version 6

Frédéric Blanc, 2023-11-17 11:27

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|