Present day CNC/Lasercutters have an indirect interface involving external computers. To explain this let me give you an example, lets 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 and make a CAD drawing then only you can 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 1cm radius circle will look different on different screens at different zoom levels.
But just imagine what if you could simplify this by placing your hand directly on the work piece and telling the system directly about measurements by using hand strokes. Thus, removing the process of tedious measurement taking and cad modelling. And the system projects the tool path telling the user about the actual size to be cut and actual position where cutting will happen.
Chal-Kaat(meaning lets cut in Hindi) is an attempt to exactly do the same. Its a direct manipulation 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, where the users can express themselves more directly 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 for the interface.
Warning: working with lasers is extremely dangerous. A 2W laser can blind you instantly even if looked indirectly. Always wear proper laser safety glasses.
Step 1: Things Needed
- 2W laser without driver ($84)
- Laser driver ($36)
- Laser heat sink and mount ($4)
- Build your own Arduino its much cheaper (less than $5)
- Wireless programmer for arduino ($22.5)
- 2 Pololu stepper motor drivers ($12)
- Atleast 2 Stepper motors (got them from my 3D printer)
- Pico projector ($110)
- USB HD Web Camera ($68)
- Stainless steel rods (got them from local market for $4)
- 4 SK8 mounts ($8)
- 6 SC8UU bearings ($20)
- Belts (got them from my 3D printer)
- CPU fan for cooling laser ($5)
- cardboard base (got them from local market for $2)
- Glue (<$1)
- 12v 4amps and 6v 3amps power supply (got them from local market for $10)
Total cost ~ $390
You can reduce it by salvaging components like motors, drivers, belts, bearings, fan from old electronic gadgets.
Step 2: Working Principle and Steps Involved
The overall working of the system can be described in following steps:
- User places the object to be cut under the system or manually draws the dimensions using hand strokes.
- System scans the image, generate g-code and project the scanned image on the workpiece.
- User can now use the red and blue markers to translate and scale the projected image respectively.
- After fixing the position and scale the laser cutter will now cutout the workpiece of that exact scale and exactly at the same position
The setup consist of a projector and an RGB camera mounted on top. The RGB camera has two functions. Firstly, It tracks the hand strokes by scanning the image. Secondly, 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.
Step 3: Assembling the X Axis
From where do we start? Well we first need to assemble the laser cutter. First get a small cardboard 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 the hardware store near my house so that I don’t spend time cutting them myself.
Now we have to mount the x axis rods on the cardboard base. We used sk8 shaft support to mount the two parallel 8mm rods for the base (Make sure they are parallel else laser assembly won’t move properly). Also, insert two sc8uu bearing into each x axis rod. This will help us assembling the y axis in the next step.stepper
Using a screw driver 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 road. 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.
Step 4: Assembling the Y Axis
Now we have to mount the y axis rods. To do that we have to prepare a mount for them. We can’t use sk8 here so I got acrylic mounts laser cut from my friend. It had 3 pieces so I assembled so 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.
Step 5: Mounting the Laser and Laser Driver
Make sure you have a laser without an inbuilt laser driver because if you have one 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.
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 FlexMod P3 laser driver.
The driver accepts input voltage from [5-24], but for the laser we have 6 volts 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 is 1.8 amps at 5 volts. The instructions for doing this is in the manual. You can use a multimeter to calibrate the driver.
Also, driver accepts a modulating signal of [0 ,5] volts to control the intensity of the laser. So, at 0 PWM laser will be barely on and at 255 PWM 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 lying around with us and drilled holes to mount the laser. Mount the laser such that its focused on the surface where cutting will happen.
You should also mount a fan to cool down the laser and it’s driver. A 12V cpu fan should do it.
Step 6: Hardware Schematics and Final Board
You can either buy an arduino or build your own. We didn’t want to spend $35 on a microcontroller board so we decided to build our known. There is a nice tutorial here about building your own breadboard arduino so I am not repeating it here.
To control the stepper motors you have to buy two stepper motor drivers, we got some old A4988 bipolar stepper motor drivers from our 3D printer. Connect the motor driver as shown in the schematics.
If you are building your own controller board you will need an FTDI chip to program it and to send serial data. Arduino board already have a usb to serial converter so you don’t need anything in that case. 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 to make it work. Connections are shown in the schematics. You can read more about Bluefruit EZ-Link on the Adafruit website here.
Step 7: Image to G-code
There are two modes in which laser cutter works :
- Cutting: Here the camera on top of the setup extracts edges form 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 send to arduino which will drive the stepper motors accordingly. The g-code looks something like x1 y1 255, x2 y2 255, x3 y3 0….. 255 and 0 here are the intensity of laser. 255 represents full power draw while 0 means off.
- Etching: In this case the laser cutter scans the image line by line for the gray scale values and generates gcode which looks something like x1 y1 z1, x2 y2 z2, x3 y3 z3…. where z is the gray scale value at point (x ,y).
Step 8: Arduino Firmware
There are firmwares like GRBL which are already there to interpret g-code. But, we decided to write our own basic firmware (for the sake of learning). What it does is simple, it accept 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.
Step 9: Tracking Color Markers
I mentioned before that we used red and blue color markers for moving and scaling projections. 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.
Step 10: Demo at National Museum of Science and Technology Leonardo Da Vinci, Milan
Chalkaat was demoed at National Museum of Science and Technology Leonardo da Vinci, Milan, Italy.
Credits: Anirudh Sharma (anirudh.me)
Nitesh Kadyan (niteshkadyan.in)
Fabio Besti (fabiobesti.com)