Adding a LASER to my CNC

This week I had someone ask me if I could put a picture on a piece of wood for them. I’ve been doing laser scribing with 1” wooden medallions for a while, but not on anything larger, so I took this as a challenge. My CNC machine came with a 2.5W laser sufficient to burn wood, but I’d not even taken it out of the box yet.

When I unboxed the laser, I noticed there really wasn’t any place to mount it on the machine. Too bad, since it wouldn’t have been that difficult for the manufacturer to do.

Spindle

The only real mounting option provided was to pull the spindle motor out and replace it with the laser whenever I wanted to make the switch, but that just didn’t sound right. Instead, I thought I’d ‘side mount’ the laser on the spindle. It wouldn’t be a problem for the software that drives the machine, since it is all relative movement from the starting point. The biggest concern would be collision between the moving parts, and anything being worked on.

After taking some precise measurements, I made a model of the spindle and its housing. It was then just a matter of subtracting that design from a laser mount design to come up with the following mount:

Side-mount design

This design snaps onto the spindle motor mount and should allow for enough support for the laser to do its thing, without too much vibration. Here is a picture of the whole assembly in place:

Finished initial design

Since I have the basic snap-on solution figured out, I’ll also try a front mount version to see if it is more usable. I’ll also try adding a bolt and wingnut clamping system, to make it more stable.

Next, I’ll tackle a vacuum system for the CNC machine, to help control the dust level. But first I need to figure out this whole lasing process, since focusing the laser is critical to the amount of detail I can burn.

Note: Lasers are dangerous and can easily cause eye damage, so be sure to use effective eye protection.

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: https://github.com/winder/Universal-G-Code-Sender#downloads
  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/shsudo
    • 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.
Options 
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 
Language 
English 
Connection driver 
ssc 
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).

More advances in understanding my inexpensive CNC machine

The on-going learning process continues for my new CNC machine. I have learned quite a bit in the past few days and have switched over to using the educational version of Autodesk Fusion 360 to generate the G-code that controls the machine. This version is great for hobbyists who like some professional features. It is a VERY powerful, complex and wonderful tool. I was originally going down the all opensource software route, but wanted more capabilities than I could find on that path.

In the process of doing my first few projects, I learned a number of things:

  1. My CNC machine will only go to about 1000 RPMs and it also doesn’t understand arc commands very well.
  2. The 1 mm router bits can barely take any side force before breaking (duh)
  3. Clamping is really important – you can see in the picture below a range of clamping techniques I 3D printed

All these issues were addressed with a correctly configured Fusion definition of the bits and the machine. Fusion is nice because you can tell it what features your specific device doesn’t support and through post processing redefine the unsupported codes into the invalid G codes (e.g., take an arc command and turn it into a few hundred lateral movement commands). Discovering those post processor capabilities was an interesting mental mining exercise, since I was reluctant to read too many manuals or watch you tube videos. 😊 But figured it out in the end.

My son in getting married in less than two months so this is a picture of my effort to create a Walnut plank with their names and wedding date on it. Hopefully, it will turn out OK and I will not break too many bits along the way.

Carving a plaque