The Scribe-bot: a Machine to Create Scratch Holograms
by JohnW539 in Workshop > Tools
10336 Views, 35 Favorites, 0 Comments
The Scribe-bot: a Machine to Create Scratch Holograms
When most people think of creating a hologram, they think of a complicated set up involving film, lasers, and complicated optical benches. It turns out that making a hologram - a two dimensional image that appears to be a three-dimensional object - can be created using a scribing compass and a piece of plastic. These handmade three dimensional images are called scratch holograms.
Scratch holograms are created when there is a thin scratch across a flat surface. As you change your angle of viewing, point sources of light (like the Sun on a clear day) reflect off a single part of the curve. By changing your angle of perspective, this reflective point shifts along the curve. When you put a large number of these scratches together, you can create a three-dimensional image that can be viewed in reflected light.
There are a number of great Instructables on this site and elsewhere about how to make Scratch holograms by hand:
- https://www.instructables.com/id/Make-a-Tool-to-Dr...
- https://www.instructables.com/id/Scratch-Hologram-...
- http://amasci.com/amateur/holohint.html
If you want to understand the science of these images, there is a really nice paper by William Beaty in the SPIE Proceedings of Electronic Imaging on why this works.
http://amasci.com/amateur/hand1.html
The problem with making Scratch Holograms is the effort required to create them. You have to make a series of concentric scratches by hand to make the reflective pattern match an object. Every point in the image has to have a corresponding scratched arc. Automating these scratches is tricky. For reasons we will discuss in the next section, you can't make these with a standard CNC machine or a laser etcher. It turns out, you have to build a special kind of tool.
In this project, I will show you how to make modify a CNC machine to make the kind of scratches needed to make complex scratch holograms automagically! Even if you aren't interested in making scratch holograms, this project will show you how you can add additional tools onto your CNC machine. It will take you through the physical design of the system, the electronics needed to create the scratch after it is triggered, the interface to the CNC controller, and the generation of the G-Code needed to run the machine. Of course, you are free to modify these codes for your own projects to work your own specialized tools.
Why Not Just Use a Laser Cutter or a Normal CNC Machine?
When I first discovered that you could make scratch holograms, I grabbed a piece of plastic from my shop and a scribing compass to create one. I was mostly happy with the result, but it was SO tedious to create the image. I made scratch after scratch after scratch just to make a simple pattern. The final layout wasn't quite as uniform as I would like, and it took a long time to finish. I quickly realized I wanted to automatic this process. Naturally, I looked around my shop and around the local Maker Space to see if I could use an existing machine to do the work for me.
The most obvious tool to create scratch holograms was the laser etcher. You can make very fine laser etched lines in acrylic with almost no effort at all using a laser cutter. I quickly wrote up some a little python script to position the centers of the arcs and then generate arcs for simple letters. I brought the resulting eps file to my Make Space, and etched the pattern onto a piece of acrylic. The results were a bit surprising. The picture above shows the result. Basically, I found that there were two problems:
- Lasers vaporize plastic. Obviously the laser etching process leaves behind a white line, not a clean reflective scratch. This white residual works beautifully for creating patterns on etched acrylic, but doesn't give the result we need for a scratch hologram. Initially I thought the white etched area would be easy to clean up if I used the right power levels, frequency, and speed. However no settings I tried produced a clean line using the laser etcher. I then thought perhaps this problem could be fixed by some kind of post processing, so I tried several cleaning processes on the etched plastic. None of them fixed the lines. Finally, I attempted to use a heat gun to gently re-melt the acrylic to make the white areas clear again. That process also failed. Lasers just don't the right kind of reflective line.
- Lasers and CNC machines don't produce smooth circles. Because these lasers and CNC machines are driven by stepper motors, creating a truely continuous curve is impossible. There are always discrete jumps in any curve line cause by pixelation. Usually when you make 300dpi or 600 dpi images, these jumps are so small they you can't see them. However even at 600 dpi, the pixels easily show up when we reflect light on the edge of these curves. The very optical effect you need for creating these holograms shows how uneven these circles are. Instead of right reflecting off of a single point along a circle, light reflects across of a much larger region. This effectively spreads out the reflection which prevents you from seeing the hologram.
Although a CNC machine with a stylus wouldn't have the same problems with vaporizing plastic as a laser, the pixelation in the circles caused by the steppers would still cause problems for creating the types of reflections we need to make the holograms work. Because we can't use XY stepper motors to create the arcs needed for scratch holograms, I realized that we have to create a new kind of machine that will make smooth arcs. That's the motivation behind this project and this new tool.
How Does the Machine Work?
Overall, this machine has two basic parts:
- A servo driven compass with a metal scribe on the end to etch a continuous arc on plastic.'
- A standard CNC machine that positions the center if the compass to create the arcs for the hologram.
The CNC I used in the project was an X-carve. Any CNC machine would probably work in this project as long as you had a framework to attach the servo system z-axis. The servo system and the supporting software are at the heart of this project.
There are a lot of interlinked elements in this project:
- The physical design to attach an electronic circle scriber to the CNC machine
- The electronics and Arduino software needed to trigger the scriber and the electrical interface between the CNC machine scriber
- Software to generate a pattern of x/y positions for the scribing a simple design
- Software to take the x/y positions and turn them into G-code to drive the machine
- The initialization and setup for the machine once everything has been assembled.
I'll take you through these steps one-by-one.
To build this extra addition for your CNC machine, you will need:
- An Arduino - used an Arduino Uno R3, but any variety should work fine.
- A few electronic parts, including a few resistors, a 4n35 optoisolator, a couple LEDs, a prototype board, and some wire.
- A high torque (20 kg/cm) 5 volt servo. I used the ANNIMOS 20KG Digital Servo High Torque Full Metal Gear Waterproof for RC Model DIY, DS3218MG, but other similar units should work. The cost was about $20 on-line.
- Two 5 volt powers supplies - one for the Arduino (via the USB port) and one for the servo motor.
- Misc. hookup and connecting wire.
You will also need to purchase a few long sewing needles and have access to a 3d printer for the parts. For making the holograms, you will need to purchase some sheets of thin acrylic at the local building supply store. I just used 0.093 inch thick acrylic that was intended to be used in windows.
The Mechanical Design: Attaching the Stepper Motor to the Router
To attach the servo to the router, you need to print the STL files at the top of this step.
There are four parts:
- Router-mount
- Scriber-stylus-holder (there are two version of this file. I prefer the version 2.)
- Servo-bottom
- Servo-top
All of these parts were designed using Fusion 360 for this project.
After you have printed these parts, putting this together is simple:
- Disconnect the servo arm from the servo.
- Sandwich the servo arm between the servo-bottom and servo-top pieces. Use four M4 bolts and nuts to lock the arm in place. Reconnect the arm to the servo.
- Mount the servo into the router mount piece. Make sure to thread the cables through the top of the mount. Use four M4 bolts and screws to secure the servo.
- Disconnect the router bit and dust collection system from the router. Make sure the router is powered off and the power cord is disconnected from the wall.
- Mount the router-mount piece to the side Z-axis mount the holds the router. You will need to use three M4 bolts to attach it. This piece is designed to attach to the left side of DeWalt 611 router on an X-carve. This design was based on a dust collector for the X-carve that I found on Thingaverse: https://www.thingiverse.com/thing:1259385. Using this design as inspiration, I made my own version of this part to hold the servo for the project. Of course, any kind of mounting system would probably work fine. If you have another kind of CNC machine, you almost certainly will need to redesign this part.
- Take a long sewing needle and cut it so it has a length to between 1 and 1.5 inches. I used a bolt cutters to trim the needle, but a Dremel, hacksaw, or even a hefty pair of wire cutters should work fine. Once the needle is cut to length, insert it into the scriber-stylus-holder using a pair of pliers. You may need to widen the hole a bit with drill. Make sure the needle fits securely into the holder. You can use glue if you like, but I found the friction fit was strong enough to hold it securely. The two version of this part are included to help you experiment with the project. V1 has a 30 degree angle and allows for a full-range adjustment of the arc being scribed. V2 has a 45 degree angle making the downward pressure from the needle stronger resulting in deeper scratches. The results shown in the project were down with the V2 version of the file.
- Attach the scriber-stylus-holder onto the top part of the servo arm holder. It should just slide into the servo top piece from the side. You will need to set and secure the scribe distance using a single M4 bolt. The scribe radius will affect the depth of the images you see in the hologram. For your first attempts, I would recommend keeping the scribe radius to between 1 to 2 inches.
Once you have done these steps, the physical assembly of the scribe-bot is done.
The Electronics Design: Triggering the Servo With the CNC Controller
The electronics for this project are relatively simple. Basically, there is only one digital input. When this input goes high, the servo sweeps from its starting position clockwise to its final position. When the input goes back to the low state, the sweep reverse back to the starting position.
To assemble the system, I used a mini-prototype board that was connected to an Arduino Uno R3. I found the plans for this holder on Thing-A-Verse. (https://www.thingiverse.com/thing:2295626). A circuit board and permanent Arduino shield would be better, but this project was a designed to be a prototype. This should also be put in a box to protect the electrical connections.
The input to the circuit is taken from the M8 "flood" output of the CNC controller. This input section of the circuit is fed through a 4N35 optocoupler through a resistor to prevent any possible electrical feedback between the CNC controller. This may not be strictly necessary, but I wanted to make sure the controller is protected and isolated from the servo and the external power supplies. I put a Green LED and a resistor in parallel to the 4N35 so I could see when the controller goes between the high and low states.
The Arduino sketch converts the state the pulses that control the servo. When the input goes high, there is a 7ms delay for each degree of travel the servo travels to regulate the sweep speed. The sketch for the project is included above. You can easily modify the sweep angles and the sweep rate by modified the constants defined at the top of the sketch.
There are two power supplies needed to make this all work. First, you need to power the Arduino itself. I did this with a simple 5 volt USB recharger and USB cord. A second 5 volt power supply is needed to power the servo. Make sure that there is enough amperage to power the servo. The high torque servos can draw 3 amps of power.
The final step for the electronics is to connect it to the M8 connector on the CNC controller. Since this trigger is a low amperage connection, I used a 20 gauge wire two lead wire I had lying around the shop. Make sure to verify that the wires are fed into the optocoupler before you connect hook up any powers supplies or turn anything on. Once you have connected the unit to the controller, we are ready to generate some G-code and start making holograms!
Downloads
Generating the G-code and Layout Using Python
To generate a scratch hologram, you need to start with a pattern of dots, These dots are used as the center point for the arcs that are drawn with the compass. When you look at the hologram, you see these dots being reflected in the arcs.
You can do the layout of the dots by hand, but it is a bit time-consuming. For the example hologram in this project, there were 159 dots. You can see the layout in the picture above. I decided to write a python script to take simple strings and turn them into a dot pattern for making holograms. Basically the script takes a string and converts them into vector graphics using the old style Hershey fonts. From these vectors, we the code then sample dot locations from along these curves.
To access this code, download the makedots_code.tgz file from above and unpack it. (This is a gzipped tar file from a Mac, but it should work fine in Linux or even in Windows.). Go into the directory that was created during the unpacking and edit the makedots.py code. You can change the string from the default "MTSU" to something else. I would suggest keeping this simple until you have some experience using the machine. You can also alter the size of the layout. There are some instructions in the code showing how this works.
I've include the full set of Hershey fonts and a code to read them. The Hershey code was developed using a lot of on-line resources and example codes, so I am not claiming authorship of this code or the associated data files. They were distributed without a license, so feel free to use them in your projects.
My Python code only works for strings, but it would be fairly easy to write a code that does this for any vector graphics file. I thought about adding this, but I wanted to get this project out so other people could play with it.
Just for testing purposes, you can completely bypass this step and use the sample "mtsudots.txt" file above. It is just a collection of x-y pairs that are used for the next step. As I mentioned, any data file with x-y pairs will do.
Making the G-code is also pretty easy. You just need to run the makegcode.py file with the dots text file as an input. There are more detailed instructions listed as comments in the code. Basically the code just generates a simple set of moves for each point in the dots file. For each point, the code:
1) Moves to the x-y position above the center of the dot.
2) Lowers the stylus to the plastic.
3) Triggers the servo to sweep clockwise using the "M8" mist command.
4) Pauses for 1.5 seconds to let the servo continue its sweep.
5) Lifts the scriber up from the plastic.
6) Clears the "M8" mist command, triggering the servo to return to its starting position.
7) Pauses for 1.5 seconds to give the servo time to sweep back to its default position.
This is an example of the G-code pattern that is repeated in the code.
- G1 X0.0000 Y1.0081 F45.0
- G1 Z-0.2500 F9.0
- M8
- G4 P1.5000
- G1 Z0.2500 F9.0
- M9
- G4 P1.5000
Everything in this code snippet repeats over and over again for each dot. The only change is the X and Y position associated with each dot.
The delays programmed into the G-code currently set to be 1.5 seconds. This is a bit longer than required, but it seemed prudent to be conservative in the beta version of the code. There is also a startup and finalize section of the code that followed examples I found for the X-carve. You might need to modify these for other CNC machines, but it seems the code seems to be fairly generic.
To get started, you can view an example G-code used to produce the MTSU hologram above. The file that made this is the mtsu.gcode file.
Perhaps my favorite part of this project was writing this simple g-code generator. It helped clarify how CNC machine really worked. Feel free to dissect the codes for your own projects.
Setting Up the CNC Machine and Creating the Hologram
Once you have the G-code file created, the electronics hooked up, and the scriber physically attached to the CNC machine, you are ready to try your first hologram. I used the Easel software from Inventables for this to send the commands to my machine, but the steps should be about the same for any kind of g-code sending software.
- Making sure your router is disabled, make sure you have taken the router bit out of the router. The power should be off and the cord detached from the wall.
- Set up a new project in Easel and then loading the G-code file from the disk.
- Clamp a piece of acrylic down on your board. Make sure it is tightly secured and larger than the pattern you are going to be making. For the example in this Instructable, I used 0.093 inch thick acrylic I bought at the local Home Depot. I purchased an 18x24 inch piece for about $12, and then cut a smaller 6-inch by 18-inch piece off using my table saw. You should remove the protective material from the side you are going to be scribing on before you tighten the clamps attaching the acrylic to the waste board.
- Once the acrylic is attached, click on the "Carve" button in the upper right of the Easel window.
- The Easel system will tell you the dangers of using someone else's G-code. Honestly, you should take this warning seriously. This is experimental software, so please make sure to monitor the operation all the way through the creation of the hologram. Be sure to have the cut-off button ready to push in case things go wrong! If you understand the risks, click on "I understand" and proceed.
- Double check that your material is securely held down, and click that "The Material is secure."
- Do NOT use the "Probe to Zero" on for this project even if you have the limit switches installed. The extra additions you have added to the machine may get in the way of the limit switches causing bad things to happen. Instead, choose "Manual".
- Using the position arrows on the right hand side of the screen, move the scribe position to the lower left area in your material. Once it has the correct x-y position, lower the scribe to the plastic. I use a note card to help me estimate the position of the scribe when it gets close. You can tell when the scribe is getting close to the surface by feeling when it grabs the cardboard. You will need to bring the scribe even lower so it will scrape into the plastic. You aren't zeroing it to touch the top of the material for this G-code, but rather to bite into the plastic. Honestly, this setting takes a little getting used to. I tend to use the 0.01 inch settings to step downward to the plastic to get a good fit. If you go too far down, the servo motor won't have enough torque to move the scribe. If you are too high, you won't make a deep enough scratch in the plastic. You have to experiment with this a bit. However - for your first time running the machine, I strongly recommend you keep the scribe well above the plastic and do an "air carve". It will allow you to follow the motions of the machine, check the limits of the plastic, and make sure everything is working before you do a full carve.
- Once you have set the initial X, Y and Z position, click that you have homed the machine.
- In the file screen, you need to click "raise the bit" to put the CNC in it's starting position.
- Skip the step of attaching and using the dust collection system.
- MAKE SURE THE ROUTER IS COMPLETELY UNPLUGGED, TURNED OFF, AND DISCONNECTED - then click that you have turned on the spindle. To be crystal clear, do NOT actually turn on the spindle. You need to click these buttons without activating the spindle.
- Did I mention that the spindle shouldn't turned off, unplugged, and disconnected? Well.. make sure it is turned off, disconnected, not running, and unplugged - and then click on the "The spindle is on" button.
- Click "Carve!"
And away we go!
Creating the Hologram
Over the next hour or so, the machine will repeat the same basic pattern of lowering the spindle, making a scratch, raising the spindle, and then moving to a new location. If the servo isn't sweeping, double check the LED's and make sure the Arduino program is triggering correctly. Hopefully you started with an air-carve (the as suggested in the previous step) to help debug the hardware problems you might have. If things aren't working, you may need to check for loose connections on the prototype board.
If everything is working, you should see this pattern of lift-reset-move-drop-scribe repeat over and over. The video above captures this nicely. If you find that the scriber is not actually scratching the acrylic, you may need to abort the carve and reposition the z axis offset to be a bit closer.
During the carve, you won't see very much emerging from the machine other than a series scratched circles.
When the carve is finally done, remove the plastic piece from the CNC machine and take it outside into the sunlight. (Or... find a place with a single bright lamp on the opposite side of the room.).
Viewing Your Hologram
To view your hologram, you need to have a bright point-source of light. The Sun is ideal, but a bright light bulb on the far side of the room would work fairly well.
First, remove the protective plastic on the back of the acrylic and tape a piece of black paper to the backside. This isn't strictly necessary, but it will help you see the pattern from the reflections more clearly.
Place the plastic sheet down on a flat surface, and the adjust your position you use see light reflecting from the scratches in the plastic. You do NOT want to see the sunlight reflecting directly off of the acrylic, just sunlight reflecting from the thin scratches. OBVIOUSLY - DON'T STARE AT THE SUN OR ITS DIRECT REFLECTION! IT WILL BLIND YOU! Light reflecting from the tiny scratches should be fine, so just reposition yourself to avoid the direct reflection of sunlight from the acrylic.
As you move your head back and forth above the scratches, you should see the letter patterns shifting across the arcs. The video above can help you see this. Basically, you are viewing these letters from different angles because of the way the reflection are mapped on these arcs. There isn't a single angle that makes this work. You should be able to see the reflections from many different angles.
You can also view the same effect using the acrylic as a transmission hologram. You let the light go through the acrylic, and watch the light reflecting from the back side of the scratches.
Once you have successfully created your first hologram, you can start experimenting to improve the machine. If you change the arc radius of the scratches, you change the apparent depth of the letters you see in the reflection. This can be easily done by mechanically moving the scriber needle further from the servo. You can also change the angular extent of the arc (by modifying the Arduino program), you can see it from different angles. You can also create software to generate other kinds of point patterns.
Ultimately it would be really cool to have the both the scribe radius and scribes angular extent controlled by the software. By doing these modifications and adding some software to generate the G-code, you could create true three dimensional objects and overlays that appear and disappear as you change your viewing angle. Making these modifications will be a bit difficult to do when your CNC controller has only two-bits of control lines (M8 "mist" and M9 "flood"), but it might be possible with some clever programming.
Please let me know what you come up with! I would love to see how this project is used for future projects.
I would like to thank Ben Becker and Neal McClain of the MTSU Walker Library for their helpful discussions when building this project.