Raspberry PI 5 LinuxCNC

    Introduction: 

    Although this section is not directly related to my TinyCNC-II project, I did want to include it as (best as I can remember as it has been awhile since I built it) I have been very pleased with the performance and convenience it has provided me. There is a lot of information online regarding using a Raspberry Pi 5 for LinuxCNC operations, but I was never able to come across all in one site of information for this.

    Hopefully this information I have tried to provide will be helpful to someone.

    Best Regards

    David Q. R. Wagoner

    My old Dell Dimension 9200 PC tower that I was using to run my LinuxCNC program under Ubuntu was getting very "long in the tooth" and I wanted to replace it with something smaller and possibly with better performance and latency so in looking for information on new LinuxCNC PC replacements I ran across articles discussing the new Raspberry Pi 5 and the LinuxCNC port for it. So, having heard of the Raspberry Pi for many years I decided to go ahead and proceed down this rabbit hole and see how it worked out.

    The picture above shows my final Raspberry Pi5 module that runs with a 256 GB Solid State Drive Hat that contains the Raspberry Pi 5 LinuxCNC image with a Power over Ethernet Hat and a Raspberry Pi Parallel Port Hat from Byte2Bot.com. BTW, the parallel port hat has (basically)  the same pin configuration as a PC based parallel port so all I had to do was unplug the DB25 connector from my PC parallel port directly into the parallel port hat on the Raspberry Pi 5 and everything worked!

    NOTE #1: I will not detail how to put the Raspberry Pi 5 OS or the Raspberry Pi 5 LinuxCNC OS images onto the their respective mediums as better instructions then I can provide are available on the Raspberry Pi 5 website and other LinuxCNC websites for the Raspberry Pi 5 ... although I will say that using a USB to SSD M.2 adapter module did make the job of putting the Raspberry Pi 5 LinuxCNC OS on the SSD card much easier for me while using the Raspberry Pi Imager program.

    NOTE #2: My particular setup runs in a "headless" mode that I can use TigerVNC on my main Linux system to remote into the LinuxCNC Pi5 and watch the operations in real time. This headless configuration caused me some difficulty as, even though the stock Raspberry Pi 5 OS is very happy running headless (with the proper settings), there seems to be a bug in the LinuxCNC OS in that I require a "Dummy HDMI plug" to convince the unit to function properly. Nothing I tried worked otherwise with the LinuxCNC Pi5 OS. The Stock Raspberry Pi5 OS worked just fine.

    NOTE #3: Although I have a Power Over Ethernet Hat I actually bought the card for the fan that the Hat provided. But, I feel it is nice to have the option to run the unit with just an Ethernet cable with power provided via that cable if I ever need it.

    NOTE #4: All of the following parts, except the Parallel Port Hat, were purchased either on Amazon.com or EBay.com. The Raspberry Pi Parallel Port Hat can be purchased at https://byte2bot.com

    NOTE #5: My current setup has the limit switches implemented in the HAL file but I currently have them overridden with jumpers on my cable from the Pi5 module to the TinyCNC-II. I will eventually get them connected but for now they are not being used ... but LinuxCNC expects the inputs ... so the need for them to be jumpered out on the cable.

    The following write-up attempts to explain my setup and parts that I put together.

    The base thread latency looked to be very satisfactory to me after I made several changes to the config and command line text files on the LinuxCNC SSD drive. 

    BTW: Normally, I boot directly from the SSD card containing the LinuxCNC OS but I found it much easier to use a Micro SD card to boot the module with the stock Raspberry Pi 5 Bookworm OS when I needed to edit the necessary LinuxCNC files directly on the SSD card.

Raspberry_Pi5_Text_Files.zip

I have provided a link above to the CONFIG.TXT file, CMDLINE.TXT file and the LinuxCNC CUSTOM.HAL file for the Parallel Port Hat file (originally found on the BYTE2BOT web-page) for anyone to download and look over. The CONFIG.TXT and CMDLINE.TXT are LinuxCNC OS boot files that help to boot from the SSD card and additional settings to help reduce the latency of the Raspberry Pi 5 CPU.

My Raspberry Pi5 LinuxCNC module assembly consists of the following:

1) A Raspberry Pi 5 27 watt (5.1 Volt at 5 Amps) USB-C  power supply. (Do not get anything else!)

2) A 8 GB Raspberry Pi 5 card.

3) A 256 GB SSD NVMe M.2 with a PCIe to M2 adapter card.

4) A Power Over Ethernet card for the Raspberry Pi 5 card with a cooling fan.

5) A Raspberry Pi Parallel Port Card created by Byte2Bot.com.

6) A Micro HDMI to HDMI adapter cable with a HDMI Dummy Plug.

7) A few 128 GB Micro SD cards for the stock Raspberry Pi5 OS to boot from when needed.

8) A GeeekPi Aluminum case modified to fit the height of the Hat stack assembly.

9) An additional (possibly optional) heat sink with electrically isolated heat-sink pad that I attached to the bottom of the Pi5 board for additional heat dissipation. NOTE: I had to cut down the height of this heat sinks fins to properly fit into the bottom of the case. Another user might not want to go to all of this trouble as the unit seems to run fine with the existing fan configuration of the POE Hat.

10) Several sets of male to female standoffs for the Raspberry Pi (M2.5 x 11mm + 5mm Brass Hexagon). As you can see from the picture, the case is not ideal but is the best I could come up with.

11) Finally, I went ahead cut out the bottom of the case and attach the cooling fan that came with the case assemble to the bottom of the case. The Fan plugged into the Fan Controller plug on the Pi5 board. Again, this is most likely an optional step that might not need to be taken .... depending on the Pi5 board temperatures noted under extended operation.

The order of the module stack is as follows:

The bottom board is the Raspberry Pi 5 board.

The second board above the RPi5 board is the POE Hat board.

The third board above the POE board is the PCIe to M2 Hat with the 256 GB SSD M.2 

The last board above the PCIe to M.2 Hat is the RPi5 Parallel Port Hat.