LinuxCNC is control software that will allow you to control your CNC machine with either a parallel port or an ethernet connection. The purpose of this article is to help you configure your Raspberry Pi 4 to run LinuxCNC and to communicate with a Mesa 7I76E card via ethernet.
Optional instructions are included to enable VNC/SSH to allow remote terminal and desktop access.
First, you'll want to get the latest version of LinuxCNC for the Raspberry Pi. LinuxCNC itself is software that runs on Linux, but it is distributed as a full operating system image that is set up and ready to run. As of the time of this article, LinuxCNC 2.8.0 is the latest version. On the LinuxCNC downloads page there is an entry titled LinuxCNC 2.8.0 Raspberry Pi OS based on Debian 10 Buster that you need to download. The file size is about 1.2GB.
To "install" an operating system on your Raspberry Pi, you must flash the OS image onto the "hard drive" that the Pi will use. The hard drive can be a MicroSD card (as has historically been the standard for Pi), or it can be an external USB drive. It is recommended that you use an external SSD as this will allow your Pi to perform at its maximum capacity; however, to do so requires some additional effort. Once you've chosen a storage method, you'll need to "flash" the image. There are various software packages available to flash images to a drive and balenaEtcher is among the easiest.
The configuration of the Mesa 7I76E board to communicate with your Raspberry Pi is very simple. Pin W2 and W3 on the board work together to configure the IP address of the device. In our case, we want to use the EEPROM setting of 10.10.10.10
, which requires W2 to be set in the DOWN position and W3 to be in the UP position. NOTE: UP/DOWN/LEFT/RIGHT are relative positions, and it is assumed that the Ethernet port is pointing to your left.
After configuring pin W2 and W3, you'll need to supply power to your Mesa board. There are two different schemes for powering your Mesa board and both methods are described in the Mesa 7I76E manual. For a PrintNC, it is sufficient to share Field I/O power with Logic Power (pin W1 in the LEFT position). After verifying the position of W1, connect your power supply as shown below (source).
Note that the diagram shows a 24V power supply; however, this is not explicitly necessary. Consult the Mesa 7I76E manual for power supply requirements.
Using your drive flashed with the LinuxCNC-provided operating system:
There will be a series of dialog boxes that will take you through the initial setup of the device. Optionally, connect to your WiFi when prompted. When asked to Update Software, choose carefully! It is a best practice to devote this device solely to running LinuxCNC. The out-of-the-box operating system is expected to work with LinuxCNC. If you perform system updates you could inadvertently make a system change that affects the performance or compatibility of LinuxCNC. I recommend to Skip updates.
Once complete, you will be prompted to restart your Pi. You can do so now, or you can wait until you've finished the Ethernet configuration.
Next, you will need to set up a static IP address on your Raspberry Pi eth0 interface that is on the same subnet as the Mesa board. Open a terminal and enter the following command:
sudo nano /etc/dhcpcd.conf
Navigate to the bottom of the file using your arrow key and enter the following:
interface eth0
static ip_address=10.10.10.11/24
Then, save the file using CTRL+X
, Y
, and then Enter
.
Finally, for these settings to take effect you will reboot your Pi using
sudo reboot
Once your Pi is online and has been configured with a static IP address on the eth0 interface, connect it to your Mesa board via Ethernet and ensure the Mesa board is connected to power. Open a terminal and test the connection to the Mesa board using ping
as follows:
ping 10.10.10.10
If successful, you should get ping responses as shown below:
pi@linuxcnc:~ $ ping 10.10.10.10
PING 10.10.10.10 (10.10.10.10) 56(84) bytes of data.
64 bytes from 10.10.10.10: icmp_seq=1 ttl=64 time=0.103 ms
64 bytes from 10.10.10.10: icmp_seq=2 ttl=64 time=0.103 ms
64 bytes from 10.10.10.10: icmp_seq=3 ttl=64 time=0.102 ms
64 bytes from 10.10.10.10: icmp_seq=4 ttl=64 time=0.094 ms
64 bytes from 10.10.10.10: icmp_seq=5 ttl=64 time=0.090 ms
To cancel the pinging operation and regain control of your terminal, press CTRL+C
. If you did not get any successful ping responses, you might have a problem with your configuration. Before trying further troubleshooting, simply power down (unplug) the Mesa board and the Raspberry Pi and then power them back on. After rebooting, try pinging the Mesa board again to see if it works. If not, consult the #LinuxCNC channel on the Discord server for further assistance.
That's it! You're all set up. Finally, you'll want to go to Menu -> CNC -> Pncconf Wizard
to set up your machine.
A Raspberry Pi can be used by connecting a monitor and keyboard/mouse as you've likely done up until this point; however, sometimes it is more convenient to connect to the Pi remotely from another computer such as a laptop or desktop on the same network. VNC is a tool that will allow you do control your Pi similar to Windows' Remote Desktop functionality. SSH will allow you to connect to the terminal of the Pi.
To enable these options, go to Menu (top left - the Raspberry icon) -> Preferences -> Raspberry Pi Configuration
. Click Interfaces
and Enable "VNC" and/or "SSH". If you are unfamiliar with VNC and SSH there are numerous articles on the web that will walk you through utilizing these tools. One of each are included for your convenience:
If you choose to control your Pi via VNC without a monitor attached, there is one more thing you must do. If you reboot your Pi with no monitor plugged in, you will get a message on VNC that states "Cannot currently show the desktop." This is because the Pi does not know what resolution to display. To fix this, you need to do a few things in the terminal. If you have SSH enabled, you can still SSH into the Pi and you can change the settings from there.
sudo nano /boot/config.ext
#framebuffer_width=1920
#framebuffer_height=1080
CTRL+X
, Y
, Enter
to save the filesudo raspi-config
Advanced Options
and Resolution
Ok
Finish
Yes
to rebootIf your Pi is not booting with the correct resolution after performing these steps, you may also need to perform the following:
Menu
-> Preferences
-> Screen Configuration
HDMI-1
and select the correct resolutionConfigure
-> Apply
If you want to regularly connect to your Raspberry Pi (file transfer, VNC access, SSH, etc.) then you should take the time to assign your Pi a static IP address on your router. Doing so varies wildly by manufacturer, but a high-level overview of the process is as follows:
192.168.1.83
for example)sudo ifconfig
in the terminal and look for inet 192.168.1.83
by wlan0Booting your Raspberry Pi from a USB SSD may result in a significant performance increase. However, care must be exercised in choosing the external SSD due to power requirements -- consider selecting a SSD that uses an external power source instead of the USB connection itself. To boot your Raspberry Pi from a USB device instead of the MicroSD card, follow this tutorial:
https://www.youtube.com/watch?v=8vC3D19e_Ac&feature=emb_title