Sunday, November 9, 2008

Vectorizing



It kept bugging me that my Voronoi code didn't return anything but an image to double check, so I figured a way to go ahead and make it output SVG format paths. I also added some routines to help further simplify the paths, though the output still seems a bit rough. And it was a good thing to check my results, because the simple lengthening of segments somehow resulted in gaps in the path, the sort of thing that would ruin a circuit board. For now I just commented that part out and substituted code that checks if a line is trending in a direction, and then double checked against the error (measured as the sum of the distances from the proposed line to the pixels that would be removed).

I suppose that using Haskell for this might seem like an odd choice, but I'm more familiar with it than Python. The SVG image in this post should show up fine in Firefox. If your browser has trouble with it I'm sure you can Google around an get SVGs to display.
Vornoi.hs

Monday, October 27, 2008

Voronoi

After seeing Forrest Higgs working on using Voronoi isolates (a version of a Voronoi diagram that starts with lines instead of points) I was inspired to write a similar program which turned out well. The basic algorithm is to expand pixels around a color coded line until it meets another color. If a pixel is neighboring more than one color it gets painted black, rinse and repeat until there's nothing white left.

It was a bit of a struggle to get PNG images edited in Haskell, but eventually I realized that pixbufGetPixels isn't really returning an array, it's returning an array typed pointer to a pixBuf. This makes sense in a practical memory usage way, but it isn't what I expected from the context.

After that I vectorized the edges, that took quite a bit of thought. First line segments were created between the centers of adjacent black pixels, then segments were created from the center of black pixels to any corner of the black pixel where there was a color change between neighboring pixels, and lastly segments between differing colors. This left a bunch of empty sets, and repeated segments, which were filtered out. That resulted in about 4400 segments for this test image. The next step is to lengthen vectors that are near each other in the same directions. That reduced the number of segments for this test to about 3700, it probably could be much fewer if I hadn't limited the angles (0, 45, 90, and 135) or if the underlying lines were horizontal, vertical, and perfectly diagonal.

For now I can't go much farther without hardware to test on...

Voronoi.hs

Sunday, September 28, 2008

X Axis

The X axis is taking shape, I used an H shaped layout for the carriage, with drywall screws and skate bearings. There is no spring tensioner, the placement of the bearings press slightly against the rails, and there is enough give in the bed to fit it in without any play. This was accomplished by using washers as spacers between the end of the cross piece. With the two screws, after getting close to the right number of washers, the exact alignment is done by tightening or loosening the screws a small amount, this results in the end piece twisting, with a bit of finesse eventually it ends up being exactly right. The vertical alignment is simple by comparison, just use a single screw on the other end and tighten it, it should be no problem to force all four bearing wheels onto the track with the wood friction keeping the joint tight.


I also trimmed some plastic from the bed near the end to make clearance for the motor to be mounted to a threaded rod. There is a small tendency of the carriage to ride up out of it's slot, but when the rod is attached that will act to keep it from riding up. The profile of the rail should not matter much. The same setup should work fine with metal rod, pipe, angle iron, etc. Any profile where you have a straight inner surface, and a straight top surface.

Monday, September 8, 2008

Boxer Fan


I found a fan that looks a lot like a computer fan, but it's 110V and bigger. It was seized, so I removed the center from the bearings by persuading it with a hammer and a set. That released the blades and rotor. I cleaned away all the corrosion with emery paper, and sprayed it well with WD40. The bearings were still fine, so after pressing it back together the blades spun freely. I soldered a power cord to it and it runs OK; it's not too loud. I also rubber banded a 45 Gallon garbage bag to it to get an idea of the airflow, it filled the bag in five or six seconds, so it's probably about 60 cubic feet per minute.

Tuesday, September 2, 2008

Cooking with gas


I melted some more HDPE, this time I did it in the garage on a gasoline burner. I wrapped the plastic in aluminum foil to keep it from sticking to the pan. Then I squashed it flat between two pans and left some heavy chain on it while it cooled. I ended up with a 1/4" x 8" cookie of plastic sheet, it's mostly flat, and the foil is well stuck to it. I'm not sure what I'll use it for. Mostly I've just been cleaning and storing stuff from the pile. My second computer won't boot any more, it sat too long, or it needs a battery, and the power supply was always extra noisy, it locks part way through boot up usually. I wonder if this was related to the ethernet problem I had last month, even though that computer is off most the time. All the time now I guess, maybe I'll get a couple new power supplies, and try one in that. I need another computer for the garage anyways, so I can do the RepRap stuff there.

Tuesday, August 12, 2008

Router Table

The Craftsman router table I picked up at a garage sale had an iron top with no real way to mount my router, it probably was designed around some Craftsman router that can be adjusted easily without needing to remove the router. That's probably why it was for sale! The base table is made from salvaged lumber from a headboard. The router table top is just a 3/4" plywood board, replacement for the iron. I routed out a spot to set the router, and a couple of slots to mount the fence. The legs needed a few scraps of wood to screw into, the holes at the tops are horizontal, so they screw into the scraps, then the scraps screw into the top. The wing brackets needed a few new holes, originally they sat a bit higher, because the old table wings were thin sheet, but the center table was cast with ribs that made it thicker. With the new holes they match flush to the top, and the angle of the legs is still the same. Drilled holes on the ends for a screw as well. My router didn't come with a mounting plate, so I glued two pieces of 1/8" Plexiglass together, one of the sheets got a bit of starring where the glue was, I'm not sure if this was a chemical reaction to solvents in the glue, or if it was stress from shrinkage, it seems to be fine structurally, I'll just have to keep an eye on it if it worsens. Hopefully I'll figure lots of ways to put the router table to good use.

Monday, August 4, 2008

Stepper circa 1993


Had a good day shopping at garage sales, there was a community sale where you didn't need to drive very far between stops. I bought a Twain flatbed scanner that has a good 1.8 degree stepper motor, and a base with side rails about 19 1/2 inches (500 mm), the stepper moved a belt that was hooked to the carriage after looping around a geared belt idler. The carriage had a lot of torsional slop though, it only has one horizontal keeper bearing on one side, and the other side has two, forming a triangle, but they are both on leaf springs, so it's free to twist. It'll probably be better to build a carriage than to re-purpose the old one. The stepper has a reducer gear hooked right to the mounting bracket, if I can figure out a way to mount the output gear to a threaded rod it would have very good resolution, there is very little slop in the gears, you can feel the slop a bit by touch, but it isn't visible enough to measure. The scanner also had a power supply that has 5v 2A, 15v 1.5A, +12v 0.3A, -12 0.3A, it's probably good enough to power a few more motors, and it's dead quiet, and slim-lined along the side of the case. This stepper was run from another ULN 2003A Darlington array, though it's a six wire stepper, so it should run from the Stepper Motor Driver 1.1.

Also got a nice shelving unit, so the giant pile of junk in the center of the garage is starting to get a bit smaller as I organize everything, hopefully it will soon all look like I meant it to be that way. It took a while to re-assemble the shelving because of the gravel floor, so it needed attached to the wall despite being a free standing shelf. Plus there was stuff in the way, but now most of that is on the shelves.

And I got a router table, once I get my router hooked to that it'll be a lot easier to build a RepStrap.

And I found some sort of lathe looking thing, If I can figure a way to attach a chuck I'll be able to make the non-printable extruder parts.

Later I salvaged some bearings from a set of inline skates, (14 of them, 2 are bad). The skates are from Goodwill, they had a large pile of skates.

Total cost of RepRap related stuff was $11, though the router table and shelf ran another $20.