Devices & Components
Arduino Uno Rev3
Bipolar stepper motor with gearbox 42STH38-100
DFROBOT DRI0023
HC-05 Bluetooth Module
Hardware & Tools
CNC Laser Engraver
jigsaw
3D Printer-Ultimaker S3
Screwdrivers
Software & Tools
MIT App Inventor 2
Arduino IDE
Fritzing
Ultimaker CURA (Slicer for 3D printers)
FreeCAD
Project description
Code
Activate mill and tap
js
Allow to run motors, it's in C++ not in JavaScript
1#include <SoftwareSerial.h> 2 3#define rxPin 11 // Broche 11 en tant que RX, à raccorder sur TX du HC-05 4#define txPin 10 // Broche 10 en tant que TX, à raccorder sur RX du HC-05 5 6SoftwareSerial mySerial(rxPin, txPin); 7 8int M1dirpin = 7; //Motor X direction pin 9int M1steppin = 6; //Motor X step pin 10int M1en=8; //Motor X enable pin 11 12int M2dirpin = 4; //Motor Y direction pin 13int M2steppin = 5; //Motor Y step pin 14int M2en=12; //Motor Y enable pin 15int tempo = 10 ; 16int valbt = 0 ; 17 18void setup() 19{ 20 // define pin modes for tx, rx pins: 21 pinMode(rxPin, INPUT); 22 pinMode(txPin, OUTPUT); 23 mySerial.begin(9600); 24 Serial.begin(9600); 25 26 pinMode(M1dirpin,OUTPUT); 27 pinMode(M1steppin,OUTPUT); 28 pinMode(M1en,OUTPUT); 29 30 digitalWrite(M1en,LOW);// Low Level Enable 31} 32 33void loop() 34{ 35if (mySerial.available()) 36 { 37 valbt = mySerial.read(); 38 if (valbt == 2){ 39 Serial.println(valbt); 40 digitalWrite(7, HIGH); // On met la broche DIR à l'état haut 41 for (long i=0; i <= 140000; i++){ 42 digitalWrite(M1steppin, LOW); 43 delayMicroseconds(tempo); // On envoie 200 impulsions pour faire tourner le moteur de 200 pas dans un sens 44 digitalWrite(M1steppin, HIGH); // La valeur de tempo determine le temps entre 2 impulsions en ms 45 delayMicroseconds(tempo); 46 } 47 digitalWrite(M1steppin, LOW); 48 digitalWrite(M1en,LOW); 49 digitalWrite(7, LOW); 50 } 51 if (valbt == 3){ 52 Serial.println(valbt); 53 digitalWrite(M2dirpin, HIGH); // On met la broche DIR à l'état haut 54 for (long i=0; i <= 140000; i++){ 55 digitalWrite(M2steppin, LOW); 56 delayMicroseconds(tempo); // On envoie 200 impulsions pour faire tourner le moteur de 200 pas dans un sens 57 digitalWrite(M2steppin, HIGH); // La valeur de tempo determine le temps entre 2 impulsions en ms 58 delayMicroseconds(tempo); 59 } 60 digitalWrite(M2steppin, LOW); 61 digitalWrite(M2en,LOW); 62 digitalWrite(M2dirpin, LOW); 63 delay(2000); 64 for (long i=0; i <= 140000; i++){ 65 digitalWrite(M2steppin, LOW); 66 delayMicroseconds(tempo); // On envoie 200 impulsions pour faire tourner le moteur de 200 pas dans un sens 67 digitalWrite(M2steppin, HIGH); // La valeur de tempo determine le temps entre 2 impulsions en ms 68 delayMicroseconds(tempo); 69 } 70 digitalWrite(M2steppin, LOW); 71 digitalWrite(M2en,LOW); 72 73 } 74 } 75 delay(100); 76}
Downloadable files
Mill
support was necessary, made in PLA
file.None
Mill support
In PLA, no support
file.None
Slide
In PLA, support was necessary
file.None
Motors support
In PLA and no support necessary
file.None
Documentation
Wiring diagram
In the description
wiring diagram.png

Requirement diagram
All our ideas when we started
requirement diagramn.png

Comments
Only logged in users can leave comments