Go Down

Topic: Milling Machine Power Feed Project (Read 660 times) previous topic - next topic

barneycoles

That really depends on how quickly the motor can accelerate or decelerate when the load changes. For example if it takes a few revolutions to slow down (because of momentum in the system) then one pulse per revolution should be sufficient.

On the other hand if it can go from regular speed to a complete stop in a quarter revolution you will need maybe 16 or 32 pulses per revolution (maybe more) so that the Arduino can adjust the motor power quickly enough to prevent a stall.

Of course the other side of this is how quickly the motor can respond to more or less power. If the load can stop the motor in a quarter turn but the motor takes the time for a half-turn to respond then it probably does not matter how many pulses you have, it won't work.

As I think about this the attractions of a stepper motor shine out very brightly :)

...R
Great stuff....!

Thanks R.

Time to fire up the printer and make some indexing discs.

I think a higher number of pulses would be best. I can see very little coasting from full chat to stop. I have sprung mounted the limit switches in anticipation of this but it seems this was not necessary so far.

In the name of science and learning I'm stubbornly not throwing in the towel to the stepper yet but you are right.

The whole thing is screaming STEPPER MOTOR.......job done. 


barneycoles

#16
Dec 16, 2018, 01:27 pm Last Edit: Dec 16, 2018, 01:53 pm by barneycoles Reason: attempting to add image and updated code
That really depends on how quickly the motor can accelerate or decelerate when the load changes. For example if it takes a few revolutions to slow down (because of momentum in the system) then one pulse per revolution should be sufficient.

On the other hand if it can go from regular speed to a complete stop in a quarter revolution you will need maybe 16 or 32 pulses per revolution (maybe more) so that the Arduino can adjust the motor power quickly enough to prevent a stall.

Of course the other side of this is how quickly the motor can respond to more or less power. If the load can stop the motor in a quarter turn but the motor takes the time for a half-turn to respond then it probably does not matter how many pulses you have, it won't work.

As I think about this the attractions of a stepper motor shine out very brightly :)

...R
So I have the optical switch mounted and a 25 PPR disc as per stolen RPM code and it all seems to be picking up nicely.

I'm still getting about 40% error compared with the indicated RPM from my RPM gun. I'm pretty confident that the RPM gun is accurate as the serial monitor is indicating over 4000 RPM at full chat.  I think if my belts were going over 4 grand I'd know it and would probably stand back a bit further.

The code I stole was from here  https://forum.arduino.cc/index.php?topic=417233.0

This code gives direction too but I don't need that and have only hooked up a single interrupt for each axis (X and Y).

I think I am missing something fundamental here?

Also the error between my requiredSpeed (setPoint) is always around 85% out.

I have two problems here. I'm hoping the error in the RPM sensing system will help solve the massive error in the PID loop?

Cheers

B


Robin2

The code in this link is simpler. It simply measures the time between pulses.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

barneycoles

The code in this link is simpler. It simply measures the time between pulses.

...R
Ok. Looks like I'm going to have to take step back and get reliable RPM.

I'm building a new test rig to code this in in my warm home office. I don't fully understand some of it though but I will plod away at it so thanks for that.


Any ideas as to why my current arrangement and code is so far out?

I have now tried a 25 PPR disc, a 1 PPR disc and a 2 PPR. Nothing I do gives me anywhere near the RPM indicated by the RPM gun.

1600 RPM is indicating over 4000 in the serial monitor. 60% error.

I notice you are using micros not millis. Am I trying to get the Arduino to do too much in not enough time? Surely 1 PPR at 1600 RPM and PID calc is manageable

Should I perhaps detachInterrupt during calculation? I noticed this in someone else's RPM code?

Cheers

B



Robin2

Surely 1 PPR at 1600 RPM and PID calc is manageable
My motor control works fine at 16,000 RPM with a PID update once per revolution. And it receives wireless data to tell it the chosen speed. However I think my PID calculations are significantly faster than the Arduino PID library as I don't use floating point maths. Otherwise my calculations are the same.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up