This is my first dive into robotics/microcontroller so please be gentle.
So I’m modifying an equatorial platform to track celestial objects via a big telescope. Now the original unit came wth stepper motors to drive the tracing system. The problem is because the stepper motors are operating at low rpm they set up a vibration in the system and the image is very blurry.
To rectify this I’m replacing the stepper setup with a BLDC motor as per the title of this post. However I’m lost as to which controller would be the best/simplest to utilise the feedback output from the motor. I have successfully used an Arduino mega and found a 25khz pwm sketch to gain control and it works but the speed needs to be regulated.
Any ideas would be greatly appreciated. I just boggled by all the different units available!
Hello @Neurokid and welcome to the RobotShop community,
Because stepper motors move in discrete steps they might seem “jerky” at low speeds. However, one way of reducing the jerkiness is setting the micro-stepping to smaller fractions of a step (using a micro-stepping driver). I’m mentioning this because a stepper motor seems to be the best choice for this type of application (because you probably need high precision).
However, if you choose to change the motor, one with a high reduction ratio (like the one you chose) could be a good option as well.
The motor you linked has a built-in driver/controller so you don’t need to get an additional one. To control the speed you need to change the duty cycle of the PWM signal. To get a better idea of how PWM works I suggest checking this blog:
Now, about the feedback, the yellow wire carries this signal, the FG (Frequency Generator) hall sensor signal which consists of a series of voltage pulses that the motor sends to the control board. The control counts these pulses, then calculates based on that how quickly the motor is turning.
Yes you are right, the stepper motor is already operating using micro stepping. It operates at around 0.4 rpm with a gear reduction of 14:1. So the steps are at very low frequency and the current is set to the minimum so as to avoid slipping but still provide positive drive. Any vibration is too much when observing a planet at at least 200x magnification. I have tried vibration isolators, different motor drivers, differing damping materials and all with some improvement but no real solution.
I Have the BLDC gear reduction motor operating with a 25khz PWM signal and I can very the pulse width but I can’t work out how to implement the feedback from the motor into Arduino. The code is as below:
void analogWrite25k(int value)
{
OCR4C = value;
}
void setup()
{
TCCR4A = 0;
TCCR4B = 0;
TCNT4 = 0;
// Mode 10: phase correct PWM with ICR4 as Top (= F_CPU/2/25000)
// OC4C as Non-Inverted PWM output
ICR4 = (F_CPU/25000)/2;
OCR4C = ICR4/2; // default: about 50:50
TCCR4A = _BV(COM4C1) | _BV(WGM41);
TCCR4B = _BV(WGM43) | _BV(CS40);
Serial.begin(115200);
// Set the PWM pin as output.
pinMode( 8, OUTPUT);
}
void loop()
{
int w = Serial.parseInt();
if (w>0) {
analogWrite25k(w);
Serial.println(w);
}
}
Perhaps there is a better approach so I was hoping there may be a ready made controller or something that may be easier to implement other than trying to learn Arduino code. I have spent hours on the net trying to see if someone has something that will work but to no avail…
Thanks again for your help with this. Really am hoping to be able to nut this one out!
Could you be more specific with what didn’t work out the way you intended?
I took a quick look at the code you shared and seems to me what that does is changing the frequency, not the duty cycle. If you carefully read the blog I shared you’ll see that changing the frequency doesn’t change the speed of the motor (which I think is what you were trying to achieve, but correct me if I’m wrong). This is good for you application because:
This summarizes the effect of different PWM frequency:
Low PWM Frequency:
Motor is Jerky
Lower motor efficiency
Noisy if within human audible range
Lower MOSFET switching loss
Cheaper components
Higher PWM Frequency:
Motor is Smooth
Higher motor efficiency
Quiet (>16kHz)
Higher MOSFET switching loss
Components cost is higher
But if you need to adjust the speed you have to change the duty cycle.
Now, about the feedback. Keep in mind that the “encoder” the motor has is actually a single channel pulse generator, so you can get RPM feedback from it but not position.
According to the motor’s datasheet there are 6 pulses per cycle (I’m guessing this is before the geardown, but I could be wrong). Either way, to get info from that you would have to see how many pulses are per shaft revolution (maybe 6, maybe 6*721) then you can calculate the speed.
This might seem a little complicated but it would be the same thing if you use a motor controller, because as the motor already includes one you would essentially use the additional driver the same way as you are using the Arduino now. The good thing is that I found a code that could really help you out.