Hello,
I have customer who want's me to help him make gramophone.
He made turntable stand for Phonograph record and driving pulley to attach it on the NEMA-17 Stepper motor so I need to write code for that.
He want's 492,0663 RPMs on 33,333 gramophone speed mode and 664,28 RPMs on 45 gramophone speed mode.
These 33,333 and 45 speed modes is typical for gramophones anyways the problems is that I'm not sure that NEMA-17 can make to those RPMs. I tried a lot of things with or without AccelStepper library I even asked ChatGPT and tried his versions of code but to me it doesn't seem to achieve those RPMs.
Does anybody knows how to fix this? Do I have to make some gear ratios in driving pulley or is somethings wrong with code? I can attach it if you want.
Before thinking about code, what is the ratio of the two pulleys? You need that before anything else.
Remember, a stepper motor moves in steps, not RPMs. So you need to be able to smooth the stepping by using a spring loaded tension pulley to the design.
Okay, I'll contact customer to find out exactly ratio and other specifications.
But apart from that, general question, is it better to use other types of DC motors for this, or do you think that this stepper can be good for this project?
Customer insisted to use exactly this motor?
Even if your belt is rubber covered fiberglass it will stretch over time and temperature. That picture shows you have VERY LITTLE pulley surface in contact with the belt. A tension pulley would allow you to have at least a 3/4 wrap of the belt.
Basically, customer told me and my colleague that he will do the hardware, we just need to write the code (firmware). So this is obviously just the mechanism that will be packed after to the whole machine... So all in all, I just wanted to ask If Nema-17 can achieve those RPMs mentioned above? Do we need to make another pulley or some other ratios?
Also I can attach code If it will be of any help...
// Libraries
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
const int stepPin = 3;
const int dirPin = 2;
#include <AccelStepper.h>
AccelStepper stepper(AccelStepper::DRIVER, stepPin, dirPin); // STEP, DIR pin
Adafruit_SSD1306 display(128, 64, &Wire, -1);
// Define pins
#define BTN_33 5
#define BTN_45 4
#define POT_PIN A2
int btn_33_value;
int btn_45_value;
bool spin = false;
int stepsPerRevolution = 200; // full steos
int microstepping = 16; // TMC2209 DIP switches (or UART)
int rpm = 1200;
void setup() {
//pinMode(stepPin, OUTPUT);
//pinMode(dirPin, OUTPUT);
pinMode(POT_PIN, OUTPUT);
//stepper.setMaxSpeed(3200); // steps per second
//stepper.setSpeed(3200); // This gives 60 RPM if 3200 steps per rotation
stepper.setMaxSpeed(25600); // 480RPM = 25600 steps per second
stepper.setSpeed(25600); // 480RPM = 25600 steps per second
// 480RPM = 25600 steps per second
pinMode(BTN_33, INPUT);
pinMode(BTN_45, INPUT);
digitalWrite(POT_PIN, LOW);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) for(;;);
display.clearDisplay();
display.setCursor(40, 0);
display.setTextSize(1);
display.setTextColor(WHITE);
display.print("Hello Nema 2");
display.display();
delay(2000);
// Set direction (HIGH or LOW)
//digitalWrite(dirPin, HIGH); // or LOW
}
void loop() {
btn_33_value = digitalRead(BTN_33);
btn_45_value = digitalRead(BTN_45);
int stepsPerSec = (stepsPerRevolution * microstepping * rpm) / 60;
float delayMicro = (1.0 / stepsPerSec) * 1e6;
if (btn_33_value == LOW) {
digitalWrite(POT_PIN, HIGH); // Here we just used it for test to turn ON LED
spin = true;
} else if (btn_45_value == LOW) {
digitalWrite(POT_PIN, LOW); // Here we just used it for test to turn OFF LED
spin = false;
}
// Move 200 steps (1 revolution for 1.8° motor)
if (spin) {
//digitalWrite(stepPin, HIGH);
//delayMicroseconds(delayMicro);
//digitalWrite(stepPin, LOW);
//delayMicroseconds(delayMicro);
stepper.runSpeed();
}
/*
for (int i = 0; i < 2200; i++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(300); // Step pulse width
digitalWrite(stepPin, LOW);
delayMicroseconds(300);
}*/
//delay(1000); // Wait 1 second
// Reverse direction
//digitalWrite(dirPin, !digitalRead(dirPin));
}
This version of code is with AccelStepper library and Motor just vibrates without moving, it seems that 7000 steps is maximum everything above it just vibrates...
From AccelStepper.h:
"/// \par Performance
/// The fastest motor speed that can be reliably supported is about 4000 steps per
/// second at a clock frequency of 16 MHz on Arduino such as Uno etc.
/// Faster processors can support faster stepping speeds.
/// However, any speed less than that
/// down to very slow speeds (much less than one per second) are also supported,
/// provided the run() function is called frequently enough to step the motor
/// whenever required for the speed set.
/// Calling setAcceleration() is expensive,
/// since it requires a square root to be calculated".