Home designed and built 5C CNC lathe with ATC and C_Axis
- NoJo
- Offline
- Elite Member
- Posts: 180
- Thank you received: 42
I have built a number of CNC routers, engravers, converted some EMCO FB-2 Mini-Mills to CNC, all using MACH3, all working very nicely.
I have had a many year hankering to build a 'small' hi-speed lathe , with ATC, limited liver tooling and C_axis, and so last year the project started. The main lathe is complete, with ATC and Live Milling spindle still under design!
The lathe ( excluding cabinet, etc) weighs in at 67kg, so ended up not so 'small' !
X and Z are driven by ClearPath closed loop brushless drives. The main Spindle is a 2KW ClearPath brushless drive as well, with 0.0225degree angular position accuracy.
25mm slides on Z and 20mm on X.
I/O cards are MESA 7i92:7i76:7i73.
The lathe was first developed on CAD - a full 3D model, and then machining drawings made and the lathe made from them.
The lahe bed was machined on a 1954 ALBA Shaper, one I re-built and fitted with NC controls...
Some photo's show what happened...
However...
I am totally lost when it comes to setting up the HAL file! pncconf has done all it can - In Hal_show I can see all my hardware pins toggling as I activate limit switches, push buttons, etc. I see all the encoders counting as well. But I am at a loss as to where to start in the definition of all the HAL setups - I am totally new to this, and am finding it very difficult to develop a working understanding of how all the hardware pins and I/O get connected to the software functions, how signals need to be allocated, how encoders signals get connected to where they must go ( each axis , obviously, but how...?) . I have dug through dozens of posts - esp rodw posts on his plasma cutter, wrt the 7i73 and jog wheels - he keeps telling many other posters to look at his examples on the HAL and all with be revealed... Well...Rod you over-estimate my smarts! I am none the wiser. It is more a case of not seeing the wood for the trees - I need a HAL file framework for the basics of my setup, and then I can hopefully sit and kludge my way through it and (hopefully..) find the Eureka moment! The syntax is quite foreign - I understand C very well, but the syntax in HAL has so many dots and dashes and directions and signals being used over for different things - its very strange...
I have read many times the HAL manual, the L_CNC getting started pages, and I think every single post on the linuxCNC forum that has the text '7i73' embedded! I was just trying to get an axis to jog with a jog wheel - a simple start, I thought...
I need some TLC from a Master !
Thanks!
Joe
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
- Posts: 395
- Thank you received: 80
Well that looks like a very nicely done job so far, and LCNC would be the perfect control IMHO.
I'm sure you will get lots of help front this forum but it would help if you ask more specific questions.
For a start...can you jog the x and z axis from the keyboard or GUI?
Which GUI are you using?
I understand your frustration....my first linuxcnc experience took me 3 days to figure out how to start the spindle and how to get it to run the correct speed....
But your Eureka moment will come and you'll see that Hal makes perfect sense and is quite simple to configure.
I'm in Johannesburg.
Henk
Please Log in or Create an account to join the conversation.
- arvidb
- Offline
- Platinum Member
- Posts: 512
- Thank you received: 158
I think a key to understanding HAL is the realisation that there is at least one "special" HAL component:
MOTION - the MOTION component is the interface to linuxcnc's "brains": it produces signals that tells e.g. if your amps should be enabled or not (joint.N.amp-enable-out) and what position each joint should be in (joint.N.motor-pos-cmd); and it also has pins where you feed back actual position for each joint: joint.N.motor-pos-fb.
Then in addition you load in the components you need to get signals to/from your MESA cards.
Then "all" that's left is to hook everything together: you know which MESA output is connected to e.g. the spindle, so create a "net" between e.g. MOTION's spindle.M.speed-out and whatever MESA output you have hooked up to your spindle VFD, etc.
There are also HAL components for doing PID control, scaling of signals, etc., that you might (probably will) need to hook up inbetween the MOTION outputs and the MESA card HAL pins. Luckily pncconf does most of the heavy lifting there!
Please Log in or Create an account to join the conversation.
- NoJo
- Offline
- Elite Member
- Posts: 180
- Thank you received: 42
If I have it correct, the GUI is 'Axis' ? Plain GUI that comes up when I run L_CNC..
I have not got the gubbins connected to the machines motors yet - its all on the bench in the study for convenience, but I can jog the displayed axes via the GUI mouse buttons, but the axes do not jog via the operator controls ( Jog buttons or handwheels) although Hal show/watch shows jog encoders counters changing, etc.
I have not asked anything specific yet as I suppose my current knowledge precludes me from knowing what to ask! I will start asking, although I guess I must do so in the appropriate forum categories, not here in show and tell...
I just received an email which tells me I do believe you and I are going to be hearing more of each other...!
Greg Paxton in JHB is a good friend of mine, and he is a good friend of Rudy, whom Greg has introduced me to today (!) and in my email discussion with Rudy, to which he just replied he said ' We may have to involve an expert on that, namely Henk du Preez . (!) And here you are! - Rudy was referring to assistance wrt the ATC and C_Axis...
Rudy has asked for my machine operational description, MESA connections and HAL files, so I am going to tackle it with him and see how we go!
Thanks for the encouragement - I need it right now!
And nice to meet you..
Joe
Please Log in or Create an account to join the conversation.
- Becksvill
- Offline
- Elite Member
- Posts: 186
- Thank you received: 86
I'm not a master. One of those will chime in soon.
As a first step I recommend watching these videos.
Probably start here.
youtube.com/c/Theferalengineer
Ps if you get stuck just let us know and if no one else is available to help I'm happy to come on with teamviewer or something and show you some stuff. It's amazing how much faster you learn when someone is just there to help
Have fun
Regards
Andrew
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23310
- Thank you received: 4858
If PNCConf hasn't produced a working setup then something seems wrong.
Does _anything_ work?
A general point: Don't think of HAL as a programming language. It's a network definition. It is only parsed once, and is used to link the HAL component inputs and outputs together.
net signal1 out_pin_1 in_pin_1
net signal1 in_pin_6 in_pin5
net signal1 in_pin2
net signal1 in_pin_3 in_pin_4 in_pin_7
For example would create a signal called "signal1" this will have a numerical or true/false value. And every pin in that net will have the same numerical value. The value will be that provided by out_pin_1.
Note that you can only have one "out" or "writer" pin in any one net.
Also note that physical inputs are HAL outputs (they output a number to HAL) and vice-versa.
Please Log in or Create an account to join the conversation.
- NoJo
- Offline
- Elite Member
- Posts: 180
- Thank you received: 42
Andy, I believe the basic lathe 'works' - I have not connected the controller to the lathe in initial tests since I am not sure what will happen and I do not want to damage hardware - also the lathe is in the workshop while it is more convenient to work on this stuff in the electronics lab..
However, I have test switches etc set up to simulate the lathe, ie, limit switches, etc.
I also use an oscilloscope to monitor all stepgens and control signals.
Stepgens all generate step/dir signal, AXIS jog via AXIS UI and mouse works, etc.
NONE of my user control panel controls have any effect ( bar a few switches...)
The MESA cards are all functional, 7i73 LED flashes on/off green, all OK.
I ran pncconf with advanced mode enabled.
On the 7i73 :
I have 4 buttons for jogging X+, X-, Z+, Z-
So selected EXTERNAL BUTTON JOGGING
I have 4 Encoders, X Axis jog, Y Axis Jog, Spindle speed override, and the forth intended for the Live Tool ( milling spindle) speed override - that feature does not exist in lathe config in LinuxCNC, so ignore for now.
I also have a 4 position rotary switch to select jog movement step size.
So , in EXTERNAL MPG JOGGIING with SELECTABLE INCREMENTS
I set a,b,c and D values.
in EXTERNAL FEED OVERRIDE I selected USE MPG
in SPINDLE OVERIDE I selected USE MPG.
Then in the MESA Card Setup Page I selected I/O pins and allocated functions as per my system wiring.
Each axis has a separate HOME button, via 7i76 inputs 28,29,30
An E_STOP input on 7i76 input 27.
Limit switches on 7i76 inputs 16,17,18,19
There are a few more switches similarly wired - Spindle FWD, Spindle ON/OFF, etc ..
ALL of the above I/O shows intended functionality in HAL_Show - the brown/yellow indictor toggles with each switch toggle.
All Encoder counters count up/down correctly.
However, bar the Spindle Speed override encoder , Estop, spindle FWD,
NONE of the other controls have any effect in LinuxCNC. No jogging with manual buttons, or with jog wheels, etc
Spindle Speed override encoder DOES change the Spindle Speed % indicator
Spindle FWD turns on spindle ( but does not turn spindle off when deselected..)
Estop shows ESTOP when active.
No other controls work.
I do suspect that jog does not work because L_CNC is expecting some sort of Axis select input to indicate which axis to jog ( from my limited understanding of the HAL file), but I thought that was taken care of when I selected EXTERNAL MPG JOGGING...ie, no specific axis select needed?
I know the jog wheels work, Hal_Show sees them all, etc.
As I am green in HAL's language, and have a lot to learn, it is difficult to know what all the terms mean and how they link.
Unfortunately, Andy's post of :
A general point: Don't think of HAL as a programming language. It's a network definition. It is only parsed once, and is used to link the HAL component inputs and outputs together.
net signal1 out_pin_1 in_pin_1
net signal1 in_pin_6 in_pin5
net signal1 in_pin2
net signal1 in_pin_3 in_pin_4 in_pin_7
Is still meaningless at this stage!!
There are some functions that I wish to implement that appear to not be catered for in pncconf -
Anything to do with a C_Axis, obviously...An external switch to turn on/off coolant, a switch to select FWD or REV for spindle
direction and an ON/OFF switch for spindle on/off, etc - I am not too concerned about all that now - that can worry me once I understand HAL better..and Components...
But something I thought to be 'simple' - jogging with encoders - certainly is not!
My lack of ability with HAL also makes it very confusing when viewing the HAL file trying to find only those elements that refer to, say, X Axis jogging - the
references to anything 'X Jog' are all over the place and not intuitive at all! So I am battling..
There are :
# --- JOG-X-POS ---
net jog-x-pos <= hm2_7i92.0.7i73.0.1.input-20
net jog-x-pos halui.axis.x.plus
net jog-selected-pos halui.axis.selected.plus
net jog-speed halui.axis.jog-speed
# ---jog button signals---
sets jog-speed 1.000000
net x-jog-count <= hm2_7i92.0.7i73.0.1.enc0.count
# ---mpg signals---
setp axis.x.jog-vel-mode 0
net x-jog-enable => axis.x.jog-enable
net x-jog-count => axis.x.jog-counts
net selected-jog-incr => axis.x.jog-scale
sets x-jog-enable true
# connect selectable mpg jog increments
net jog-incr-a => jogincr.sel0
net jog-incr-b => jogincr.sel1
net jog-incr-c => jogincr.sel2
net jog-incr-d => jogincr.sel3
net selected-jog-incr <= jogincr.out-f
And this poor fool is lost!
It would be so nice to have a simple HAL file with
JUST a single jog wheel driving the X axis, showing each HAL syntax line with explanation of allocation, what each line does, etc!
Not contaminated with all the other stuff - stepgens and PID's, etc..
I have attached HAL and ini files.
However, I need some guidance in forum etiquette here -
I don't think this thread is the place to be discussing HAL and integration issues since it is a show and tell thread - Should I move this elsewhere, or can a moderator do so?
Also, I am obtaining assistance in the process, via emails, from some boffins in South Africa ( our neighbour) , familiar to Henk who joined in earlier, and I don't want to tread on toes and double efforts put in by all those so willing to help me. I feel that any discourse could be useful to those in a similar situation to me, trying to learn, and so any resolution, idea or solution would be useful in posting regardless of source. I realise people may be annoyed when providing help while the recipient sneaks behind obtaining help elsewhere as well, and since its a small, connected world, such behaviour is soon known! So, please tell mw to buzz off if I am annoying you!
Regards
Joe
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
- Posts: 3958
- Thank you received: 1714
Note that if your machine is not homed then it has only 'joints' as 'axis' are only created after the joints are homed.
As for HAL there are basically two ways to go about defining a signal: I call it Singleline and Multiline:
Singleline:
signal <= out-pin => in-pin signal => in-pin
Multiline:
signal <= out-pin
signal => in-pin
signal => in-pin
Of course you can also mix the two.
Note
1) that 'signal' is an arbitrary name you chose but is has to be unique for every signal defined (kind of like a variable name)
2) that the '<=' and '=>' are used for the human reader only to make it clear from which OUT-pin the signal is coming and to which IN-pins the signal is going to.
3) a signal can only come from one single OUT-pin but can go to one or several IN-pins
How do we know which pins to use? For that you can use the HAL-show list on the left side of the window. This you seem to have found already.
Or there are 'Man-pages' in the documentation here is an example for the 'motion'-Pins:
linuxcnc.org/docs/html/man/man9/motion.9.html
This gives a description for all the pins available
I have not connected the controller to the lathe in initial tests since I am not sure what will happen and I do not want to damage hardware - also the lathe is in the workshop while it is more convenient to work on this stuff in the electronics lab..
While it is certainly possible to do it that way I personally would not recommend it. Simulating the inputs manually may seem easy enough but you may find it more difficult than you think particularly things like homing.
The usual procedure would be to hook everything up and then use HAL show to verify the inputs are wired correctly. Then test Estop and if that works get the motors set up and verify the distance and direction traveled corresponds to the commanded value. Then setup homing. Then the spindle and so on.
Attachments:
Please Log in or Create an account to join the conversation.
- NoJo
- Offline
- Elite Member
- Posts: 180
- Thank you received: 42
I think quite few of my future posts are going to sound like I am just whining...I don't mean to! Till that Eureka moment though, it's still Greek to me!
Note that if your machine is not homed then it has only 'joints' as 'axis' are only created after the joints are homed. Is something I still do not grasp.
I have read the HAL manuals ( a few times) and refer back very often but even the block diagrams confuse me!
At one end is the Computer running LinucCNC.
The other end is a Stepper motor.
Between there is a motion controller ( trajectory planner, etc), then a PID, then a stepGen, and then actual I/O pins ( Parr port, or MESA card- 7i76,- etc).
A jog wheel must somehow be read through physical pins, and then the axis position, which is manipulated by the stepper, must be updated and then via PID, Stepgen, to pins that drive the stepper controller ( Step/Dir) .
That is all very simple, easy to understand.
But where is a joint, an axis, and all those labels and names that are signals with directions, and then become actual pins...Whew...
I'll get there, but the first steps are horrid!
My failure to grasp even the basics of all that is a major part of the lack of progress - from what you say, nothing (jogging, etc) will work before the machine is homed - I find that very odd, but maybe that is also a lack of understanding how LinuxCNC works - Most CNC machines I have worked on can jog once powered and enabled, without homing anything, eg, on a mill I use, I can power on, jog to a position, zero DRO's and set that position as home, or machine zero, as I wish...But that is not the issue!
I will lug all downstairs to the lathe, connect all up, and try get it to do home and see what happens - but I still have a nagging feeling that in my HAL file, L_CNC wants the axis jog enabled for that axis first before jogging, and I have no way of doing that, aside from the fact that I think its not needed per my pncconf setup!
Thanks for the post, and I will carry on till it works!
Joe
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
- Posts: 3958
- Thank you received: 1714
Joints CAN be jogged before homing but the pins used are different i.e. joint vs axis. LinuxCNC does have vast capabilities but I believe it would be unwise to jump in at the deep end. The PNCconf has been added to provide an easy first setup to get a basic machine up and running otherwise things can get VERY frustrating. That is why I suggest to do that on the actual machine and then get more fancy once the basic setup works.
I will carry on till it works!
I expected no less!
[edit]
are your home switches located in the middle of your axis travel?
Or why do you have HOME, HOME_OFFSET, MIN_LMIT and MAX_LIMIT set like that?
Please Log in or Create an account to join the conversation.