- Configuring LinuxCNC
- Advanced Configuration
- EtherCAT
- Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
- PedPEx
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 28
29 May 2026 17:20 #346741
by PedPEx
Replied by PedPEx on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Hello guys,
Here is a little update. Since my last post, I had a detailed look at my picture gallery, specifically at the pictures of an EL5021 terminal I bought and disassembled back in early 2025. The original plan back then was to add an axial resistor in order to get it to read 11µA encoder signals. I quickly realized that wouldn't work, took some pictures, reassembled it, and returned it to the seller.
Last weekend, I took another detailed look at the PCB of the EL5021 and recognized the interpolator IC Beckhoff is using: an iC-Haus iC-NQI. For my own interpolator solution, I had actually copied the typical application circuit straight from that datasheet. That's why I immediately reordered an EL5021 terminal off eBay, opened it up, and properly reverse-engineered it today.
Beckhoff is actually following this required application circuit almost exactly ( Datasheet iC-NQI, Page 24, Figure 30 ). They are also using 4.7k Ohm resistors for RS1 and RS2. Those have to be swapped for 50k Ohm ones (I will test if these are too big; possibly 43k or 47k are better suited), and lastly the 120 Ohm resistors need to be removed. This way, the EL5021 terminal should be able to read 11µA sensors. By adding a 120 Ohm axial resistor across each input channel (A & /A, B & /B, and C & /C), the EL5021 can again be used for 1V signals. In theory, it would also support TTL signals, but that is outside the scope of this test.
Other than that, I vibe-coded a CiA402 dashboard tab for LinuxCNC to be able to see any problems with the Danfoss VFD directly in one place, without needing to decode the status word or the command word. The Danfoss VFD is now also able to read the frequency of an inductive sensor, internally calculates the motor speed, and reports that speed back via a PDO as feedback speed.
Additionally, the decision was made not to keep the original relay-based DC gearmotor solution, but to switch to two Beckhoff EL7332 terminals. Details about that coming soon™.
I'll test the functionality of the modified EL5021 terminal and keep you posted
Wishing you all a great weekend!
Here is a little update. Since my last post, I had a detailed look at my picture gallery, specifically at the pictures of an EL5021 terminal I bought and disassembled back in early 2025. The original plan back then was to add an axial resistor in order to get it to read 11µA encoder signals. I quickly realized that wouldn't work, took some pictures, reassembled it, and returned it to the seller.
Last weekend, I took another detailed look at the PCB of the EL5021 and recognized the interpolator IC Beckhoff is using: an iC-Haus iC-NQI. For my own interpolator solution, I had actually copied the typical application circuit straight from that datasheet. That's why I immediately reordered an EL5021 terminal off eBay, opened it up, and properly reverse-engineered it today.
Beckhoff is actually following this required application circuit almost exactly ( Datasheet iC-NQI, Page 24, Figure 30 ). They are also using 4.7k Ohm resistors for RS1 and RS2. Those have to be swapped for 50k Ohm ones (I will test if these are too big; possibly 43k or 47k are better suited), and lastly the 120 Ohm resistors need to be removed. This way, the EL5021 terminal should be able to read 11µA sensors. By adding a 120 Ohm axial resistor across each input channel (A & /A, B & /B, and C & /C), the EL5021 can again be used for 1V signals. In theory, it would also support TTL signals, but that is outside the scope of this test.
Other than that, I vibe-coded a CiA402 dashboard tab for LinuxCNC to be able to see any problems with the Danfoss VFD directly in one place, without needing to decode the status word or the command word. The Danfoss VFD is now also able to read the frequency of an inductive sensor, internally calculates the motor speed, and reports that speed back via a PDO as feedback speed.
Additionally, the decision was made not to keep the original relay-based DC gearmotor solution, but to switch to two Beckhoff EL7332 terminals. Details about that coming soon™.
I'll test the functionality of the modified EL5021 terminal and keep you posted
The following user(s) said Thank You: rodw, Surmetall
Please Log in or Create an account to join the conversation.
- vibram
- Offline
- Premium Member
-
Less
More
- Posts: 84
- Thank you received: 2
30 May 2026 14:26 #346769
by vibram
Replied by vibram on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Awesome work Patrick!
Regarding the spindle, here is my solution for a similar setup, the idea was to be able to keep the drilling operation possible. It works well
Regarding the spindle, here is my solution for a similar setup, the idea was to be able to keep the drilling operation possible. It works well
The following user(s) said Thank You: PedPEx
Please Log in or Create an account to join the conversation.
- PedPEx
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 28
30 May 2026 17:30 #346775
by PedPEx
Replied by PedPEx on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
I do actually like the way the spindle encoder is mounted. Unfortunately, I already sourced a SICK absolute multiturn SSI encoder ATM60-A4A 13x13 bit a long time ago and only paid 65 EUR for it - or I'm going to use my leftover Baumer OG73 S SN1024 1V_pp encoder, which I received as a gift a long time ago. In case neither implementation works out as it should, I'll have a detailed look at your encoder
(
AliExpress Link
)
Back to the modified EL5021 terminal: I couldn't believe that it was that easy to modify it and be able to read the encoders back. That's when - as any sane person would do xD - I got into the car, drove to my parents' house, and tested the modified terminal on the Maho CNC mill. What can I say, it's working like a charm, even on the first try :o So, yes, an EL5021 Beckhoff terminal can actually read 11µA_pp signals and you only have to modify 9 resistors in total. A rudimentary schematic is attached
I'm not able to measure the capacitance of the capacitors due to the installed resistors within the circuit, but their values shouldn't really matter (maybe an RC low-pass filter is no longer tuned as it should be, but that shouldn't cause problems here - I hope). I documented the very first test of the modified terminal and uploaded the video to YouTube.
I've also attached a screenshot of the CiA Danfoss VFD diagnostic tool for anyone interested
Back to the modified EL5021 terminal: I couldn't believe that it was that easy to modify it and be able to read the encoders back. That's when - as any sane person would do xD - I got into the car, drove to my parents' house, and tested the modified terminal on the Maho CNC mill. What can I say, it's working like a charm, even on the first try :o So, yes, an EL5021 Beckhoff terminal can actually read 11µA_pp signals and you only have to modify 9 resistors in total. A rudimentary schematic is attached
I've also attached a screenshot of the CiA Danfoss VFD diagnostic tool for anyone interested
The following user(s) said Thank You: RotarySMP, vibram, Surmetall
Please Log in or Create an account to join the conversation.
- Surmetall
-
- Away
- Senior Member
-
Less
More
- Posts: 54
- Thank you received: 37
30 May 2026 19:31 #346780
by Surmetall
Replied by Surmetall on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
how cool is that! great work! that opens a huge door for older Heidenhain scales to ethercat without the need of exe's. thank you very much!
The following user(s) said Thank You: PedPEx
Please Log in or Create an account to join the conversation.
- PedPEx
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 28
31 May 2026 14:52 #346804
by PedPEx
Replied by PedPEx on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Hello guys,
I did some further testing of the modified EL5021 terminal. As expected, when a 120-ohm resistor is added to each channel, it is indeed able to read 1V_pp sensors again. I confirmed this with a Baumer OG73 S SN1024 (SEW branded). So, it was time to get the EL5021 integrated into LinuxCNC. For this, I used my Claude subscription and pretty quickly got a working driver for the encoder input terminal. As far as I can tell, there are no bugs in the driver. Unlike the EL5101 and EP5101, the EL5021 doesn't have the option to reset its counter with every C pulse (at least with the revision that I have - HW: 08; SW: 05). I also found out that Beckhoff seems to have made a major revision change with the newer terminals. A lot of the documented Data Objects from the Beckhoff Information System are not implemented in my terminal.
The only thing left to do is to write a component that takes care of the Beckhoff Latch-C and Latch-C-valid signals and makes them as easy as possible to use for the standard homing procedure of LinuxCNC.
Wish you all a nice Sunday
I did some further testing of the modified EL5021 terminal. As expected, when a 120-ohm resistor is added to each channel, it is indeed able to read 1V_pp sensors again. I confirmed this with a Baumer OG73 S SN1024 (SEW branded). So, it was time to get the EL5021 integrated into LinuxCNC. For this, I used my Claude subscription and pretty quickly got a working driver for the encoder input terminal. As far as I can tell, there are no bugs in the driver. Unlike the EL5101 and EP5101, the EL5021 doesn't have the option to reset its counter with every C pulse (at least with the revision that I have - HW: 08; SW: 05). I also found out that Beckhoff seems to have made a major revision change with the newer terminals. A lot of the documented Data Objects from the Beckhoff Information System are not implemented in my terminal.
The only thing left to do is to write a component that takes care of the Beckhoff Latch-C and Latch-C-valid signals and makes them as easy as possible to use for the standard homing procedure of LinuxCNC.
Wish you all a nice Sunday
The following user(s) said Thank You: vibram
Please Log in or Create an account to join the conversation.
- PedPEx
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 28
13 Sep 2026 12:58 #349608
by PedPEx
Replied by PedPEx on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Hello 
After almost 4 months of no news, I am able to give you further details and insights on the retrofit. In the meantime, we received a new machine (KUKA KR15-2 KRC2) which required a little bit of maintenance, and we were in need of some maintenance too, in the form of holidays
. In the remaining time in between, all electronics of the control cabinet were removed (only the Indramat and the corresponding transformers have stayed) and the ancient components were replaced. Due to the new variable frequency drive, most of the original electronics weren't needed anymore. Therefore, a whole rebuild of the cabinet was the most logical thing to do.
By now, all components are wired in and the cabinet only needs a cleanup. We decided to build and wire all safety related components into EK1914 and EL1918 TwinSafe terminals. One of the EK1914 safety outputs drives a PILZ PNOZ s7 safety relais, which inturn cuts power to all "dangerous" output terminals. After the safety program is finished, all components of the mill can be tested. We did not test the communication between the TwinSafe PLC and LinuxCNC beforehand, so let's see how that will turn out
For now, the cabinet is mostly finished and just in need of a cleanup.We are also using the aforementioned modified EL5021 terminals for the X, Y, and Z glass scales. Due to their minimum interpolation setting of 10 bit (=1024), we are theoretically able to read each 20 µm glass scale down to a resolution of around 20 nm. We do not believe that we are actually that accurate by any means, but we are indeed able to register every single move of each axis. Even if it is just caused by a finger pressing slightly on an axis. In the hot summer months, we also saw the mill getting bigger/smaller due to thermal expansion.
Our very first implementation of a homing component dedicated to Beckhoff encoder inputs is also working, granted not 100% as expected. The bugs still need to be fixed. Our installed VFD also needs to be tested. It interlocks the contactor for the hydraulic system opening the tool changer and vice versa. An inductive sensor is also mounted on the fan side of the spindle motor, which sends 2 pulses for every revolution of the motor shaft. These pulses are counted by the VFD for a potential PID loop in the future. It is also equipped with a brake resistor, which should allow us to cut some serious threads with rigid tapping by using the original gearbox. Speaking of which, that also needs to be tested. It received its own 16 channel input card and two EL7332 motor driver terminals to drive all three motors.
There still needs to be some serious work done, but we are getting there
If you want further details, just let me know and i will send you some details as soon as possible
After almost 4 months of no news, I am able to give you further details and insights on the retrofit. In the meantime, we received a new machine (KUKA KR15-2 KRC2) which required a little bit of maintenance, and we were in need of some maintenance too, in the form of holidays
By now, all components are wired in and the cabinet only needs a cleanup. We decided to build and wire all safety related components into EK1914 and EL1918 TwinSafe terminals. One of the EK1914 safety outputs drives a PILZ PNOZ s7 safety relais, which inturn cuts power to all "dangerous" output terminals. After the safety program is finished, all components of the mill can be tested. We did not test the communication between the TwinSafe PLC and LinuxCNC beforehand, so let's see how that will turn out
Our very first implementation of a homing component dedicated to Beckhoff encoder inputs is also working, granted not 100% as expected. The bugs still need to be fixed. Our installed VFD also needs to be tested. It interlocks the contactor for the hydraulic system opening the tool changer and vice versa. An inductive sensor is also mounted on the fan side of the spindle motor, which sends 2 pulses for every revolution of the motor shaft. These pulses are counted by the VFD for a potential PID loop in the future. It is also equipped with a brake resistor, which should allow us to cut some serious threads with rigid tapping by using the original gearbox. Speaking of which, that also needs to be tested. It received its own 16 channel input card and two EL7332 motor driver terminals to drive all three motors.
There still needs to be some serious work done, but we are getting there
If you want further details, just let me know and i will send you some details as soon as possible
Please Log in or Create an account to join the conversation.
- PedPEx
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 28
29 Sep 2026 19:33 - 29 Sep 2026 19:35 #349987
by PedPEx
Replied by PedPEx on topic Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Hello folks 
Very good news: The MAHO mill retrofit has entered the finishing state.
LinuxCNC can now read all inputs, sensors, thermal-switches, ... and also control everything, from the gearbox-motors, the VFD with the spindle motor, the Indramat DC motor driver and all the other components.
Features working at the moment:
- Working DC axis motors (PID not tuned)
- Reading the Heidenhain LS403 glass scales directly with modified EL5021 terminals
- Working gearbox and VFD (EL7332 controlling gearbox motors, Danfoss FC302 controlling original spindle motor)
- Working toolclamp-mechanism (with added button)
- Safety related inputs handled with TwinSafe Safety Hardware (EK1914 and EL1918)
- BusCheck monitors EtherCAT bus config (SafetyPLC CRC now too)
- Faulthandler gives operator detailed info, warning and alarm messages (message conditions need to be cleaned up)
The best feature probably is the continuously adjustable spindle speed. When a speed between 8 and 4400 RPM is requested, the best suited gear of the gearbox is selected (and will be used for all further requested speeds until a M5 command is sent) and the last speed adjustments are done by setting the spindle motor speed accordingly. That way it should be possible to cut threads with rigid tapping in theory up to 260 Nm in the lowest gear. A video of the three LinuxCNC spindle related components (fc302VFD, gearbox and spindle_master) working together is over on YouTube .
Beckhoff has their own way of implementing a zero logic for their encoder terminals - for the Z(ero)/reference impulse. There is now also a component, which ties this index zero logic into the LinuxCNC homing logic. The component should work with all Beckhoff encoder input terminals and boxes - it was only tested with an EL5021 terminal. All components and the whole machine config can also be found over on github .
There are still quite some things that need to be done, like tuning the PID controllers, designing and building the new monitor-arm and so on... But we are getting there
Very good news: The MAHO mill retrofit has entered the finishing state.
LinuxCNC can now read all inputs, sensors, thermal-switches, ... and also control everything, from the gearbox-motors, the VFD with the spindle motor, the Indramat DC motor driver and all the other components.
Features working at the moment:
- Working DC axis motors (PID not tuned)
- Reading the Heidenhain LS403 glass scales directly with modified EL5021 terminals
- Working gearbox and VFD (EL7332 controlling gearbox motors, Danfoss FC302 controlling original spindle motor)
- Working toolclamp-mechanism (with added button)
- Safety related inputs handled with TwinSafe Safety Hardware (EK1914 and EL1918)
- BusCheck monitors EtherCAT bus config (SafetyPLC CRC now too)
- Faulthandler gives operator detailed info, warning and alarm messages (message conditions need to be cleaned up)
The best feature probably is the continuously adjustable spindle speed. When a speed between 8 and 4400 RPM is requested, the best suited gear of the gearbox is selected (and will be used for all further requested speeds until a M5 command is sent) and the last speed adjustments are done by setting the spindle motor speed accordingly. That way it should be possible to cut threads with rigid tapping in theory up to 260 Nm in the lowest gear. A video of the three LinuxCNC spindle related components (fc302VFD, gearbox and spindle_master) working together is over on YouTube .
Beckhoff has their own way of implementing a zero logic for their encoder terminals - for the Z(ero)/reference impulse. There is now also a component, which ties this index zero logic into the LinuxCNC homing logic. The component should work with all Beckhoff encoder input terminals and boxes - it was only tested with an EL5021 terminal. All components and the whole machine config can also be found over on github .
There are still quite some things that need to be done, like tuning the PID controllers, designing and building the new monitor-arm and so on... But we are getting there
Last edit: 29 Sep 2026 19:35 by PedPEx. Reason: formatting
The following user(s) said Thank You: tommylight, Unlogic
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- EtherCAT
- Retrofitting an old industrial CNC mill with EtherCAT components - MAHO MH400E
Time to create page: 0.157 seconds