Installing Universal G-Code Sender on the Raspberry Pi

Anyone will tell you that a CNC machine generates dust. Computers and dust don’t mix that well, so that started me on a quest to find a Raspberry Pi solution. For my 3D printer I use Repetier to drive the device. I was looking for another alternative.

I found an open source project Universal G-code Sender. This Java based solution looked like it would be ideal. So, it started me on a 3-4-day quest to get it to work. I think I’ve accomplished my goal, though I still have a few minor bugs to work out. I do want to thank the author of the code for pointing me to more detailed information that helped me overcome some of the issues I encountered.

There were some instructions available on how to install UGS on a Pi. They didn’t quite align to my needs though, so I thought I’d document the steps I took.

One if my requirements is that I wanted to ‘see’ the desktop remotely, rather than have a dedicated screen. This allows me to minimize the footprint in my work area and provide the greatest flexibility. I decided on VNC as the solution of choice, since it runs on just about any platform.

Here is the process I used to accomplish my goal:

  1. Install the OS
    1. Format the SD card. I started with a 16GB card that I had lying around unused.
    2. Download latest version of Raspian image and place it on an SD card. I did not use the full image.
    3. Install into the Pi and boot. Follow the prompts (this should define the keyboard and the time zone…) — It will take a while since there is a software update check at the end.
  2. Run sudo raspi-config
    1. Update to latest version
    2. Update the video drivers so it can use OpenGL effectively
      • Advanced Options -> GL Driver -> GL (fake KMS) this allows for OpenGL to work and your screen size to be larger on VNC
      • Reboot
    3. If you are going to run VNC then don’t do this next step – Remove/Move the old video driver
      • sudo mv /opt/vc /opt/vc.old
      • sudo reboot
    4.  Advanced options -> Expand the file system to maximize the use of the file system
    5. Reboot
  3. Install java
    1. Make sure that java is installed with java -version
    2. If it is not there or not the most current jdk (you’ll need to do this if you don’t use the full Raspian image).
    • sudo apt-get update
    • sudo apt-get install openjdk-8-jdk

4. Install the CAM software

  1. Using your browser download Universal G-code Sender (UGS) platform edition zip file from the download page link:
  2. Unzip the software
    • unzip -o TheFileYouJustDownloaded
  3. Move the unzipped folder to where you’d like it on the Pi
  4. Make a shell script to run the program and get around a bug that prevents the path simulation display from working:
    • #!/bin/sh sudo
    • mv /opt/vc /opt/vc.old /home/pi/ugsplatform/bin/ugsplatform
    • sudo mv /opt/vc.old /opt/vc
    • echo "Finished"
  5. Set the script file so it is executable with:
    • sudo chmod +x YourShellScriptName
  6. Run the UGS software
    • Set up the serial port to be the JSSC software in the Tools -> Options ->USG -> Sender Options menu so that the serial connection is more reliable.
General Editor Fonts & Colors Keymap Appearance Miscellaneous LIGS 
Auto Leveler Macros Visualizer Sender Options Controller Options 
C] Show verbose output 
@ use separate step sizes for Z and XY jog movements. 
D Enable single step mode 
@ Enable status polling 
Status poll rate (ms) 
D Show warning popup for Nightly Builds 
Auto start pendant on startup 
Connection driver 
Workspace directory
  • Plug in the CNC
  • Refresh the ports in the software
  • Select the port for the CNC
  • Run through the normal device setup
  • Make sure the CNC jogs properly
  1. If you are going to run headless, check to ensure that remote desktop (VNC) is working properly (you probably want to have the Raspberry Pi have a fixed IP address)
    • If it is not installed use the command
      • sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer
    • On the Pi GUI select Menu > Preferences > Raspberry Pi Configuration > Interfaces.
      • Ensure VNC is Enabled.
    • Define the connection to VNC from your PC or other devices (use ifconfig on the Pi to validate your IP address)
    • Set the framesize on the Pi
  2. If you want to free up some space on a full install
    • sudo apt-get autoremove
    • sudo apt-get update
    • sudo apt-get dist-upgrade

Here is a picture of UGS running on a Pi over VNC (shown on my Windows machine).

Repetier-Server on a Raspberry Pi controlling my 3D printer

A few weeks ago, I mentioned using Cura from my Raspberry Pi to 3D print.

Yesterday, I had some time on my hands so I thought I’d try a different 3D printer controller for the Raspberry Pi – Repetier-Server. It either comes with OS build for your Pi’s SD or you can build it yourself on an existing Raspian installation.

I also loaded some WebCam software for my Raspberry Pi, so that I could see the printer while it is printing in the garage. There are a number of open source projects to stream a USB camera from your Raspberry Pi

The setup has been working great. I connect to the Repetier-Server on the Pi from the Repetier-Host software running on my PC. The PC does all the slicing… and sends the models to the Server and also shows the real-time status of the job in progress. I get the added benefit that I can also stop jobs and monitor progress from my phone (as long as I am connected to the same LAN). I have not done the port forwarding so I could monitor jobs in progress from the Internet, but that’s possible.

There is a new Raspberry Pi 3 in the house

770a5614-2Just in time for Pi day, the Raspberry Pi 3 Model B+ is announced as the top-of-the-line Raspberry Pi . They’ve boosted both processing speed and network capabilities, while keeping the price the same as the older model.

The new board shares many of the same specs as its predecessor (that came out over two years ago), but brings the processor speed up to 1.4GHz — about a 15% increase.

They’ve also added support for dual-band 802.11b/g/n/ac Wi-Fi — effectively almost tripling the Wi-Fi throughput of the base Pi 3 and the have improved the wired performance as well.

Wireless performance

Tx bandwidth (Mb/s)

Rx bandwidth (Mb/s)

Raspberry Pi 3B 35.7 35.6
Raspberry Pi 3B+ (2.4GHz band) 46.7 46.3
Raspberry Pi 3B+ (5GHz band) 102 102


Wired performance

Tx bandwidth (Mb/s)

Rx bandwidth (Mb/s)

Raspberry Pi 3B 94.1 95.5
Raspberry Pi 3B+ 315 315

They also stated “We will shortly launch a PoE HAT which can generate the 5V necessary to power the Raspberry Pi from the 48V PoE supply.” That should add some flexibility for those interested in PoE.

I think I have 3 Raspberry Pi’s around the house doing various functions. Now I’ll have to find another reason to buy one.

3D printing with Cura on the Raspberry Pi

Since I had a bit of time on my hands, I spent some time this weekend switching over the software I was using for 3D printing. Since I first got my 3D printer 5 or 6 years ago, I’ve been using Repetier under MS-Windows. This is a very flexible solution but its Raspberry Pi implementation is only as a server that you would access over the web which is nice, but you can’t see the model progress while printing. I’ll need to experiment with this more though.

There is a Cura implementation that ran on top of Octopi. This print controller will allow me to transfer information directly to the printer, initiate printing and monitor it remotely over the web. Here is the main interface:


One added bonus of making the change to Cura and Octopi is that I can monitor the printing process remotely using a USB camera (that I had lying around) — this capability was just built in. Here is what that looks like:


The first 2 prints I tried came off flawlessly, though I do have a small X axis offset issue to center the print that I’ve yet to resolve.

If you have a spare Raspberry Pi lying around it is definitely worth looking into. I also want to try using Slic3r on the Pi as an alternative 3D slicer.