Sunteți pe pagina 1din 54

26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Recherche d'offres Coupons de AliExpress Coupons de Gearbest Coupons de Banggood Trouver un tutoriel
Contact

Accueil Automatisation de la maison  IoT  Mini PC  ESP8266 et Arduino 

Projets bricolage Réductions 


 

Accueil » Niveau de difficulté » Avancé » Faire un mini traceur CNC avec de vieux lecteurs de DVD Arduino et L293D

Niveau de difficulté avancé Projets de bricolage

Faire un mini traceur CNC avec de


vieux lecteurs DVD Arduino et
L293D
23 juin 2016  16028  33 commentaires

 Facebook  Twitter  

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 1/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

   
Il existe de nombreux projets pour recycler les vieux lecteurs de DVD dans un
mini traceur CNC basé sur Arduino. C'est un beau projet et idéal pour débuter
avec son Arduino. La construction mécanique et plus particulièrement le porte-
crayon peut être difficile. Je propose dans cet article de réaliser un mini traceur en
réalisant les éléments mécaniques par impression 3D. Nous utiliserons deux ponts L293D H
pour piloter les moteurs des lecteurs DVD. Nous le trouvons pour moins de 2 € en Chine. Vous
pouvez développer votre mini traceur CNC directement à partir de ce post.

Sommaire [ montrer ]

Étape 1: BOM
Vous pouvez acheter tous les composants sur
internet ou dans un magasin de bricolage.

1x Arduino Uno
1x planche à pain 400 points
Deux entraînements de moteur L293D ‫اﻟﻣطﺎﺑﻊ اﻟﻣﯾﻛﺎﻧﯾﻛﯾﺔ ﻣﺻﻧّﻊ‬
1x servomoteur SG90 ‫ﻣﻌدّات و ﺗﻘﻧﯾﺎت ﻣن أﻋﻠﻰ‬
‫ﺟودة ﻓﻲ ﻣﺟﺎل آﻻت‬
2 anciens lecteurs de CD / DVD ‫ ﻧﻘدّم اﻟﺧدﻣﺎت ﻓﻲ‬.‫اﻟﺿﻐط‬
‫اﻟﺧﺎرج أﯾﺿﺎ‬
2 fils 22AWG (jaune) 15cm (0.6 in)
2 fils 22AWG (vert) 15cm (0.6 in)
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 2/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

2 fils 22AWG (rouge) 15cm (0.6 in)


2 fils 22AWG (blanc) 15cm (0.6 in)
Certains tubes rétractables
1x feuille de contreplaqué 200 x 160 mm (7,87 po x 6,3 po) pour l'axe X. Épaisseur: 10 mm
(0,39 po) ou 5 mm en plexiglas (0,2 po)
2 feuilles de contreplaqué de 150 x 50 mm (5,91 po x 0,2 po) pour l'axe Y.
1x plaque de plexiglass (0,2 po) 76 x 76 mm (taille d'un poteau, 3 x 3 po)
1x tige de 3 mm (0,12 po) x 80 mm (3,15 po)
Pistolet à colle
2x vis M2 ou colle pour fixer le servo
8x M4x35mm et écrous
1x vis M5x20mm et écrou

Étape 2: Préparer les systèmes de traduction


Démonter les anciens lecteurs de DVD pour obtenir le système de traduction avec le moteur pas
à pas.

Micro OLEDs for clear


images with high contrast
and no color breakup, great …
Ad FRAMOS

Learn more

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 3/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Moteur pas à pas et système de traduction de lecteur DVD prêt à l'emploi.

Étape 3: Préparer les moteurs pas à pas (axes X et Y)


Il est préférable de vendre les fils sur le connecteur flexible. Vous pouvez avoir des problèmes si
vous vendez directement sur le moteur pas à pas. Si vous le pouvez, essayez d'utiliser 4
couleurs différentes, une pour chaque Pin. Il n'y a pas d'identification sur le moteur mais la
connexion est assez simple. Le premier fil correspond à la première sortie du L293D
(habituellement) et ainsi de suite.

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 4/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Étape 4: Imprimer des pièces 3D


Vous pouvez télécharger les fichiers STL de ce projet sur Thingiverse ou Cults3D .

Custom Made Carbide Router


Bit - Lowest Cost, Call Us Now
Ad We Provide Custom Brazed on Carbide
and Solid Carbide Bits and Shaper Cutters
orbittools.com

Learn more

Partie Conception 3D Nombre

Supports de montage (axe X) 4x

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 5/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Espaceurs 8x

Entretoises de planche à pain 4x

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 6/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Base de l'axe Z 1 fois

Trousse (8mm diam.) 1 fois

Crayon anti-bascule 1 fois

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 7/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Je préfère utiliser le filament PLA car c'est un matériau respectueux de l'environnement et non
toxique. Si vous imprimez toutes les pièces, vous avez besoin d'environ 3 heures. J'utilise
l'imprimante 3D française Dagoma discovery200 .

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 8/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Étape 5: Préparer la structure de contreplaqué


Il suffit de couper les 3 parties (voir la nomenclature pour les dimensions)

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 9/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Étape 6: Préparer le circuit


Le circuit est vraiment facile comme vous pouvez le voir ci-dessous. Un L293D pour chaque axe
et un servomoteur pour l'axe Z.

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 10/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

2x plongeurs de moteur L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 11/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Arduino Uno

Étape 7: Assemblage du mini-traceur CNC


Axes X et Y

Utilisez 4 entretoises et 4 vis M4 x 30mm pour assembler l'axe X sur le bois de jeu (200 x
160mm). Faites de même pour l'axe Y. Utilisez l'image ci-dessous pour configurer la position des

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 12/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

éléments. Fixez enfin l'axe Y sur les montants verticaux. La hauteur n'est pas importante, il suffit
d'ajuster la position du stylo dans son support.

Surface de dessin

Utilisez un pistolet à colle pour fixer la surface de dessin sur l'axe. Pour trouver la bonne position,
déplacez le moteur pas à pas au maximum. positionnez-le et corrigez-le.

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 13/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Surface de dessin (vue de face)

Trousse (axe Z)

Suivez le dessin pour assembler le porte-crayon. Fixez le servomoteur avec 2 vis M2 ou de la


colle.

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 14/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Custom Made Carbide Router


Bit - Lowest Cost, Call Us Now
Ad We Provide Custom Brazed on Carbide
and Solid Carbide Bits and Shaper Cutters
orbittools.com

Learn more

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 15/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Porte-crayon

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 16/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Porte-crayons (vue de gauche)

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 17/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Porte-crayon (vue à droite) avec le servomoteur

Breadboard et Arduino

Utilisez des entretoises pour fixer la planche à pain.

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 18/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Breadboard et Arduino (vue arrière)

Étape 8: Con gurer les axes X et Y


https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 19/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Maintenant, nous pouvons commencer à programmer! Tout d'abord, nous devons tester si les
axes X et Y sont correctement connectés. Après cela, nous allons calibrer les moteurs pas à
pas.

Test d'axe X

Les axes X utilisent les pins 8,9,10 et 11 par défaut. Démarrer ce programme Si tout est correct,
le moteur pas à pas doit faire 100 pas. Mesurez la distance et divisez par 100 pour obtenir la
valeur d'étalonnage de l'axe X.

Custom Made Carbide Router


Bit - Lowest Cost, Call Us Now
Ad We Provide Custom Brazed on Carbide
and Solid Carbide Bits and Shaper Cutters
orbittools.com

Learn more

1 /*
2   Mini Traceur Arduino (CNC Plotter)
3   Test X Axis
4   Projets DIY 02/2016
5 */
6 #include <Stepper.h> // Include the stepper Motor librarie
7  
8 const int pasParRotation = 20;         // Number of steps by turn. Standard value for CD/DV
9
10 // Indicate X axis stepper motor Pins
11 Stepper myStepperX(pasParRotation, 8,9,10,11);
12
13 void setup() {
14 myStepperX.setSpeed(100); // Stepper motor speed
15 // Indicate the number of steps the drive need to do.
16 // CD/DVD drive can do about 250 steps max.
17 // Negative number to reverse direction of the movement
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 20/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

18 myStepperX.step(100);         // Measure the distance the pencil move to calculate X


19 delay(100);
20 }
21
22 void loop() {}

Test de l'axe Y

Faites de même pour l'axe Y.

Micro OLEDs for clear


images with high contrast
and no color breakup, great …
Ad FRAMOS

Learn more

1 /*
2   Mini Traceur Arduino (CNC Plotter)
3   Test de l'axe Y
4   Projets DIY 02/2016
5 */
6 #include <Stepper.h> //Librairie pour piloter les moteurs pas à pas
7
8 const int pasParRotation = 20; //Nombre de pas pour réaliser un tour
9
10 //Pins sur lesquels est relié le moteur de l'axe X
11 Stepper myStepperX(pasParRotation, 2,3,4,5);
12
13 void setup() {
14 myStepperX.setSpeed(100); //Vitesse de déplacement
15 //Indiquer le nombre de pas que le moteur pas à pas doit faire
16 //Généralement un moteur de lecteur CD/DVD peut faire 250 pas au maxium
17 //Indiquer un chiffre négatif pour inverser le sens de déplacement
18 myStepperX.step(100);
19 delay(100);
20 }

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 21/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

21
22 void loop() {}

En cas de problème

Les principaux problèmes que j'ai rencontrés lors du développement de mon traceur:

Le moteur ne bouge pas: vérifiez d'abord le câblage du L293D. Les broches IN et OUT
peuvent être inversées.
La direction du mouvement est inversée. Inverser les broches sur le L293D.
Le moteur ne s'arrête jamais, ne pas aller à la fin ou "sauter". Il y a probablement un obstacle
sur son chemin. Vérifiez si une vis n'est pas trop longue ...

Étape 9: Télécharger le code CNC dans l'Arduino


Avant de télécharger le programme CNC, vous devez peut-être mettre à jour la configuration

penZUp: angle du servo quand le stylo est en haut


penZDown: angle lorsque le stylo est en bas (sur la feuille de papier)
Broches: servo, X et Y axes
Valeurs d'étalonnage des axes X et Y

 Attention: n'utilisez pas le servomoteur pour appuyer sur le


crayon de la feuille de papier. La force exercée par l'actionneur

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 22/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

peut être trop forte et empêcher le déplacement de l'axe X. Le


stylo est pressé sur la feuille par le ressort.

Custom Made Carbide Router


Bit - Lowest Cost, Call Us Now
Ad We Provide Custom Brazed on Carbide
and Solid Carbide Bits and Shaper Cutters
orbittools.com

Learn more

1 /*
2 Mini Traceur CNC Arduino
3 Traduction de la configuration du traceur en français et ajout d'une variable "vitesseDepl
4 Projets DIY - 02/2016
5
6 D'après
7 Mini CNC Plotter firmware, based in TinyCNC https://github.com/MakerBlock/TinyCNC-Sketche
8 Send GCODE to this Sketch using gctrl.pde https://github.com/damellis/gctrl
9 Convert SVG to GCODE with MakerBot Unicorn plugin for Inkscape available here https://gith
10
11 More information about the Mini CNC Plotter here (german, sorry): http://www.makerblog.at/
12   */
13  
14 #include <Servo.h>
15 #include <Stepper.h>
16  
17 #define LINE_BUFFER_LENGTH 512
18  
19 /*
20    PARAMETRES DE CONFIGURATION
21 */
22  
23 const int penZUp = 130; // Angle servomoteur, crayon relevé
24 const int penZDown = 40;            // Angle servomoteur, crayon baissé
25 const int penServoPin = 6; // Pin sur lequel est relié le servomoteur
26 const int stepsPerRevolution = 20; // Valeur par défaut
27 const int vitesseDeplacement = 250; // Vitesse de déplacement des axes X et Y
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 23/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

28  
29 Servo penServo;   // Objet pour actionner le servomoteur
30  
31 // Initialisation des moteurs pas à pas pilotés à l'aide d'un pont H L293D
32 Stepper myStepperY(stepsPerRevolution, 2,3,4,5); // Axe X        
33 Stepper myStepperX(stepsPerRevolution, 8,9,10,11);  // Axe Y
34  
35 // Calibration, nombre de pas par millimètre
36 float StepsPerMillimeterX = 6.0;
37 float StepsPerMillimeterY = 6.0;
38  
39 /*
40   FIN DE LA CONFIGURATION
41 */
42  
43 /* Structures, global variables    */
44 struct point {
45   float x;
46   float y;
47   float z;
48 };
49  
50 // Current position of plothead
51 struct point actuatorPos;
52  
53 //  Drawing settings, should be OK
54 float StepInc = 1;
55 int StepDelay = 0;
56 int LineDelay = 50;
57 int penDelay = 50;
58  
59 // Drawing robot limits, in mm
60 // OK to start with. Could go up to 50 mm if calibrated well.
61 float Xmin = 0;
62 float Xmax = 40;
63 float Ymin = 0;
64 float Ymax = 40;
65 float Zmin = 0;
66 float Zmax = 1;
67  
68 float Xpos = Xmin;
69 float Ypos = Ymin;
70 float Zpos = Zmax;
71  
72 // Set to true to get debug output.
73 boolean verbose = false;
74  

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 24/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

75 //  Needs to interpret
76 //  G1 for moving
77 //  G4 P300 (wait 150ms)
78 //  M300 S30 (pen down)
79 //  M300 S50 (pen up)
80 //  Discard anything with a (
81 //  Discard any other command!
82  
83 /**********************
84 * void setup() - Initialisations
85 ***********************/
86 void setup() {
87   //  Setup
88   Serial.begin( 9600 );
89   
90   penServo.attach(penServoPin);
91   penServo.write(penZUp);
92   delay(200);
93  
94   // Decrease if necessary
95   myStepperX.setSpeed(vitesseDeplacement);
96   myStepperY.setSpeed(vitesseDeplacement);  
97  
98   //  Set & move to initial default position
99   // TBD
100  
101   //  Notifications!!!
102   Serial.println("Mini CNC Plotter alive and kicking!");
103   Serial.print("X range is from ");
104   Serial.print(Xmin);
105   Serial.print(" to ");
106   Serial.print(Xmax);
107   Serial.println(" mm.");
108   Serial.print("Y range is from ");
109   Serial.print(Ymin);
110   Serial.print(" to ");
111   Serial.print(Ymax);
112   Serial.println(" mm.");
113 }
114  
115 /**********************
116 * void loop() - Main loop
117 ***********************/
118 void loop()
119 {
120   delay(200);
121   char line[ LINE_BUFFER_LENGTH ];

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 25/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

122   char c;
123   int lineIndex;
124   bool lineIsComment, lineSemiColon;
125  
126   lineIndex = 0;
127   lineSemiColon = false;
128   lineIsComment = false;
129  
130   while (1) {
131  
132     // Serial reception - Mostly from Grbl, added semicolon support
133     while ( Serial.available()>0 ) {
134       c = Serial.read();
135       if (( c == '\n') || (c == '\r') ) {             // End of line reached
136         if ( lineIndex > 0 ) {                        // Line is complete. Then execute!
137           line[ lineIndex ] = '\0';                   // Terminate string
138           if (verbose) {
139             Serial.print( "Received : ");
140             Serial.println( line );
141           }
142           processIncomingLine( line, lineIndex );
143           lineIndex = 0;
144         }
145         else {
146           // Empty or comment line. Skip block.
147         }
148         lineIsComment = false;
149         lineSemiColon = false;
150         Serial.println("ok");    
151       }
152       else {
153         if ( (lineIsComment) || (lineSemiColon) ) {   // Throw away all comment characters
154           if ( c == ')' )  lineIsComment = false;     // End of comment. Resume line.
155         }
156         else {
157           if ( c <= ' ' ) {                           // Throw away whitepace and control c
158           }
159           else if ( c == '/' ) {                    // Block delete not supported. Ignore c
160           }
161           else if ( c == '(' ) {                    // Enable comments flag and ignore all
162             lineIsComment = true;
163           }
164           else if ( c == ';' ) {
165             lineSemiColon = true;
166           }
167           else if ( lineIndex >= LINE_BUFFER_LENGTH-1 ) {
168             Serial.println( "ERROR - lineBuffer overflow" );

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 26/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

169             lineIsComment = false;


170             lineSemiColon = false;
171           }
172           else if ( c >= 'a' && c <= 'z' ) {        // Upcase lowercase
173             line[ lineIndex++ ] = c-'a'+'A';
174           }
175           else {
176             line[ lineIndex++ ] = c;
177           }
178         }
179       }
180     }
181   }
182 }
183  
184 void processIncomingLine( char* line, int charNB ) {
185   int currentIndex = 0;
186   char buffer[ 64 ];                                 // Hope that 64 is enough for 1 parame
187   struct point newPos;
188  
189   newPos.x = 0.0;
190   newPos.y = 0.0;
191  
192   //  Needs to interpret
193   //  G1 for moving
194   //  G4 P300 (wait 150ms)
195   //  G1 X60 Y30
196   //  G1 X30 Y50
197   //  M300 S30 (pen down)
198   //  M300 S50 (pen up)
199   //  Discard anything with a (
200   //  Discard any other command!
201  
202   while( currentIndex < charNB ) {
203     switch ( line[ currentIndex++ ] ) {              // Select command, if any
204     case 'U':
205       penUp();
206       break;
207     case 'D':
208       penDown();
209       break;
210     case 'G':
211       buffer[0] = line[ currentIndex++ ];          // /!\ Dirty - Only works with 2 digit c
212       //      buffer[1] = line[ currentIndex++ ];
213       //      buffer[2] = '\0';
214       buffer[1] = '\0';
215  

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 27/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

216       switch ( atoi( buffer ) ){                   // Select G command


217       case 0:                                   // G00 & G01 - Movement or fast movement. S
218       case 1:
219         // /!\ Dirty - Suppose that X is before Y
220         char* indexX = strchr( line+currentIndex, 'X' );  // Get X/Y position in the string
221         char* indexY = strchr( line+currentIndex, 'Y' );
222         if ( indexY <= 0 ) {
223           newPos.x = atof( indexX + 1);
224           newPos.y = actuatorPos.y;
225         }
226         else if ( indexX <= 0 ) {
227           newPos.y = atof( indexY + 1);
228           newPos.x = actuatorPos.x;
229         }
230         else {
231           newPos.y = atof( indexY + 1);
232           indexY = '\0';
233           newPos.x = atof( indexX + 1);
234         }
235         drawLine(newPos.x, newPos.y );
236         //        Serial.println("ok");
237         actuatorPos.x = newPos.x;
238         actuatorPos.y = newPos.y;
239         break;
240       }
241       break;
242     case 'M':
243       buffer[0] = line[ currentIndex++ ];        // /!\ Dirty - Only works with 3 digit com
244       buffer[1] = line[ currentIndex++ ];
245       buffer[2] = line[ currentIndex++ ];
246       buffer[3] = '\0';
247       switch ( atoi( buffer ) ){
248       case 300:
249         {
250           char* indexS = strchr( line+currentIndex, 'S' );
251           float Spos = atof( indexS + 1);
252           //          Serial.println("ok");
253           if (Spos == 30) {
254             penDown();
255           }
256           if (Spos == 50) {
257             penUp();
258           }
259           break;
260         }
261       case 114:                                // M114 - Repport position
262         Serial.print( "Absolute position : X = " );

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 28/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

263         Serial.print( actuatorPos.x );


264         Serial.print( "  -  Y = " );
265         Serial.println( actuatorPos.y );
266         break;
267       default:
268         Serial.print( "Command not recognized : M");
269         Serial.println( buffer );
270       }
271     }
272   }
273 }
274  
275  
276 /*********************************
277 * Draw a line from (x0;y0) to (x1;y1).
278 * Bresenham algo from https://www.marginallyclever.com/blog/2013/08/how-to-build-an-2-axis
279 * int (x1;y1) : Starting coordinates
280 * int (x2;y2) : Ending coordinates
281 **********************************/
282 void drawLine(float x1, float y1) {
283  
284   if (verbose)
285   {
286     Serial.print("fx1, fy1: ");
287     Serial.print(x1);
288     Serial.print(",");
289     Serial.print(y1);
290     Serial.println("");
291   }  
292  
293   //  Bring instructions within limits
294   if (x1 >= Xmax) {
295     x1 = Xmax;
296   }
297   if (x1 <= Xmin) {
298     x1 = Xmin;
299   }
300   if (y1 >= Ymax) {
301     y1 = Ymax;
302   }
303   if (y1 <= Ymin) {
304     y1 = Ymin;
305   }
306  
307   if (verbose)
308   {
309     Serial.print("Xpos, Ypos: ");

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 29/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

310     Serial.print(Xpos);
311     Serial.print(",");
312     Serial.print(Ypos);
313     Serial.println("");
314   }
315  
316   if (verbose)
317   {
318     Serial.print("x1, y1: ");
319     Serial.print(x1);
320     Serial.print(",");
321     Serial.print(y1);
322     Serial.println("");
323   }
324  
325   //  Convert coordinates to steps
326   x1 = (int)(x1*StepsPerMillimeterX);
327   y1 = (int)(y1*StepsPerMillimeterY);
328   float x0 = Xpos;
329   float y0 = Ypos;
330  
331   //  Let's find out the change for the coordinates
332   long dx = abs(x1-x0);
333   long dy = abs(y1-y0);
334   int sx = x0<x1 ? StepInc : -StepInc;
335   int sy = y0<y1 ? StepInc : -StepInc;
336  
337   long i;
338   long over = 0;
339  
340   if (dx > dy) {
341     for (i=0; i<dx; ++i) {
342       myStepperX.step(sx);
343       over+=dy;
344       if (over>=dx) {
345         over-=dx;
346         myStepperY.step(sy);
347       }
348       delay(StepDelay);
349     }
350   }
351   else {
352     for (i=0; i<dy; ++i) {
353       myStepperY.step(sy);
354       over+=dx;
355       if (over>=dy) {
356         over-=dy;

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 30/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

357         myStepperX.step(sx);
358       }
359       delay(StepDelay);
360     }    
361   }
362  
363   if (verbose)
364   {
365     Serial.print("dx, dy:");
366     Serial.print(dx);
367     Serial.print(",");
368     Serial.print(dy);
369     Serial.println("");
370   }
371  
372   if (verbose)
373   {
374     Serial.print("Going to (");
375     Serial.print(x0);
376     Serial.print(",");
377     Serial.print(y0);
378     Serial.println(")");
379   }
380  
381   //  Delay before any next lines are submitted
382   delay(LineDelay);
383   //  Update the positions
384   Xpos = x1;
385   Ypos = y1;
386 }
387  
388 //  Raises pen
389 void penUp() {
390   penServo.write(penZUp);
391   delay(LineDelay);
392   Zpos=Zmax;
393   if (verbose) {
394     Serial.println("Pen up!");
395   }
396 }
397 //  Lowers pen
398 void penDown() {
399   penServo.write(penZDown);
400   delay(LineDelay);
401   Zpos=Zmin;
402   if (verbose) {
403     Serial.println("Pen down.");

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 31/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

404   }
405 }

Étape 10: Installation du traitement ou utilisation de


gctrl.exe
Dernière étape avant votre premier tirage. Nous devons installer un programme qui envoie un
fichier gcode au contrôleur Arduino.

Si vous êtes un utilisateur Windows, vous pouvez directement utiliser la version compilée de
gctrl. Vous pouvez le télécharger ici .

Pour les utilisateurs de macOS ou Linux, vous devez installer Processing ( ici ) puis lancer
gctrl.pde ( télécharger ici )

Étape 11: Tracez votre premier tirage avec gctrl


Avant de faire votre premier tirage:

Assurez-vous que la surface de la parcelle est à l'origine.


Vérifier que rien ne bloque le mouvement des axes
Placez une feuille sur la zone de dessin

gctrl est un programme efficace mais basique dans le sens où il ne vérifie pas le fichier
sélectionné. Le traceur démarre juste après la sélection du fichier gcode. Alors, soyez sûr avant
de valider. En cas de problème, appuyez sur "x"!

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 32/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Appuyez sur "p" pour choisir le port série.


Appuyez sur "h" pour aller à la position de départ
Appuyez sur "g" pour choisir le fichier gcode

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 33/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Une courte vidéo (en français en ce moment ... soyez patient) qui explique comment faire votre
plotter Mini CNC.

Micro OLEDs for clear


images with high contrast
and no color breakup, great …
Ad FRAMOS

Learn more

DIY Mini Traceur Arduino - Mini CNC Plotter

J'espère que vous trouverez tout ce dont vous avez besoin pour fabriquer votre Mini traceur
CNC. J'espère que je n'ai rien oublié. N'hésitez pas à partager votre expérience ou à ajouter vos

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 34/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

astuces. Les commentaires sont là pour.

ABONNEZ-VOUS À LA NEWSLETTER HEBDOMADAIRE

Enter your email Souscrire

Aucun spam et aucune autre utilisation ne sera faite de votre email. Vous pouvez vous
désabonner à tout moment.

Advanced Angular UI
components to help you
build better apps faster. Try …
Ad Progress Telerik

Download

 Facebook  Twitter  

ARTICLES LIÉS

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 35/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Station météo avec Communication


a chage ePaper WebSocket avec un
(Dashboard) pour Jeedom ESP8266 ou Arduino en
sur Raspberry Pi (via l'API Python. Testez avec la
JSON RPC) bibliothèque ws4py sur
Gateway RFLink avec Raspberry Pi
RobotDyn Arduino Mega
2560 Pro Mini et boîtier
imprimé en 3D

Ecran OLED SSD1306 en Tutoriel MicroPython, FarmBot Genesis XL, le


MicroPython, exemple gérer la connexion WiFi au jardin robotisé est en
avec un baromètre démarrage sur ESP8266 / pleine croissance. Un
numérique I2C BME280 ESP32 projet basé sur Raspberry
(ou BMP180) Pi 3 et Arduino Mega 2560

30 Comments diyprojets.io 
1 Login

Sort by Best
 Recommend 1 ⤤ Share

J i th di i
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 36/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D
Join the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name

helder jose • 4 months ago


Hi I'm trying to build the mini plotter :)
I put the code in the arduino IDE and it appeared to me this :

mini_cnc_plotter__franc_s_:407: error: expected '}' at end of input

exit status 1
'gt' was not declared in this scope

Should I replace "gt" with something?


△ ▽ • Reply • Share ›

Projets DIY Mod > helder jose • 4 months ago

Hello Jose. It's strange, I just compile the program with the Arduino IDE (1.8.2) without
any error. Is this the program of step 9?
△ ▽ • Reply • Share ›

helder jose > Projets DIY • 4 months ago


Yes it is.
I just copied again to arduino IDE and the error is gone :)
Thank you for your reply and for your sharing!
△ ▽ • Reply • Share ›

Projets DIY Mod > helder jose • 4 months ago

Great, it's cool. Have fun :D


△ ▽ • Reply • Share ›

helder jose > Projets DIY • 4 months ago


https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 37/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D
j j g

Somehow instead of '<' or '>' it appeared '& g t' (without the space
between the letters).
△ ▽ • Reply • Share ›

Eduardo A. Díaz Mesa • 10 months ago


Hi, very, very good project, I see that many people have been successful.

I have uploaded Test_X_Axis_CNC_Plotter and Y, and my engines have good movement.

I have a problem with gctrl.pde and gctrl.exe, but I do not know why. My engines have no
movement with gctrl. Select the serial port (OK), use the arrows and no movement, load a
gcode image with (G) and no movement. I do not know where the problem is.

You help me? Thank you

My beta-CNC without Arduino, only router with OpenWRT and L293 driver. Does not interpret
GCODE yet:

see more

△ ▽ • Reply • Share ›

Projets DIY Mod > Eduardo A. Díaz Mesa • 10 months ago

Hello Eduardo. Great project. I'm sorry but I have no skills on openwrt (at the moment
;-))
△ ▽ • Reply • Share ›

Sadam Lubowa • a year ago


hi am called sadam i have got a problem i have used the same wiring and code used but my
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 38/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D
hi am called sadam i have got a problem i have used the same wiring and code used but my
cd rom stepper motor they dont move at all think the problem it ld293 ic but i have just bought
them what can i do now because am stack
△ ▽ • Reply • Share ›

kro-nos • a year ago


Hi, please help me.
Have same error as Mahadi....

Arduino: 1.8.3 (Windows 7), Board: "Arduino/Genuino Uno"


cnc_plotter:14: error: #include expects "FILENAME" or <filename> etc...

Included servo and stepper libraries as suggested from sketch menu


but still the same error.
I am not an expert please may you give me detailed info on how to solve.
Thanks a lot.
△ ▽ • Reply • Share ›

Mahadi • a year ago


I have this error please help.......

Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"

cnc_plotter:14: error: #include expects "FILENAME" or <filename>

#include <Servo.h>

cnc_plotter:15: error: #include expects "FILENAME" or <filename>

#include <Stepper.h>

exit status 1
#include expects "FILENAME" or <filename>
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 39/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

This report would have more information with


"Show verbose output during compilation"
option enabled in File -> Preferences.
△ ▽ • Reply • Share ›

Projets DIY Mod > Mahadi • a year ago

Hi Mahadi. You need to install the servo library. You just need to install it directly from
the library manager (sketch menu). After that, you can download the program. Have a
good day.
△ ▽ • Reply • Share ›

Avatar This comment was deleted.

Projets DIY Mod > Guest • a year ago

Sorry Mahadi, it's totally impossible to help you like that. Could you send
me your sketch by using the contact form. Thank's
△ ▽ • Reply • Share ›

Mahadi > Projets DIY • a year ago


I Figure-out the problem and fix it ...But now i got a serious problem
about G- Code making ...Can u Please tell me How can i generate G-
Code With out inkscape ?

Actually i Use inkscape 0.48.5 version and also it's plugin But i don't find
g code export ...option.. So..How can i Generate G- Code .?
And How you generate G code For Yourself.
△ ▽ • Reply • Share ›

Projets DIY Mod > Mahadi • a year ago


Hello Mahadi. I'm glad if you found the solution ! To prepare your gcode
files, just follow this post http://www.diyprojects.io/p...
See you soon
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 40/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

△ ▽ • Reply • Share ›

Itihash • a year ago


Step 6
I haven't find similarity between drawing and real photo.
△ ▽ • Reply • Share ›

greg • a year ago


Isn't a little mistake on connection from axis Y , l293d and pin 11 (white path) on breadboard? I
guess it should be on oposite pins for l293d ?
△ ▽ • Reply • Share ›

Projets DIY Mod > greg • a year ago

Hi Greg. You probably right. Depending your drive, you may need to switch pins to find
the correct direction. I hope you'll succeed with your project. See you soon.
△ ▽ • Reply • Share ›

Itihash • a year ago


What i need to do for test X & Y axis?
△ ▽ • Reply • Share ›

Projets DIY Mod > Itihash • a year ago

Hi Itihash. Can you tell at what step your are ?


△ ▽ • Reply • Share ›

Itihash > Projets DIY • a year ago


I'll make it so i following you but i didn't understand the step 8.
△ ▽ • Reply • Share ›

Projets DIY Mod > Itihash • a year ago

OK. We want to know how many steps are needed to move the pencil
(for example 10mm). So, run X drive with 100 steps, after measure the
distance (x) and then divide 100/x mm. Now replace the value of the
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 41/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

variable StepsPerMillimeterX (by default, it 6s/mm) . Do the same for the


Y axis. After that, the X and Y axis are ready. I hope it's clear enough
now. Have a good day. Christophe
△ ▽ • Reply • Share ›

Itihash > Projets DIY • a year ago


I can do it using gctrl or I need another application?
△ ▽ • Reply • Share ›

Projets DIY Mod > Itihash • a year ago

No. Use the Arduino IDE. Create a new file (for example TestX.ino) and
past the code of the step 8 (X axis step). Start the program and do as
indicate before. Do the same for the Y axis (or just change the Pins of
the Y stepper motor). I'm sorry i forgot to translate in English the
comments... but now, i'm sure you read French very well ;-). Bye
△ ▽ • Reply • Share ›

Itihash > Projets DIY • a year ago


Thanks.
△ ▽ • Reply • Share ›

Sadanand Kale • a year ago


I have problem when I'm trying to execute g code... It's just showed.... Loading file.... And
nothing..... What to do
△ ▽ • Reply • Share ›

kro-nos > Sadanand Kale • a year ago


Solved.
Thanks
△ ▽ • Reply • Share ›

Projets DIY Mod > kro-nos • a year ago


Great. Maybe you could explain to everyone how you solved the problem.
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 42/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

Thank's
△ ▽ • Reply • Share ›

bujari • a year ago


I did all steps like you but the stepper motors are not running. The servo motor is running but
the steps not. can you help me please
△ ▽ • Reply • Share ›

Projets DIY Mod > bujari • a year ago

Hi Bujari. Can you tell me how you power the stepper motors? May be that there is not
enough power. The problem with recycling stepper motors from older dvd drives is that
you do not know pin marking. You have to look for the right wiring. See you soon.
△ ▽ • Reply • Share ›

bujari > Projets DIY • a year ago


I tried by stepper test, is running properly.
Power I tried 12V and 9V the same.
1△ ▽ • Reply • Share ›

✉ Subscribe d Add Disqus to your siteAdd DisqusAdd 🔒 Privacy

Suivez nous
https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 43/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 44/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 45/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 46/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 47/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 48/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 49/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 50/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 51/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 52/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 53/54
26/04/2018 Faire un mini traceur CNC avec de vieux lecteurs DVD Arduino et L293D

© Copyright 2017, Tous droits réservés. Disclaimer: Les marques et photographies visibles sur la propriété diyprojects.io de
leurs auteurs et propriétaires respectifs. Sitemap

https://diyprojects.io/make-mini-cnc-plotter-old-dvd-players-arduino-l293d/#.WuEHbBsvy1s 54/54

S-ar putea să vă placă și