Scanning the stuff from the last post
Here is a short video of the laser scanning one of the images from the last post.
Here is a short video of the laser scanning one of the images from the last post.
I have like 3 minutes of free time every day, so I wanted to hack together a prototype for something to convert images to laser-friendly data with a minimum of time investment. Here's the idea: I'll take an input image, apply the Canny edge detection algorithm, create beam paths from the edges and use that for my input.
Here is a Processing sketch using an open source Canny Edge detection library. (http://www.tomgibara.com/computer-vision/canny-edge-detector )
This gives us a map of places the laser should hit and places that it should not. We need to go from this to a beam path. Queue AutoTrace. It is an old image vectorization project (http://autotrace.sf.net ). It can take an input image and fit various lines and curves to the shapes of the image.
autotrace --centerline --output-format=svg ~/Documents/Processing/foo_test/car_edge_neg.png >car.svg
The output here contains a path consisting of commands with the functional equivilant of moveTo, lineTo, and curveTo. The last one is of course the most interesting - it's a cubic Bézier curve. This happens to be a parametric equation that can be evaluated to give you X and Y at a given time-step along the cuve. Here are a couple of images that I ran this proccess on. (I re-rasterized the vector image in these cases). Note: I tried to choose things that would be really easy to recognize here. The output doesn't always look this good.
The next step is to generate lots of little line segments from these points for my microcontroller...
I rebuilt my laser recently using some fresh galvos (still cheap Chinese - but with decent bearings this time) and an Atmega32u4 "Teensy" board. The new micro has native usb support - which will be important later. As before, it's a 405nm blue-ray diode hitting a surface covered with phosphorescent paint.
And then I dropped that into a box from Digikey.
And fixed a few other bits software. My LumixGF1 has a filter that blocks most of the 405nm light, so I can get pictures like this:
I got my Free Piston Stirling Cooler (FPSC) in the mail last Friday. It takes about 40Watts on a 12 volt rail to move two cylinders at about 80 Hz inside. They compress helium on the hot side and allow it to expand on the cold side. As you might guess, the cold side gets pretty cold.
The first shot at a cloud chamber was on Saturday night with Jas. We used an old food container that she had tried in a previous experiment and an Aluminum plate that I had in the junk box. Despite being made from stuff in the recycling bin, it actually worked...
That layer of insulation on the cold plate? It's just condensation.The proof of concept got me thinking - so I built another one on Tuesday. I used some .093" clear acrylic, a 6"x12"x1/8" aluminum plate, styrofoam, and some bits that I had lying around. I used a bit of black spray paint on plate to provide maximum contrast for the vapor trails and burned through a few sticks of hot-glue.
It took a good while to cool down once it was up and running, but the cold finger got to around -31c where I measured it. At full power this means it was pumping about 30 watts of heat transfer (according to the data sheets). The outermost edge of the aluminum plate hovered between -18 and -16c. This is a bit warmer than I would have liked, but it worked a lot better than the last attempt... Sorry about the crappy video quality; I'm hoping to try this again with a better camera soon:
It's a Free Piston Stirling Cooler module from Global Cooling and I just ordered it. It's a heat pump that using the adiabatic compression and expansion of helium (the closest thing to an ideal gas that we can come up with) to move heat from one side to the other. It's rated for 40 watts of power - and that's a lot more than 40 watts of heat transfer across a moderate temperature differential. It's riddiculiously efficent.
And it's a controlled device: It turns out that these are useful for cooling IR sensors for heat seeking missiles. This means you have to fill out paperwork to buy an OEM module. Strangely enough, they aren't regulated once they're in consumer devices. (See: Coleman Stirling Cooler)
I've got all kinds of plans for this, not the least of which is a new diffusion type cloud chamber. And for your entertainment, here are some Polaroid shots of previous cloud chambers that I've built with Jas:
(Part 9 of laser project).
And I've discovered why everything looked so funny previously. It was flipped. Okay, you probably couldn't tell the difference. (But now you can.)
Here is Lena (Wikipedia) as seen through my laser display system in 128x128 by 4 bit goodness. Lena is a standard test image in the computer graphics industry that came from a 1972 Playboy centerfold.
And here are a couple of youtube clips. Forgive the fact that they were recorded _before_ I discovered that I was scanning a flipped image.
(Part 8 of laser project)
I have scanned my first 4bit depth image.
This will look way cooler when the sunlight isn't messing with the image. I'll try to post better pictures tonight when I get back from San Francisco.
Unfortunately I'm having a lot of trouble with one of the galvos. Specifically, the one with the weird bearing sometimes just doesn't scan (no, it's not the signals). I'm hoping that goes away, but realistically I'm in the market for a new set. (Wish me luck on my job interview today, these things ain't cheap.)
(Part 7 of laser project)... but in Soviet Russia, laser circuit reorganizes you!
I have just assembled all of the major components of the laser display system and added some basic safety and control inputs. It turned out to be a veritable tangle of wires and components. As soon as I can verify that everything works, I think it might be time to place an order with Pad2Pad or BatchPCB. (Any suggestions here?)
I now have 4 working DACs, three new buttons, and a status light. In theory, nothing will turn on until the start button is pressed, the laser control connected through a momentary (for now) switch, and the stop button triggers an interrupt that will shutdown the laser and center the galvos. Since the laser control board can do analog modulation, I'm hoping to start scanning 16-value gray^H^H^H green-scale tonight.I also realized that using an LM7805 for my 5volt rail from the 24volt rail is not the greatest idea. It has to burn off 19volts * however many milliamps the laser and dacs are pulling. This adds up to more heat that the package can dissipate comfortably. I'm currently powering that bus from USB, but I think I'll wind up getting a little buck converter or driving my components from a small ATX power supply.
I have also verified the need for a second proper workbench.
Yesterday I wrote an image compression script for the laser project using Python and ran into a slight problem with recursion depths. This algorithm is easy to write iteratively but looks cooler when written recursively.
This process works when there are a few hundred blocks. More than that and there are too many levels of recursion for Python to handle. Python keeps a big stack frame for each call until the deepest call is complete. Too many calls and you're out of stack space. Some languages (most of the Lisp family) get around this by optimizing tail recursion. To illustrate the issue, here's a very simple example that prints out a set number of ones. It works when x is 100 but falls over when it is 1000:
Rather than rewrite this code to run iteratively ("for each chunk, squeeze chunk....") I implemented a little hack; technically it is called continuation passing usinging the trampolining of thunks. In this case, the function "tail" is a trampoline; each lambda "thunk" involving the _ones function bounces off of it (in the while loop) until the returned object is no longer callable.
I can just imagine a bunch of blobs of code doing work while jumping up and down on a little trampoline...
(Note: I restyled the example because I thought this looke pretty clean).
Or space invaders will ruin you.
(Brought to you by Katy, Chris Agerton and Jon)