Author Topic: CNC Crankshaft Machining  (Read 8890 times)

Online Vixen

  • Full Member
  • *****
  • Posts: 3076
  • Hampshire UK
CNC Crankshaft Machining
« on: August 28, 2019, 06:29:41 PM »
It's always a good idea to use the mill for roughing out the crankshaft as lots of metal has to be removed.

Before he passed away, John Stevens, gave me this copy of a CNC program for "turning" a crank journal completely on a 4 axis CNC mill. I know this probably belongs in Jason's "dark side" topic but I have placed it here as it seems more relevant. And NO, I have not tried it myself.......yet.

The program consists of two mathematical formulae that work together, one for Y and one for Z, then repeat every pass until the required journal diameter is reached.

In operation X once set doesn't move, Y goes in and out at the same time that Z moves up and down so the centre of the cutter is always over the centre of the journal.

Here is John's original code:- parameter #1 specifies the bar stock diameter, #2 specifies the PCD (throw)of the journal and #3 the journal diameter

#1=[30] ;BAR
#2=[15] ;PCD
#3=[10] ;PIN
#4=[18] ;Passes
#5=[0] ;A
#6=[1] ;Pass


G0 G21 G49 G40.1 G17 G64 G80 G50 G90 G98
M6 T1
M03 S4000
G43 Z10.0
G00 A0.0 Y0.0 X5
M98 P003 Q#4
A0.00
M5 M9
M30
%
O003
#5=[0]
G00 Z2.0
G00 A#5
G01 Y[[#2/2]*SIN[#5]] Z[[[#1/2]-[#2/2*COS[#5]+#3/2]]*[#6/#4]*-1]
M98 P004 Q358
#6=[#6+1]
G00 Z2.0
M99

O004
#5=[#5+1]
G01 A#5 Y[[#2/2]*SIN[#5]] Z[[[#1/2]-[#2/2*COS[#5]+#3/2]]*[#6/#4]*-1]
M99
« Last Edit: August 28, 2019, 06:52:52 PM by Vixen »
It is the journey that matters, not the destination

Sometimes, it can be a long and winding road

Offline Stuart

  • Full Member
  • ****
  • Posts: 1785
  • Tilchestune UK
Re: CNC Crankshaft Machining
« Reply #1 on: August 28, 2019, 07:02:44 PM »
That look a bit tricky subroutine calling a subroutine , sounds a bit recursive

I think I read that this was done for a exhibition to show off a cnc mill for arc euro ( who now do not sell cnc mill ) and was written by Johns son


It’s very interesting just goes to show that hand raised gcode it more efficient than that done by cam software

If you done mind I will run it on my demo machine ( computer only no mech bits attached )

Stuart
My aim is for a accurate part with a good finish

Online Vixen

  • Full Member
  • *****
  • Posts: 3076
  • Hampshire UK
Re: CNC Crankshaft Machining
« Reply #2 on: August 28, 2019, 07:20:08 PM »
Hi Stuart,

Give it a run and report back. As I said, I have not tried it myself.

Basically the y and z axes moves are coordinated and follow a sine and cosine linear relationship. The stock bar rotates about it's axis and the throw is machined eccentrically. After each pass (rotation) the depth of cut is incremented until the final pin diameter is reached. This is ideal work for a big mill just as Jo did.

However clever, this is still only roughing out, I expect the journals will still need to be finished in the traditional way on the lathe.

Mike
« Last Edit: August 28, 2019, 08:43:00 PM by Vixen »
It is the journey that matters, not the destination

Sometimes, it can be a long and winding road

Online Vixen

  • Full Member
  • *****
  • Posts: 3076
  • Hampshire UK
Re: CNC Crankshaft Machining
« Reply #3 on: August 28, 2019, 09:57:42 PM »
I have just been outside to test the John Stephens code on my LinuxCNC setup. It does not run.

LinuxCNC has a problem with the M98 subroutine call. LinuxCNC does not use M98 for subroutines, it does it a different way.

So I declare the John Stephens code to be a bit of a "red herring".

 :embarassed: :embarassed: :embarassed:

Mike
« Last Edit: August 29, 2019, 07:56:28 AM by Jo »
It is the journey that matters, not the destination

Sometimes, it can be a long and winding road

Offline kvom

  • Full Member
  • *****
  • Posts: 2649
Re: CNC Crankshaft Machining
« Reply #4 on: August 28, 2019, 10:43:18 PM »
My machine also runs a version of LinuxCNC, and I modified the code to use the LinuxCNC calling conventions.  I was getting a divide by 0 error code on program load, but could single step into O003, but then I got a jump back to the beginning of the main program.  After I shut my machine down I added a couple of extra [] pairs that looked like they might be needed.  Code is posted below if you want to try it.

Note that it assume metric values, so for an inch crankshaft the values would need to be inchese and G21 changed to G20.

#1=[30] ;BAR
#2=[15] ;PCD
#3=[10] ;PIN
#4=[18] ;Passes
#5=[0] ;A
#6=[1] ;Pass

O004 sub
#5=[#5+1]
G01 A[#5] Y[[#2/2]*SIN[#5]] Z[[[#1/2]-[[#2/2]*COS[#5]+[#3/2]]]*[#6/#4]*-1]
O004 endsub

O003 sub
#5=[0]
G00 Z2.0
G00 A[#5]
G01 Y[[#2/2]*SIN[#5]] Z[[[#1/2]-[[#2/2]*COS[#5]+[#3/2]]]*[#6/#4]*-1]
O104 repeat [358]
O004 call
O104 endrepeat
#6=[#6+1]
G00 Z2.0
O003 endsub

G0 G21 G49 G40 G17 G64 G80 G90 G98
M6 T1
M03 S4000
G43 Z10.0
G00 A0.0 Y0.0 X5
O103 repeat [#4]
O003 call
O103 endrepeat
A0.00
M5 M9
M30


Offline gadabout

  • Full Member
  • ****
  • Posts: 234
Re: CNC Crankshaft Machining
« Reply #5 on: August 29, 2019, 01:21:40 AM »
Mike, could you post it somewhere else then? I would like to try it on my mach3 machine!
thanks
Mark

Offline Jasonb

  • Full Member
  • *****
  • Posts: 9467
  • Surrey, UK
Re: CNC Crankshaft Machining
« Reply #6 on: August 29, 2019, 07:12:05 AM »
Could be it runs on the Sieg version of Mack3 rather than Linux

At teh time I doubt John had a suitable CAM package and even if he did probably would not have been able to draw the cam in 3D CAD, I used to draw up stuff for him that he wanted to 3D print.

Offline gadabout

  • Full Member
  • ****
  • Posts: 234
Re: CNC Crankshaft Machining
« Reply #7 on: August 29, 2019, 09:16:15 AM »
I just ran the program on my mill with mach3 and it seems to run fine , was just air cutting. Let it run for 14 minutes and then estopped it as it was dinner time. Wonder how long it runs for? Or meant to run for?
Cheers
Mark

Offline Stuart

  • Full Member
  • ****
  • Posts: 1785
  • Tilchestune UK
Re: CNC Crankshaft Machining
« Reply #8 on: August 29, 2019, 09:35:29 AM »
That confirms my thoughts that Johns son wrote it for Mach3

My mach4 him no likey and sicks up on the first line


Any way I have the code saved and will give it a good looking at

Stuart
My aim is for a accurate part with a good finish

Offline Jasonb

  • Full Member
  • *****
  • Posts: 9467
  • Surrey, UK
Re: CNC Crankshaft Machining
« Reply #9 on: August 29, 2019, 10:11:22 AM »
John S posted about it on ME forum, read it and see the pics here also does cams

Online Vixen

  • Full Member
  • *****
  • Posts: 3076
  • Hampshire UK
Re: CNC Crankshaft Machining
« Reply #10 on: August 29, 2019, 11:24:02 AM »
My machine also runs a version of LinuxCNC, and I modified the code to use the LinuxCNC calling conventions.  I was getting a divide by 0 error code on program load, but could single step into O003, but then I got a jump back to the beginning of the main program.  After I shut my machine down I added a couple of extra [] pairs that looked like they might be needed.  Code is posted below if you want to try it.


I attempted to run your LinuxCNC modified code on my LinuxCNC ver 2.7 machine. I am also getting a divide by 0 error message when it attempts to enter the O003 subroutine. I don't understand enough to mess with " adding a couple of extra [] pairs that looked like they might be needed."     Can you advise please.

Is your machine a Tormach? which uses a derived variation of LinuxCNC

Mike   :killcomputer:
It is the journey that matters, not the destination

Sometimes, it can be a long and winding road

Offline Stuart

  • Full Member
  • ****
  • Posts: 1785
  • Tilchestune UK
Re: CNC Crankshaft Machining
« Reply #11 on: August 29, 2019, 11:40:46 AM »
given it a seen to for mach4

it did not like the var refs put in () to comment out the descriptions

removed the Q xxx from the sub call ins now

Caveat emptor I have NOT run it for real with a tool in place


#1=[30] (BAR)
#2=[15] (;PCD)
#3=[10] (;PIN)
#4=[18] (;Passes)
#5=[0] (;A)
#6=[1] (;Pass)


G0 G21 G49 G40.1 G17 G64 G80 G50 G90 G98
M6 T1
M03 S4000
G43 Z10.0
G00 A0.0 Y0.0 X5
M98 P003
A0.00
M5 M9
M30
%
O003
#5=[0]
G00 Z2.0
G00 A#5
G01 Y[[#2/2]*SIN[#5]] Z[[[#1/2]-[#2/2*COS[#5]+#3/2]]*[#6/#4]*-1]
M98 P004
#6=[#6+1]
G00 Z2.0
M99

O004
#5=[#5+1]
G01 A#5 Y[[#2/2]*SIN[#5]] Z[[[#1/2]-[#2/2*COS[#5]+#3/2]]*[#6/#4]*-1]
M99


Stuart
« Last Edit: August 29, 2019, 12:07:43 PM by Stuart »
My aim is for a accurate part with a good finish

Online Vixen

  • Full Member
  • *****
  • Posts: 3076
  • Hampshire UK
Re: CNC Crankshaft Machining
« Reply #12 on: August 29, 2019, 12:21:19 PM »
I thought the Q358 in subroutine O003 was there to get it to index the A axis through 360 degrees.

Mike
It is the journey that matters, not the destination

Sometimes, it can be a long and winding road

Offline Stuart

  • Full Member
  • ****
  • Posts: 1785
  • Tilchestune UK
Re: CNC Crankshaft Machining
« Reply #13 on: August 29, 2019, 12:30:31 PM »
It need a lot more testing but with the Q in place it throws sub not found error

Q is a parameter used in pec drilling and others

I think in this case it was tiring to pass the var


All I can say at this time is with the Q in place it won’t run


a past 360 is a config parameter in the control as roll over

Stuart
My aim is for a accurate part with a good finish

Offline kvom

  • Full Member
  • *****
  • Posts: 2649
Re: CNC Crankshaft Machining
« Reply #14 on: August 29, 2019, 01:11:48 PM »
My machine is not a Tormach but is running Tormach's PathPilot version.

I noticed there is no F word, so feed rate must be set elsewhere.

 

SimplePortal 2.3.5 © 2008-2012, SimplePortal