Em đã có giải pháp tạm thời (chỉ là tạm thời vì nó chỉ cho 1 tốc độ, mà thực tế khi vào hoạt động em cần tùy chỉnh tốc độ) nên quyết định dùng step motor. Qua tư vấn em mua cái stepper 42 (nema17) cũ, cái mạch arduino uno, stepper driver TMC2100 (loại này bọn nước ngoài nó tư vấn em dùng vì cho chế độ vi bước và rất êm, và nó cũng dùng cái này rồi, mà cái của em lại cần phải cực êm mới được), mua cái Socket Module A4988 DRV8825 để cắm con TMC2100 vào (lỡ mua rồi, nhưng có nên thay bằng con Module CNC Shield V3 ???)
Em có xin 1 thằng tây cái code arduino nó đang dùng cho con TMC2130, arduino nano,... Các bác biết về arduino xem giúp em cần sửa cái gì, đấu nối ra sao, vì em nối thử thì nó đek quay motor gì hết. (EM MÙ TỊT).
Code đây ah:
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
*/
#define ENPin 11 // Nano v3: 16 Mega: 38 //enable (CFG6)
#define dirPin 10 // 19 55 //direction
#define stepPin 8 // 18 54 //step
#define CSPin 3 // 17 64 //chip select
#include <TMC2130Stepper.h>
TMC2130Stepper TMC2130 = TMC2130Stepper(ENPin, dirPin, stepPin, CSPin);
// const int stepPin = 8;
//const int dirPin = 7;
const int startPin = 5;
const int stopPin = 6;
const int limitPin = 2;
int i = 0;
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(9600);
TMC2130.begin(); // Initiate pins and registeries
TMC2130.rms_current(1200); // Set stepper current to 1200mA. The command is the same as command TMC2130.setCurrent(1200, 0.11, 0.5);
TMC2130.stealthChop(1); // Enable extremely quiet stepping
digitalWrite(ENPin, LOW);
// initialize digital pins as an outputs/inputs.
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(startPin, INPUT);
pinMode(stopPin, INPUT);
pinMode(limitPin, INPUT);
digitalWrite(dirPin, LOW);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(startPin, HIGH);
digitalWrite(stopPin, HIGH);
digitalWrite(limitPin, HIGH);
if (digitalRead(startPin) == LOW) // Lead In starts when lead in button pressed.
{
while (i < 1250)
{
digitalWrite(8, HIGH);
delayMicroseconds(1);
digitalWrite(8, LOW);
delayMicroseconds(2500);
i++;
}
i = 0;
while (digitalRead(stopPin) == HIGH) // While Leadout button isn't pressed, bring cutter head to centre of the disk.
{
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delayMicroseconds(1); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
// delayMicroseconds(6000); //Defines groove width @ <3mins
//delayMicroseconds(9500); //Defines groove width @ <3mins3sec
//delayMicroseconds(12500); //Defines groove width @ <3mins
delay(17); //Defines groove width @ 33rm
}
while (digitalRead(limitPin) == HIGH)
{
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delayMicroseconds(1); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delayMicroseconds(1500);
}
// wait for a second
}
}
}
Nhu cầu của em là:
- Tốc độ quay ~ 2.5 rpm, có nút tăng tốc, có nút về tốc độ cũ, có nút đảo chiều quay (nếu có thêm được màn hình hiển thị nữa thì tốt)
Thêm cái clip giải pháp tạm thời, cũ kỹ cần sửa của em đây ah - motor 24vac 1rpm, combo mua của bác Trung BắcNinh![]()
Thêm cái sản phẩm em làm cho xôm
Mong các bác giúp em, chân thành cảm ơn!!!
Hoặc bác nào nhận viết code và tính phí cho em ah!!! Dài dòng qúa mong các bác bỏ qua!



để chia sẻ bài viết lên facebook

Trả lời kèm Trích dẫn