This instructional revolves more around setting up a device that can be used as a network mass storage device. I will focus on more of the hardware sides of things and when it comes to setting up the Pi refer you to instructionals I used to make this project possible.
There are many instructionals online to walk you through setting up your raspberry pi. I use the "Raspberry Pi Imager" with the Raspberry Pi OS Lite image.
Once the SD card has the OS written you will need to enable ssh and configure wifi. Use the resource files below ("ssh" and "wpa_supplicant.conf") the "Headless Pi Zero W Wifi Setup" article to configure these files for your network.
Post OS Install Pre-rec's
(1) Update apt
sudo apt update
(2) Install Python3 / PIP (It should already be installed)
STEP-09: Creating a Test file and Slices Directory
Now we are going to create a file and directory that will eventually be visible on the Elegoo printer. The Raspberry Pi Zero W should be plugged into the printer from the designated USB port on the pi and you should have a power supply hooked up to the pi as well. The stock USB port on the Elegoo does not supply enough power to power the pi.
sudo touch /mnt/usbshare/hello.world.txt
sudo mkdir /mnt/usbshare/Slices
STEP-10: Test mass storage device mode
Now comes the moment of truth. Let’s see whether the 3D printer is going to be friends with the Pi Zero W. The command below will enable USB mass storage device mode, and the Elegoo printer should pop up a dialogue box. If it doesn’t, you may need to back out of the menu to the main menu page and get back into the storage.
In order for the printer to detect any changes we’ve made over the network (for example, file or folder creations and deletions), it needs to be tricked into thinking that the USB device has been removed and reinserted.
We can use a Python library called watchdog (magpi.cc/2sLL1fi), which is designed for monitoring file system events and responding to them. Install this with the command below:
sudo pip3 install watchdog
We then need some code to start a timer whenever something changes in the shared folder. The timer is reset to zero every time a new change occurs, and the USB reconnect is only triggered if we see 30 seconds of inactivity after a change. This avoids spamming the printer while we’re copying over multiple files.
The article refers to a program written to do this. To download it, type: