Go Down

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

barneycoles

Hi there

I'm about a year into learning Arduino programming and am pretty chuffed I have got this far.....

I am developing a power feed system for my small milling machine. This is not CNC but a system that gives me three modes for manual milling only.

The system comprises of two DC motors and a dual H-Bridge driver controlling the X and Y axis only.

The three modes are......

1)  Joystick Mode  ( for fun really but it does help shunt the bed around very quickly )
2)  Incremental Mode  ( allows me to nudge the bed accurately onto a dial test indicator or position )
3)  Power Feed Mode  ( this allows me to cut continuously until commanded stop, limit switch or bad stuff )

I have been developing it for a while all test mounted on a piece of wood with some small test DC motors and have managed to debug a fair few problem/learning issues.  For example stopping the motors from going full power momentarily on power up.......

In all honesty I have basically copied bits from other peoples code and have got away with not fully understanding it but somehow making it work.

The problem now is the system needs a feedback loop to maintain constant speed due to the fact that the load can vary when actually cutting metal. For example I have to wind up the PWM as the tool hits the metal and then back it off before it exits at the end of the cut otherwise she bursts out like a scalded cat. This is all pretty obvious now in hind sight.

I have added a 400 PPR encoder to each axis and have got the PID library in the code and it seems to behave to a point. I am again pretty chuffed to get this far......

I can't for the life of me get the encoder to read the right speed. This section of the code was stolen from the forum but I don't fully understand it.  I have played blindly with the values but can't solve it.

I'm pretty sure there is plenty of scope for simplify this whole code over time as I learn more. I'm really looking forward to playing with the PIDs too as I have enjoyed setting them up on my Quadcopters.

I hope this makes some kind of sense and if you can help me get over this little hurdle that would be great...!

Thanks for looking at this.

Sorry if I'm approaching this wrong. I am a bit fresh.

Cheers

Barn









Robin2

#1
Dec 09, 2018, 09:54 pm Last Edit: Dec 09, 2018, 09:55 pm by Robin2
How far does the tool advance for one rotation of the motor?

Is the encoder connected to the motor shaft or to some slower-running shaft?

What speed (roughly) does the motor operate at (RPM or RPS)?

If you use a suitably sized stepper motor you don't have to worry about the load varying as the motor will provide full torque all the time.

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

barneycoles

Wow....... super fast response.

The DC motors are geared down twice through timing belts. It has tons of power.

The encoders are coupled to the intermediate pulley and are indicating 1650 RPM with my RPM laser ray gun at full 255 PWM.

I have and love DC motors and want to learn Feedback, Servo and PID contol.

I know I could buy a stepper kit and be done but I like the hard way. 

Thanks


Robin2

I never doubted that your DC motor has enough power.

At 1650 RPM = 27.5 RPS  and with 400 PPR then there will be 11000 pulses per second or one every 91 microsecs. That does not leave a lot of time for the Arduino to do other stuff.

Am I correct to assume that " geared down twice" means the motor is running at 3300 RPM or 55 RPS.

My guess is that something on the motor shaft that produces one or two pulses per rev of the motor would be quite sufficient for speed control. And it would greatly reduce the computation load on the Arduino.

And you did not say how far the tool advances for one turn of the motor.

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

jackrae

You're going to have extreme difficulty getting a DC motor to increment with precision. 

Even with some form of position sensor, the stopping time of the motor will depend upon drive voltage (PWM duty) (ie motor speed) and mechanical load so your control system would need to monitor electrical PWM duty (speed), electrical load (for mechanical load) and position.  If the load is high the stopping time will be short and hence the position sensor input might relate closely to where you actually want to stop.  With a light load the motor will tend to 'run on' and hence the position sensor input will have to give an 'early' command so the run on can be compensated for.

If you want consistent increments then you need an incrementing motor (stepper motor)

Robin2

You're going to have extreme difficulty getting a DC motor to increment with precision. 
I may well be mistaken but I don't think the OP is concerned with precise positioning. The impression I have is that he just wants an automated system to save him the trouble of moving the tool-feed by twiddling the handle.

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

MarkT

#6
Dec 10, 2018, 07:24 pm Last Edit: Dec 10, 2018, 07:25 pm by MarkT
Feeds are pretty slow in a mill, this is a position control system, not a speed control system.

The target position changes with time, but that's immaterial, I think you need a position control loop,
driving a current control loop perhaps - this allows the current control loop to abort the feed operation
if the current exceeds a threshold, which will protect the leadscrew system from damage.

The position control loop can implement soft limits of course, which a speed control loop couldn't
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

barneycoles

I never doubted that your DC motor has enough power.

At 1650 RPM = 27.5 RPS  and with 400 PPR then there will be 11000 pulses per second or one every 91 microsecs. That does not leave a lot of time for the Arduino to do other stuff.

Am I correct to assume that " geared down twice" means the motor is running at 3300 RPM or 55 RPS.

My guess is that something on the motor shaft that produces one or two pulses per rev of the motor would be quite sufficient for speed control. And it would greatly reduce the computation load on the Arduino.

And you did not say how far the tool advances for one turn of the motor.

...R
Apologies.  I think I was just showing off about the power and just needed to tell someone.

I haven't had time to get out to the shed and fire my RPM gun around today. I think I need to do some more of this.

Put like that 400PPR sounds way too excessive for what I'm trying to do. I can see how this could jam up the Arduino. I was given one encoder so I blindly bought another matching as they were super cheap.

The pulleys are I think 14T to 60T twice. Sorry for the vagueness. I'm not even home yet tonight.....

Sorry for not answering your first Q. I'll get my clock out and get back to you feed/MotorRev   :-)

Tons to go on now for.....!

Many thanks.

barneycoles

You're going to have extreme difficulty getting a DC motor to increment with precision. 

Even with some form of position sensor, the stopping time of the motor will depend upon drive voltage (PWM duty) (ie motor speed) and mechanical load so your control system would need to monitor electrical PWM duty (speed), electrical load (for mechanical load) and position.  If the load is high the stopping time will be short and hence the position sensor input might relate closely to where you actually want to stop.  With a light load the motor will tend to 'run on' and hence the position sensor input will have to give an 'early' command so the run on can be compensated for.

If you want consistent increments then you need an incrementing motor (stepper motor)
Hi there

This is not a precision system.  R is correct. I don't want to have to stand there turning handles at home on this mill. I want to learn feedback, servo, PID loop gently.

The incremental mode of this system works really well as you can nudge onto a DTI quite aggressively then wind down the PWM to nothing as you reach your target visually. I actually like over the many CNC controls I'm very used to (Fanuc, Heidenhain, Siemens etc).

FYI I'm a 5 axis CNC programmer and machinist by trade mostly working on experimental turbine blades and blisks.

I have another mill that I will add CNC in time possibly 5 axis. I've no doubt I will create plenty of probs here. Rotary backlash is an itch I want to scratch soon......

Cheers

barneycoles

Feeds are pretty slow in a mill, this is a position control system, not a speed control system.

The target position changes with time, but that's immaterial, I think you need a position control loop,
driving a current control loop perhaps - this allows the current control loop to abort the feed operation
if the current exceeds a threshold, which will protect the leadscrew system from damage.

The position control loop can implement soft limits of course, which a speed control loop couldn't
Hi there

This is a pure PowerFeed system with nudge capabilities and a joystick for fun.  Not a serious CNC with nano meters of accuracy. All I need/want is constant speed here.

Standard ACME threads and crappy limit switches off my 3d printer are working great.  To be honest I want to strip the the lead screws and probably will. The mill is crud and good for not very much but learning. She might see ball screws one day but the ways need scraping way before I throw down any real money.

5X CNC next though    :-)

Cheers


MarkT

#10
Dec 11, 2018, 12:30 pm Last Edit: Dec 11, 2018, 12:31 pm by MarkT
Suit yourself, it may not work very well though, snatching and jumping in speed with sudden load changes.

The main function of the control loop is to compensate for load changes (I'm assuming large forces in
either direction can happen).  Position control is eminently suited to do this, simple speed control is not.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

barneycoles

Suit yourself, it may not work very well though, snatching and jumping in speed with sudden load changes.

The main function of the control loop is to compensate for load changes (I'm assuming large forces in
either direction can happen).  Position control is eminently suited to do this, simple speed control is not.
You maybe be right about the jumping and snatching. Milling is an extremely dynamic process.

I'm very curios to find out what I can achieve personally and the limits of what the loop can give me in the setup.

If I pull the trigger on ball screws I will most likely go down the positional control as you advise.

Cheers


MarkT

I strongly recommend thinking about a position feedback loop using a PID.  The control input can
be made to continually change for low speed control with strong holding power.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

barneycoles

I never doubted that your DC motor has enough power.

At 1650 RPM = 27.5 RPS  and with 400 PPR then there will be 11000 pulses per second or one every 91 microsecs. That does not leave a lot of time for the Arduino to do other stuff.

Am I correct to assume that " geared down twice" means the motor is running at 3300 RPM or 55 RPS.

My guess is that something on the motor shaft that produces one or two pulses per rev of the motor would be quite sufficient for speed control. And it would greatly reduce the computation load on the Arduino.

And you did not say how far the tool advances for one turn of the motor.

...R
The bed advances by 175 micron/rev of the motor.

I have got some optical switches to try out. How many pulses would you recommend for measuring 1650 rpm?

Cheers

Robin2

I have got some optical switches to try out. How many pulses would you recommend for measuring 1650 rpm?
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
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up