Linux beginner RPI 5, GPIO + ethercat 4 axis adventure

More
2 years 1 month ago #309930 by the_erk
Hello all, 
In this thread i intend to to document my attempt to to build a controller for a 4 axis mill, from concept to implementation. 

I am highly inexperienced with Linux and programming in general,  so this may be new source of entertainment for the more experienced members. The hope is to leave a trail someone as daft as me could follow, to create a workable controller.

The Photo's of screens and other dubious content is aimed at providing a quick and dirty temporary reference for those of us who don't know what the result is supposed to look like, if this ends up being of use i will tidy it up.  


The end goal  is a 4 axis ethercat motion control system with RPI gpio performing a few less timing sensitive functions such as spindle direction and gear selection.  with closed loop position control.



 

Please Log in to join the conversation.

More
2 years 1 month ago #309932 by tommylight
Welcome and feel free to ask/teach/entertain us.

Please Log in to join the conversation.

More
2 years 1 month ago #309969 by the_erk
So one of the first questions that seems to crop up is latency/jitter and general performance of the RPI5 vs PC hardware and older RPI models.
 
I don't have an old pc available but i do have a RPI 4b and a PRI 5, both with 8gb of ram. and i can test the RPI 5 with and without the PCIE NVME hat to see if that makes any meaningful difference.
For fun i might try a usb bootable image for the laptop i used for Mach4 and Ethernet Smooth Stepper.

All will be tested with Linux CNC 2.9.2, SD card tests are done with a fresh image from the RPI Imager using the same sd card. 

For the NVME test  i have been playing with that install(2.9.2) for a few days (and the jitter looks worse for it I think).

All tests done with 10x glx gears running and Linux CNC guide open in firefox and scrolled around to get some idea of loaded up performance. 

All RPI tests will be also using the same keyboard, mouse and HDMI + USB touch screen 

As a side note the NVME drive seems to make the PI5 feel more responsive and quicker to bootup. 

The performance of the PI4 with a desktop is new to me as i have only used it headless to run a 3d printer with klipper.  

Please Log in to join the conversation.

More
2 years 1 month ago #309974 by the_erk
Well i have some results, but I'm not sure what they mean in real terms beyond the recomendations in the documentation. I would be curious to know how they compare to other peoples results.  

DUT                       base thread  (us)                  servo thread (us)

RPI 4b sd card       -24.7 (sdev2.5) +79.1        -149.2 (sdev5.4) +148.6
RPI 5   sd card       -23.6 (sdev 1.0) +19.3         -30.6  (sdev2.1) +31.6
RPI 5   NVME         -13.1 (sdev0.9) +12.1          -15.7 (sdev2.1) +16.3



 

Attachment not found


(left running for 7 hours, result above unchanged)

Going by  linuxcnc.org/docs/stable/html/install/latency-test.html   the sub 15 microsecond base jitter provided by the RPI 5 with NVME should allow software stepping and the hardware seems capable from this crude test.. And yes i did take a photo of the screen because i am a luddite.
 

Please Log in to join the conversation.

More
2 years 1 month ago #309976 by rodw
Your latency looks fine for ethercat. To me it does not make sense to adopt ethercat and use another system for I/O. Use a ethercat I/O module

Please Log in to join the conversation.

More
2 years 1 month ago #309980 by the_erk
Good point, Rodw.

Part of my interest in the GPIO was to use encoders for screw mapping or closed loop control, thinking the more ethercat components i buy(controller budget) the less the retrofit budget for the mill.

However a serious deficiency in motion control cannot be compensated for in motion hardware and vise versa. 

I now have an Ethercat IO module next to me (arrived this morning along with some cat 6e patch leads) but due to me being a clown it seams the connection module for the ethernet cables is a discreet entity, and that will arrive tomorrow along with a 2x channel encoder interface.

On rout from china is an Rtelegent ECT60 Ethercat closed loop stepper driver that should be compatable with the 4x nema 34ish encoder equipped steppers i removed from my first cnc retrofit project. If i can bully them into working together i will order 3 more. 

As for the Ethercat IO and encoder inputs i have aquired some Beckhoff modules.

EK1100 Ethercat coupler  (don't forget this bit )
EL2609 18x 24v digital output 
and possibly the wrong encoder interface for TTL grrrr
 

 

Please Log in to join the conversation.

More
2 years 1 month ago #310072 by the_erk
Establishing Ethercat communication is covered beautifully by  forum.linuxcnc.org/ethercat/45336-etherc...-how-to-step-by-step  

But for those like me who struggle with following instructions you might encounter the following error
 

Attachment not found


because you failed to modify the ethercat conf file located 
with

MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"DEVICE_MODULES="generic"

 

Attachment not found



beware that is might not show an error like this if you missed the  DEVICE_MODULES="generic" line further down the file. but it did not behave as expected / work. 

the end result of   "sudo systemctl status ethercat.service" should look like this
 

Attachment not found



To confirm that Ethercat is trying to do something, but without any slave devices attached the command " ethercat master" should provide some conformation that something is going on. the output of the command should appear something like this.
 

Attachment not found







 

Please Log in to join the conversation.

More
2 years 1 month ago #310167 by rodw
Unfortunately the ethercat code has nothing to do with linuxcnc so we have no control over the features it offers.
(Other than to wite instructions which you ignore at your own peril ) 

Please Log in to join the conversation.

More
2 years 1 month ago #310340 by the_erk
Well hopefully it gives a few people like yourself a chuckle Rodw.
I hope my antics didn't come across as a criticism.

I am impressed but Ethercat , Linux CNC and the supporting documentation available, i'm just a bit of a bumbling idiot who has no idea what he is doing.

The fact i have made any progress at all ( i got some lights to flash on demand) is a testament to the efforts of people like yourself in making a complex and intricate system accessible to a digital novice like me.

Please Log in to join the conversation.

Time to create page: 0.289 seconds
Powered by Kunena Forum