LinuxCNC with raspberry Pi5. Ethercat and step/dir interface.

More
04 Feb 2025 11:48 - 04 Feb 2025 11:49 #320597 by PeanutBlade
Good day all,

I wanted to share my experiences using the Raspberry Pi 5 to run my CNC machine and ask for some advice, as I am not sure where to go from here.

Please note, I am a novice at best!

To my surprise, I managed to set up LinuxCNC with EtherCAT to run my A6 servo motors that I got from StepperOnline. I am using the Probe Basic UI, and I love the setup so far. Big thanks to RodW for all the work and instructions on setting up EtherCAT.

I am also using an Arduino Mega connected to the Pi for general-purpose I/O—this also works great. (Using LinuxCNC_ArduinoConnector from: github.com/AlexmagToast/LinuxCNC_ArduinoConnector) This will mainly be used for buttons and tool changer I/O, so latency is not an issue. An EtherCAT I/O module would be better, but they are rather pricey.

What I would like to do is add a step/dir interface for my Z-axis, as this is still driven by a closed-loop stepper motor (my X and Y axes are EtherCAT). I want to be able to run the motor at a maximum of 200 kHz step rates. In the future, I would like to add a second Z-axis as well.

What I have tried:
  • Using the GPIO pins from the Pi, but this does not generate step rates fast enough to run the motor. This also causes some latency issues, as the step generation is now done on the Pi.
  • I switched out the Pi 5 for a Pi 4 (since SPI is not supported on the Pi 5) and tried using the Remora SPI interface to run a BTT SKR 1.4 as an external step generator. However, this also had a maximum step frequency that was too low. Additionally, I would prefer to use the Pi 5 instead of the Pi 4.
I would also like to build a second machine using only stepper motors with a step/dir interface. My motor drivers accept a maximum of 200 kHz.

I am looking for a solution that will allow me to run LinuxCNC on a Pi 5 with external step generation around 200 kHz that is not too pricey.

Any advice on which direction I should go next would be greatly appreciated.
Last edit: 04 Feb 2025 11:49 by PeanutBlade.

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 12:57 #320600 by unknown
Best bang for buck will be a RPi5 (if you didn't have a RPi5 I'd suggest an ex corporate PC) and either a Mesa Ethernet (preferred as you are not locked into a single platform)or SPI card. SPI & Mesa is supported on the RPi5 by the hm2_spix driver.

There are some other projects floating around Linuxcnc-RIO, but at the end of the day the Mesa cards are solid, well supported and don't look like disappearing soon.

Speaking from experience, regarding "roll your own" external motion cards, carefully work out a costing, sure the base FPGA card maybe cheaper than a Mesa card, but then you have to factor in all the other bits & bobs bring that up the same feature set.

Now I had a couple of Spartan FPGA dev boards floating around so adapting the Mesa SPI firmware and designing a couple of PCB's wasn't a great cost........but having to buy the parts to populate them was a different story. Getting a Mesa board to Australia is about $100 dollars just for postage alone last time I checked. To tell the truth it just started out as "can I get the firmware to run" then it snowballed.

I'm not trying to put you off but just some food for thought. Another point, delving into cnc is not cheap, so pricey can be kind of relative.

Mesa isn't a cult, it works, works well, is well supported by not only end users but by Pete from Mesa........who was kind enough to help me with a few questions regarding the project mentioned above. If my personal circumstances would allow it I'd be buying a few more Mesa cards to run my Lathe. The mill is fully equipped.

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 16:48 #320620 by Martin.L
For your actual machine I wouldn't bother with step/dir and go straight to another servo ethercat. Sell yours and with 150 difference you are already setup.

For your second machine take a look at FlexiHAL, you can directly slap a raspi5 in it. also they are designing a new board with Rj45 for step/dir and another guy is designing a board to swap A6 step/dir to Rj45. Join the printNC discord the board creator is there

Please Log in or Create an account to join the conversation.

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
04 Feb 2025 19:07 #320637 by rodw
If you don't want to stick to Ethercat drives for all axes, really you should not have gone down the Ethercat route. Rtelligent and others have closed loop Ethercat stepper drivers. I would get a couple of them. Leadshine and Rtelligent also have open loop drives that control 2 x steppers in a single drive.

Rtelligent and Deiwu both have more affordable Ethercat I/O options

Please Log in or Create an account to join the conversation.

More
05 Feb 2025 22:19 #320802 by PeanutBlade
Thank you for all the feedback.
I think I will go fully EtherCAT for this machine to simplify the design and avoid multiple communication interfaces in a single machine.Mesa Ethernet or FlexiHAL controllers seem like a perfect fit for my second machine.

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum