Recently I was gifted an Ender 3 3D printer. I'm trying to use a Raspberry Pi Zero W to send commands to the printer remotely, if I get this to work the idea is to instruct the RPi to pull G-code files over the internet and then send it to the printer. I read about Octoprint but they don't recommend using RPi Zero W with it, and also I want to learn more about programming (I just know Python), so if possible I'd like to avoid using it.

Here is what I've done:

  • My RPi Zero W has Raspbian Buster Lite, so I'm using SSH to connect to it remotely. The pi is connected to the mini usb port on the printer.
  • Once connected I located the serial of the printer, which is ttyUSB0.
  • I verified the baud rate using stty < /dev/ttyUSB0, which was set to about 9600.
  • I read on the internet that the Ender 3 controller has a baud rate of 115200, so I ran stty -F /dev/ttyUSB0 115200 and that worked fine.
  • I tried sending the G-code to go to home position (G28) via serial using echo "G28" > /dev/ttyUSB0, but that just restarts the printer (the screen shows the logo and then returns back to the info screen). This persists even when sending different commands.

I tried opening another SSH session to read the output of the printer using tail -f /dev/ttyUSB0, but that again restarts the printer, and sending echo to it when tail is running won't do anything.