Close

My LinuxCNC History

A project log for My LinuxCNC Journey

This will be a summary of my LinuxCNC experiences and a hub for keeping the related projects organised.

greg-duckworthGreg Duckworth 04/09/2020 at 21:230 Comments

At the time of writing, I have been using LinuxCNC to control my lathe for >5 years.  It is amazing what can be achieved with some old PC hardware and some well-written, if confusing, software.  This is an overview of my early experiences.

I was able to purchase a non-working Denford Orac from a friend who no longer had the time or space to continue its conversion to a modern control.  The electronics from the Orac were designed in the early 1980's so it was definitely a learning experience to go from my previous Arduino projects to the Denford.

I was fortunate, the lathe had been partially converted (insofar as the stepper drivers were present) and the original stepper power supply and the original variable frequency drive electronics both worked.  I have done a degree in physics so I have a small amount of experience with electronics but very little experience with electrics so this was a steep learning curve.  

The PC that I scrounged to control the lathe was only a simple dual core Pentium D but this turned out to be more than sufficient for my needs.  One cheap parallel breakout board from eBay later, and I had a simple Axis interface (one of LinuxCNC's GUI options) that could output the necessary signals to move the lathe throughout its range of motion, although I hadn't managed to get the homing switches or the VFD to be controlled automatically yet. 

Installing LinuxCNC was relatively painless:

  1. Download ISO. 
  2. Use live USB to install said ISO 
  3. Use Stepconf to generate the basic configuration. 

A little victory.  This setup procedure did not expose me to any HAL files or anything more advanced than simple pin assignment, and sure, I had to turn the spindle on before I ran the gcode,  but I had a lathe, and it could make shapes that I could not do by hand!

Threading was complicated. I read more than a few tutorials, and used an old Post Office oscilloscope to trace the encoder signals that came from the spindle.  The encoder index not a short pulse, once per revolution, but rather a 50% duty cycle square wave whose period corresponded to a complete revolution of the spindle.  The original encoders index was actually represented by the rising edge of the square wave but LinuxCNC would sometimes trigger at the falling edge as well as the rising edge.  This meant that at random times, the lathe would begin the threading pass 180 deg out of phase with the last threading pass, resulting in a weird, 2-start, unequal depth thread.  Great.  

The solution was to initially avoid threading. :/ But then I found the cheap inductive sensors on eBay that are used for homing switches or bed probes on 3D printers.  Awesome.  One inexpertly made bracket later, voila, I had a proper index pulse! 

Then the spindle drive electronics blew up.  Sadly it wasn't even that spectacular, they just sort of whined and stopped working.  Bugger.  After many hours searching the internet for a idiot-friendly VFD, a Bosch EFC 3610 was purchased.  This VFD was chosen specifically because it had very obvious STOP and GO buttons, as well as a potentiometer, right there on the front panel.  It also mentioned something in the (extremely comprehensive) manual about Modbus and communication with the VFD.  Cool.  I made a mental note to find out what the hell Modbus was and got right to ripping out the old electronics and installing the shiny new VFD.

Just a note for those who may be interested:  The little front control panel is removable and an panel mount extension is available for under £30.  This is SO useful.  The ability to see the status of the drive, to mess with parameters and to use the same panel to control the VFD is extremely useful.

In all the challenges I faced along the way, I bodged and hacked LinuxCNC until it would work well enough™.  The code I wrote was ugly, some functionality was left out entirely, LinuxCNC was not updated despite me relying on a pre-release version for almost 5 years.  And don't even get me started on the HAL module I bodged to get a joystick to work.

So now its time to atone.  I am not quite starting again from scratch, I am going to reuse much of the hardware and the knowledge I have acquired along the way to properly implement LinuxCNC on the lathe.  I want a machine that doesn't need a USB joystick plugged in at all times to stop HAL raising an error.  I want to be able to control the VFD from the PC and I am going to tell you all how to do it, and release the code along the way.  I might even learn something.

Discussions