Use an Arduino to make your own budget-friendly, augmented reality-based laser cutter.
CNC/Laser cutters are invariable tools of modern day fabrication and there are a lot of open source DIY laser cutter projects that you can make. They are now being widely used in industrial applications at a more personal and mass consumer level. But the cutters today have an indirect interface involving external computers. I can explain this better with an example. Imagine you want to cut a leather bracelet for your arm. To do this with present laser cutters, you will have to first take the measurement of your wrist, make a CAD drawing, and only can you cut a shape. There are two problems here:
- Taking measurements is a boring and tedious process.
- The user doesn't get the actual feel of the size and place of the final cut. For example, a 1cm radius circle will look different on different screens at different zoom levels.
Chal-Kaat ("let's cut" in Hindi) is an attempt to do exactly this. It's a direct manipulation DIY laser cutter that's aware of the strokes being drawn on the workpiece. Chalkaat is a pen stroke based UI for interacting with laser cutters. The users can express themselves by working directly on the workpiece. The camera on top tracks the strokes on paper. Different colored markers allow different commands to be executed. We built a laser cutter from ground up, with computer vision and mechanics to optimize the interface.
The total cost of this project is $390. You can reduce the cost of your DIY laser cutter further by salvaging components like motors, drivers, belts, bearings, and fans from old electronic gadgets.
How Does the Laser Cutter Work?
As explained above, the ChalKaat project allows you to interact with your cutter and design your results on the work piece. This is how the system works:
- User places the object to be cut under the system or manually draws the dimensions using hand strokes.
- System scans the image, generates g-code, and projects the scanned image on the work piece.
- User can now use different colored markers(red and blue here) to translate and scale the projected image.
- After fixing the position and scale, the laser cutter will now cut out the work piece of that exact scale and position.
This is achieved using a projector and an RGB camera. The RGB camera has two functions:
- It tracks the hand strokes by scanning the image.
- It tracks the markers for scaling and positioning.
The projector, on the other hand, projects the scanned image on the material surface used for cutting.
Assembling the X-Axis of Your DIY Laser Cutter
- Get a small cardboard piece and 4 (8mm) stainless steel rods of appropriate length. We took a small cardboard of 60*50 cms and rods were 45cms each. I got them cut straight from a hardware store to save time.
- Mount the x-axis rods on the cardboard base. We used sk8 shaft support to mount the two parallel 8mm rods for the base. Note that the laser assembly won't move properly if they are not parallel.
- Insert two sc8uu bearings into each x-axis rod. This will help us in assembling the y-axis in the next step.
- Tightly screw the sk8 shaft to the cardboard base, and using some zip ties, mount two stepper motors on the two opposite ends of one of the rods. (You can also use only one stepper but then you will need a pulley on the other side. I had extra motors so I used two of them).
Assembling the Y-Axis of Your DIY Laser Cutter
To mount the y-axis rods, we have to prepare a mount for them. Since we cannot use sk8 here, I got acrylic mounts laser cut from my friend. It had 3 pieces(like in the figure) and I assembled them by gluing the three pieces together.
Also, insert one sc8uu bearing into each y-axis rod (this will be used to mount laser in the next step).
Mounting the Laser and Laser Driver
If you have a laser with an inbuilt driver you can only switch ON or OFF the laser and won’t be able to control its intensity. Control of intensity is required if you want to etch a gray scale image. So make sure you have a laser without an inbuilt laser driver.
An 8-bit gray scale image has pixel values between [0, 255]. To etch a gray scale image, we will linearly map the gray scale intensity values directly to the laser intensity. For this purpose, we need a linear laser driver. We used a FlexMod P3 laser driver.
The driver accepts input voltage from 5 to 24V and the laser accepts 6V, which is perfect. Don't exceed the input voltage beyond 7-8 volts. The laser driver needs some calibration for setting up the laser diode current. For our laser, the maximum allowed current was 1.8 amps at 5 volts. The instructions for doing this is in the manual. You can use a multimeter to calibrate the driver. The driver accepts a modulating signal of 0 to 5 V to control the intensity of the laser. This means, at 0 the PWM laser will be barely ON and at 255, the laser will draw its maximum current.
After calibrating the driver, you can connect the laser to it and insert the laser into a heat sink. Now is the time to mount the laser and driver to the y-axis. We used a few pieces of transparent acrylic and drilled holes to mount the laser to it. Mount the laser so that it is focused on the surface where cutting will happen. You should also mount a fan to cool down the laser and driver. A 12V CPU fan should do it.
Given the option of buying an Arduino or building one, we didn't want to spend $35 on a microcontroller board. So we built one using this Arduino.cc tutorial. You will need an FTDI chip to program and send serial data if you build your own board. Arduino boards already have a USB to serial converter.
We had a Bluefruit EZ-Link which can wirelessly program the Arduino using bluetooth. It is also used to wirelessly transfer g-code to the microcontroller. You need to properly connect it to atmega328p controller as shown in the schematics.
Connect the two stepper motor drivers as shown in the schematics to control the stepper motors. We got some old A4988 bipolar stepper motor drivers from our 3D printer.
Image to g-codeThere are two modes in which this DIY laser cutter works:
- Cutting: The camera on top of the setup extracts edges from images and applies a basic depth first search algorithm to connect the edges into paths. Paths are nothing but a sequence of (x ,y) co-ordinates. These points are later sent to the Arduino which will drive the stepper motors accordingly. The g-code looks something like x1 y1 255, x2 y2 255, x3 y3 0, etc. 255 and 0 here is the intensity of the laser. 255 represents full power draw while 0 means off.
- Etching: In this case, the DIY CNC scans the image line by line for the gray scale values and generates g-code which looks something like x1 y1 z1, x2 y2 z2, x3 y3 z3... where z is the gray scale value at point (x ,y).
Arduino FirmwareThere are firmware programs like GRBL which are already there to interpret g-code for your DIY laser cutter. But, we decided to write our own basic firmware (for the sake of learning). What it does is simple, it accepts current (x ,y) co-ordinates along with the laser intensity level and just draws a straight line between previous (x ,y) and current (x ,y) points. In this way, we approximate curves using straight lines.
Tracking Color MarkersI mentioned before that we used red and blue color markers for moving and scaling projections on the workbench of the DIY laser cutter. To make this work, you have to install opencv. Opencv is an opensource computer vision library available for multiple platforms. To track color, we first convert images from RGB scale to HSV scale. In HSV scale, each color is assigned a particular value (Hue). The "amount" of color is assigned another value (Saturation) and the brightness of the color is assigned another number (the Intensity or Value). This gives us the advantage of having a single number (hue) for a single color.
Once the image is converted to HSV scale, a threshold is applied based on the HSV range of red and blue. After thresholding, the position of red and blue markers is calculated. The position of red is mapped to the position of the projected image and the position of blue is mapped to the size of the projected image.
I use Linux, so I used xdotool to resize and move windows. But you can also use opencv's inbuilt functions to do the same.
Follow these steps and you'll be able to build your very own ChalKaat DIY Laser Cutter on a slim budget!
Demo at National Museum of Science and Technology, Italy
The Chalkaat DIY laser cutter was demonstrated at the National Museum of Science and Technology Leonardo da Vinci, Milan, Italy.