OpenSCAD linear extrude that interpolates between two shapes

Full source code is available for this thing on thingiverse.

OpenSCAD has proven to be an easy to use and flexible tool, but at times I'm left scratching my head to figure out ways around its limitations. In this case I had two squares with rounded corners, their sizes and the corner radius for both squares are configurable. Now I wanted a square tube to join these two pieces together.

Final shape
My hope was that I could get it close enough with some fancy parameters piped into the OpenSCAD linear_extrude function. It seemed possible since there are some pretty fancy parameters regarding rotations and twists. After checking out the documentation it didn't look like there was anything that would be close.

For this project I found a module by Felipe C. da S. Sanches to create squares with rounded corners. I'm sure there are many like it, but this was the first one I found and it worked as advertised.

So made a little module using this which wraps around a rectangle for one side, and another which fits into a rectangle for the other side:

This simply creates a rectangle with rounded corners and subtracts a slightly smaller rectangle from the middle, then extrudes the whole assembly some height. This piece goes around a rectangle with square corners, so the inside has square corners. Then I created a second tube designed to fit into a rectangle with rounded corners, so the outside of this tube must have rounded corners. After spacing them out I get something that looks like this:
Multiple rounded rectangles

This is where I realized I need some fancy function to extrude the bottom shape into something which meets up with the upper shape. The solution I ended up with works the same way as the 3D printer I'll print this object with: slice it up into multiple extrusions. For each extrusion I interpolate the inner radius, outer radius, width and length depending on how far into the overall extrusion we are.

With this I can now create a shape which connects my two adapters. The final product printed out nicely:
Printed object
Finished product!

Installed adapter
Fits perfectly.

A week of 3D printing with the OrdBot Hadron

It has been about a week since my OrdBot's first successful calibration print and it seems like a good time to write down some of my initial problems, experiences and solutions. However before I get into that a review of my 3D printer stack.

OrdBot Hadron
3/8"-12 TPI ACME Z-Axis screws
1.8 degree Nema17 X/Y motors
1.8 degree Nema23 Z motors
Qu-bd MBE Extruder (with some modifications)

AzteegX1 v1.0 (644P processor)
Lava heatbed, I have only used PLA at this point so this is still disconnected.

Marlin firmware
Slic3r v0.9.9
Pronterface (March 2012 release)
Repetier-host Mac (0.56, lower versionthan linux/windows releases for some reason)

Now for the problems encountered during the past week, approximately in the order which I ran into them.

Pololu A4988 - I have used these before on my ShapeOko CNC machine. They have been so reliable that I completely forgot how to set them up, as such I blew up 3 drivers while setting up the electronics. So be careful, check the polarity and for the love of everything don't measure voltage when your multimeter is in continuity mode!

Leveling the bed - This was tedious but not particularly difficult. The LAVA heatbed has 8 M3 screws along the perimeter so calibration was just a matter of carefully tightening them until the height is just right. To measure the height I lowered the printer nozzle until it had just enough space for a piece of paper to slide underneath with little resistance, at this point I manually jogged the nozzle along the perimeter adjusting the M3 screws as necessary until the bed was level.

Setting the Z-Axis endstop - This step is ongoing and was very tedious without a way to precisely raise or lower the endstop actuator (a screw in sliding t-slot nut). I have it set fairly close, but still find myself hitting the "stop motor" button and manually turning the Z-Axis screws while the first layer is printing. Eventually I will print out something like this and dial in the Z endstop a more reliably.

Configuring steps per mm - This was the longest part of the process, and I'm still not sure why. Fortunately it wasn't difficult, just tedious. I know the steps per revolution on my motors (200), the microstep resolution for the steppers (16x), the pitch of MXL belts (2.032mm) and the number of teeth on the pulley (16). Using the equation on the configuration page gave me a number which ended up being way too small. My calibration object of choice was the nickel test thing on thingiverse, I just kept printing them out, measuring the insides and adding a ratio multiplier until satisfied that things were the correct size.

Pololu A4988 overheating - Once I had my machine calibrated I started trying to print larger objects that took more time. Without fail after 5-10 minutes after starting the machine would start losing steps. Eventually I noticed how hot the stepper drivers were and mounted a fan pointing at them which fixed the problem.

The notorious QU-BD MBE. This thing gave me a ton of trouble, so much so that I ordered a J-Head after the first day of trying to get it up and running. That said I've managed to get it to print very reliably and haven't yet felt the need to install the J-Head.

QU-BD pre-upgrades - Before I even had my printer assembled I performed some upgrades on the QU-BD. First is the QU-BD Modification Kit from the MakerSlide store. Secondly I hobbed the stock raptor gear with a small tap in my electric hand drill.

QU-BD overheating jam - There is a fan and heatsink on the extruder. I wired it (incorrectly) to the Azteeg X1 fan input, making it configurable in gcode (M106 and M107). My slic3r configuration toggled the fan on and off, so occasionally the cold-end of the extruder was heating up too much causing a jam. My current solution is disabling the cooling option in slic3r, but eventually I will wire the fan directly to the 12v input.

QU-BD underheating jam - My printer is in the kitchen and there is a nice crossdraft going through the room now that it is nice outside. The crossdraft was causing the nozzle to drop below 165 degrees, when this happens things usually jam. I need to wrap the hot end in some sort of insulation which will hopefully fix this problem.

QU-BD slicer jam - While printing the nautilus gear thing I was noticing frequent jams during the infill stage. The thing about this object was that there was very little amount of infill needed so the filament moved very slowly. My best guess is that the filament was sitting in one place so long that it heated up too high in the extruder which caused the jam. After reconfiguring slic3r to leave the object hollow there were no more jams on this print.

Pronterface vs. Repetier-host - This could probably be a blog post on its own. They both work but suffice to say that repetier-host is leaps and bounds ahead of pronterface in terms of usability. The one problem I had was that repetier-host allows you to configure the controller buffer size, the default is 63 which causes stuttering when printing complex surfaces with short line segments. I upped this value to 127 when I was 75% finished with the owl print (below) and you can tell just from looking at the surface of the model where I made that change because the surface quality improved dramatically. I just wish I had found that setting before printing all those feathers!

This owl is my longest print to date at 3 1/2 hours. This print was running while a draft was running past the printer, I probably fixed 5 or 6 jams while it printed which caused a several noticeable defects (most of them on the owls back).
3D Prints

After many attempts I finally got the Nautilus Gear to print. Now that everything is dialed in I could print one out in about an hour (~12 minutes for the two clips and ~18 minutes per gear).
3D Prints

Building an OrdBot 3D Printer

I've been a fan of MakerSlide ever since building my ShapeOko CNC Mill, and have been interested in 3D printing since first hearing about the RepRap project in 2007. So when I first saw the OrdBot, I knew that it would be the printer I build. It didn't hurt that I had 10 feet of extra MakerSlide and a whole bunch of the special bearings and eccentric spacers left over from my ShapeOko build.

One of my goals was to build all the custom parts myself, the blue and black pieces in the photo above. Cutting aluminum on my new CNC machine pushed it to the limit, but worked out in the end. One of the larger OrdBot pieces is the handle, here is a shot of the ShapeOko making short work of it:

Ord Bot Handle

There are a couple parts that I modified or upgraded during the build. Most notably the Z axis. After reading about bent Z-rods I decided to get some ACME rods, and I wanted to use some spare Nema-23 motors that I had on hand.

The NEMA-23 motors for the Z axis were easy, I slightly modified the stock motor part to fit the new motor:
Ord Bot Modified Z Mount

Attaching the ACME rod was a little trickier, but managed to hand fabricate a bracket with some 1/8" thick angle aluminum:
Ord Bot Modified Z Mount

In the spirit of being thrifty, I signed up for one of the (now notorious) Qu-bd extruders during their kickstarter campaign. So far I've managed to get the extruder to work with a couple of simple motifications. Some more hand fabricated mounts and I had the extruder attached:
Ord Bot Qu-bd mount

For the electronics I am using one of the first generation Azteeg X1 boards. So far I've been very happy with it (save for an exciting wiring mistake where I had the polarity backwards). I opted to run the wires through the hollow MakerSlide extrusions whenever possible. Here is the nearly completed wiring, I really appreciated the zip-tie holes:
Ord Bot Wiring

After a few days of tweaking and calibrating, I'm getting some nice results. Here are some action shots with the machine up and running:
OrdBot in action

OrdBot in action

OrdBot in action

OrdBot in action

OrdBot in action

ShapeOko CNC Mill

April of 2012 I signed up for the first batch of ShapeOko kits from Unsure of how popular the kit would be, inventables had a kickstarter-style order of 150 (or so) kits. That number was reached handily and several more batches followed. Since then the ShapeOko has become a standard item in their store.

I've wanted a CNC mill for a long time, but could never justify the expense. Now there are products like the MakerSlide linear rail system that made it possible for low cost machines. The first round of kits were only $200 for the entire mechanical platform - add your electronics and a dremel tool and the machine can start cutting.

So thats what I did.

The stock kit plus motors after assembly:
Assembled ShapeOko Front

One of the nice things about the ShapeOko is how hackable it is. For instance if you want to make the cutting area larger you can just replace the MakerSlide with longer rails. So I added longer rails, a second Y-axis motor, a torsion box to mount everything on, a bigger router and some woodworking T-slot to hold work. Here is a picture of the machine a few weeks ago while cutting a large aluminum part for another project:
Ord Bot Handle

The current cost of the machine is $663.75, that includes all components bought for the machine regardless of whether or not they were used and shipping. So far I've spent another $150.55 on endmill of various sizes for for cutting various materials.

Projects Past: The 2009 Automatic Cat Feeder

In 2009 I took a week off from work to build an Automatic Cat Feeder to ration food to the overweight household cat. This was a project built from need and it had a deadline because my girlfriend and I were heading out of town for Thanksgiving.

The requirements were simple: It needed to be easy to refill and dispense the correct amount of food twice daily. Early on I had an idea for a large rotating drum to dispense the food, it needed to be easily removable for refilling and heavy enough that it could sit on a motorized wheel and cause enough friction to be turned.

Figuring out a latch mechanism that dropped the correct quantity of food after one rotation was the first tricky part. I didn't want any electronics on the drum so it had to be completely mechanical. In the end I hot glued a small box to the outside of the drum which filled during rotation, when it started moving back towards the top a tab would be hit to fling a door open and drop the food out. A magnet held the door shut and gravity would shut the door  when the box made it back to the top. I'm extremely proud of this mechanism and it worked perfectly.

The dispenser mechanism! A marvel of engineering, hot glue, magnets and JB Quick Weld.

With all the details figured out, hacking it together turned out to be pretty easy. The hardware store patiently cut a sheet of 1/4" MDF into pieces for me which formed the box, and I was able to glue the pieces together with gorilla glue.  A small stepper motor and some electronics were harvested from a 5 1/4" floppy drive and I was able to control it with an arduino.  The program couldn't have been more than 50 lines, I figured out how many steps it took for 1 revolution of the drum through trial and error. Then coded it to do that every 12 hours.
The finished product. Seriously, we used it looking like this for several years.

The happy customer. My wife added a chute made from a mountain dew bottle.

I did make a couple upgrades after these shots were taken. The stepper motor died so I upgraded to sparkfun's cheapest stepper and an EasyDriver stepper driver. I also added a reed switch to the box and put a magnet on the drum so that I didn't have to count steps, this was needed because depending on how much food was in the drum it would sometimes slip and require a different number of steps to get back to the top.

Projects Past: The 2007 DIY Projector

I've had many projects over the years, the most involved by far has got to be my DIY projector.  It is also my first serious project. By the end of it I had vastly improved my knowledge of optics, electronics, woodworking, and even a little thermal dynamics.

Research started sometime mid 2007, the now defunct lumenlab forums had a whole community of people building DIY projectors. There is a lot of theory to learn, optics to figure out, components to buy, and bringing all the pieces together is no simple task.  For such a complexe machine, at the core it has some very simple principles: A point light source radiates light into a fresnel lens, which straightens the light through the LCD screen, then another fresnel lens angles the light into a special lens which can focus the light on a screen. Here is an image from engadget which demonstrates the light path:

The major problem with these sorts of projectors is that they tended to be very large. 1080p monitors at the time tended to be at least 19" diagonal, which meant the entire box would need to be 3-4 feet long! Fortunately there were a few entrepreneurial types who started sourcing LCD screens that were smaller and ideal for DIY projection and selling them directly from the manufacturers. I managed to get my hands on one such monitor that was only 10.6" and had 720p resolution. With the LCD picked out I was able to begin designing the enclosure around December 2007.

Other than the LCD, the most important component is the light source. Some of the brightest bulbs consumed 400 watts of electricity or more, and had very impressive results. But with such high powered bulbs came a lot of heat that needed to be dealt with. I ended up going with a smaller 150 watt bulb.

The final pieces were the fresnel lenses and the projection lens. These were a fairly standard item and lumenlab took a lot of the guess work out of things by selling them from their store.

My final design to incorporate all these parts was a two chamber design.  The top chamber had the optics.  The bottom chamber contained all of the electronics: The LCD controller, the light bulb components (transformer and starting capacitor), and AC adapters and a heat sensitive trigger which would keep the fans running until the heat in the box dropped far enough.

The enclosure was designed to be simple to build and easy to assemble. The parts were cut on my dads table saw, and pieces were laminated together so that components could slide in and out of the enclosure during assembly. This design worked nicely.
In this picture you can see all the electronics (minus the thermal switch) and the various slots for the LCD, fresnel lenses, and chamber separators.

The LCD and Fresnel Lenses were built into frames that could easily slide into the slots:
The LCD frame had special protection for the delicate flexible cables of the monitor electronics. The frames for the fresnel lenses were similar.

The light source needs to be precisely positioned for the light to focus properly, so this box was built with rare earth magnets on the bottom. It attaches to a metal plate in the box which can be seen in the upper left of this photo.

The back was hinged so that adjustments could be made as needed, here you can also see the light box in place.

The triplet lens is another clever mechanism I came up with, by building the box a little loose I was able to pad it with felt so that the lens carriage could slide in/out but still be held snugly in place. The slot at the bottom was for a holding screw, but ended up being unnecessary.

Fully assembled, on the left is a front surface mirror which allows the box to be 11" deep instead of  nearly 30.

The final result is big and ugly, but it worked and I used it for years. I'll never forget how surprised my girlfriend was when I plugged it in for the first time and an image, apparently she thought I was crazy for those 5 months. In the end it really did work nicely. Designing it was a lot of fun, but my craftsmanship really limited my options.

More pictures can be found on my flickr page: DIY video projector