Grid Beam Workbench

February 26th, 2009 § 4 comments § permalink

Grid Beam is a building technique developed in the 70’s. It is a simple technique which uses perforated square beams, connected by normal furniture bolts. I first learned about the technique from the book How to build with Grid Beam by new society publishers:


While the book is more of an history of grid beam, it does have some techniques and discussion on design. I think the technique has huge potential as a reusable building method

In need of a Dirty workbench, I decided to build a ‘stick’ making jig and attempt to build a bench. I was surprised by a few things:

  1. Beam stability is a function of the species, not the holes
  2. Hole accuracy is important, but not a deal breaker – the bolts pull the beams together nicely
  3. It takes about 20 minutes to drill a 6 foot beam – not including finishing touches like chamfer

Here’s my bench:



Why is my home so Drafty?

February 22nd, 2009 § 3 comments § permalink

Couldn’t be the new Windows could it?

Front Door has a 1″ gap:

Here’s the thermal:

New Windows:

No more gap:

Smart home improvement

February 21st, 2009 § 6 comments § permalink

Our home is expensive to heat. Not only is that, but it feels drafty. We were convinced that our main heating problems were the Windows in our family room (where the thermostat is) – all were replaced without any effect.

Annoyed, we needed to find a way to pinpoint our homes problems. We turned to Thermal Imaging by Northwest Infrared to help us understand the problems. I am very impressed and highly recommend their service. I believe this is the single best thing that can be done to your home. It is inexpensive and pinpoints phantom energy loss. Northwest Infrared only does energy evaluation – you’ll get brutally honest information without the sales pitch.

Thermal analysis is a two step process:

  1. Depressurize the home taking accurate barometric measurements to determine how much leakage there is.
  2. Use a thermal imager to see where cold air is leaking into the home.

Common Problems

Attic access not sealed well:

Pipe cutouts are huge openings to the crawl space:

Downdraft vent in the cooktop isn’t sealed or baffled:

Return air vent uses the floor joists instead of being ducted – drawing lots of air from the ‘area between floors’

– And in our case those floor joists are open to the outside!

Check out this ghostly image:

Our Unique Problems

Our new windows weren’t sealed correctly (you can bet we’ll be bringing that up with Anderson Renewable):


Our vents aren’t sealed correctly:

Our worst offender is our heating room which is open to the crawl space. This room is essentially outside, but not insulated like it is an inside closet:

Just a dog



I took some video during the process:

avr-libc realloc ‘fix’

February 11th, 2009 § Comments Off on avr-libc realloc ‘fix’ § permalink

I’ve been working on patterns for Arduino, which relies on a dynamic array for managing event loops, observables, and device abstraction. However, I was blocked by a critical failure in realloc. While I could have worked around it using malloc/free, but wanted to understand what was going on in libc.

One thing that struck me about realloc was the naming conventions; What was the difference between fp1, fp2, cp1, cp2? Some referred to a free block, some referred to a free pointer. I gave up and renamed the variables to something more readable.

The fatal flaw has to do with mixing sizeof(__freelist) and sizeof(size_t). In many cases, the difference results in indexing into the middle of a free list entry, thus corrupting memory.

(compare to avr-libc/libc/stdlib/realloc.c)

void* realloc(void *ptr, size_t newLength)
    struct __freelist *currentBlock, *nextBlock, 
        *currentFreeBlock, *previousFreeBlock;
    char *currentPointer, *nextPointer;
    void *memp;
    size_t largestBlockSize, sizeIncrease;
    /* Trivial case, required by C standard. */
    if (ptr == 0)
        return Malloc(newLength);
    currentPointer = (char *)ptr;
    currentBlock = (struct __freelist *)
         (currentPointer - sizeof(size_t));
    nextPointer = (char *)ptr + newLength; /* new next pointer */
    if (nextPointer < currentPointer)
        /* Pointer wrapped across top of RAM, fail. */
        return 0;
    nextBlock = (struct __freelist *)(nextPointer - sizeof(size_t));
     * See whether we are growing or shrinking.  When shrinking,
     * we split off a chunk for the released portion, and call
     * free() on it.  Therefore, we can only shrink if the new
     * size is at least sizeof(struct __freelist) smaller than the
     * previous size.
    if (newLength <= currentBlock->sz) 
        /* The first test catches a possible unsigned int
         * rollover condition. */
        if (currentBlock->sz <= sizeof(struct __freelist) ||
            newLength > currentBlock->sz - sizeof(struct __freelist))
            return ptr;
        nextBlock->sz = currentBlock->sz - newLength - sizeof(size_t);
        currentBlock->sz = newLength;
        return ptr;
     * If we get here, we are growing.  First, see whether there
     * is space in the free list on top of our current chunk.
    sizeIncrease = newLength - currentBlock->sz;
    currentPointer = (char *)ptr + currentBlock->sz;
    for (largestBlockSize = 0, previousFreeBlock = 0, 
         currentFreeBlock = __flp; currentFreeBlock; 
         previousFreeBlock = currentFreeBlock, 
             currentFreeBlock = currentFreeBlock->nx) 
        if (currentFreeBlock == nextBlock && 
            currentFreeBlock->sz >= sizeIncrease) 
            /* found something that fits */
            if (sizeIncrease <= currentFreeBlock->sz + sizeof(size_t))
                /* it just fits, so use it entirely */
                currentBlock->sz += 
                    currentFreeBlock->sz + sizeof(size_t);
                if (previousFreeBlock)
                    previousFreeBlock->nx = currentFreeBlock->nx;
                    __flp = currentFreeBlock->nx;
                return ptr;
            /* split off a new freelist entry */
            currentPointer = (char *)ptr + newLength;
            nextBlock = (struct __freelist *)
                (currentPointer - sizeof(size_t));
            nextBlock->nx = currentFreeBlock->nx;
            nextBlock->sz = currentFreeBlock->sz -
                 sizeIncrease - sizeof(size_t);
            if (previousFreeBlock)
                previousFreeBlock->nx = nextBlock;
                __flp = nextBlock;
            currentBlock->sz = newLength;
            return ptr;
         * Find the largest chunk on the freelist while
         * walking it.
        if (currentFreeBlock->sz > largestBlockSize)
            largestBlockSize = currentFreeBlock->sz;
     * If we are the topmost chunk in memory, and there was no
     * large enough chunk on the freelist that could be re-used
     * (by a call to malloc() below), quickly extend the
     * allocation area if possible, without need to copy the old
     * data.
    if (__brkval == (char *)ptr + currentBlock->sz && newLength > largestBlockSize) 
        nextPointer = __malloc_heap_end;
        currentPointer = (char *)ptr + newLength;
        if (nextPointer == 0)
            nextPointer = STACK_POINTER() - __malloc_margin;
        if (currentPointer < nextPointer) 
            __brkval = currentPointer;
            currentBlock->sz = newLength;
            return ptr;
        /* If that failed, we are out of luck. */
        return 0;
     * Call malloc() for a new chunk, then copy over the data, and
     * release the old region.
    if ((memp = Malloc(newLength)) == 0)
        return 0;
    memcpy(memp, ptr, currentBlock->sz);
    return memp;

avr-libc – Realloc bug

January 30th, 2009 § Comments Off on avr-libc – Realloc bug § permalink

A few months ago I proposed a refactor for the Arduino RepRap firmware. I was quick to code it up and build test cases on the desktop, then ported to the Arduino… Where it failed miserably. There the code languished as I spent time on it here and there. I attempted getting SimulAVR working, but it doesn’t support the Arduino chipsets (thought about adding support). I tried AVR Studio in a bootcamp’d windows install, but it kept hanging when debugging this problem. As a last resort, I ported the avr-libc memory apis to the initial desktop refactor, and was able to see the problem clear as day. I spent some time reducing the repro to the smallest form:

void testMalloc()
    size_t* array = (size_t*)malloc(4 * sizeof(size_t));
    array = NULL;

    array = (size_t*)realloc(array, sizeof(size_t));
    array = (size_t*)realloc(array, 2 * sizeof(size_t));
    array = (size_t*)realloc(array, 3 * sizeof(size_t));
    realloc(array, 4 * sizeof(size_t));

There is a bug in the free list manager in Realloc, specifically when growing a buffer into the next free entry. I was convinced I had a bug in a fairly large codebase, and whittled it down to this reproduction. I’m now playing with a couple of fixes, but need to figure out how to get a ‘blessed’ fix into lib-avr.

Stepping through the malloc into the free results in:

00000010 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000

Over the first realloc:

00000008 00000000 00000000 00000004
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000

Over the third:

0000000c 00000000 00000000 00000004
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000

And finally:

00000010 00000000 00000000 00000004
00000000 FFFFFFFC 00000000 00000000
00000000 00000000 00000000 00000000

At this point the free block pointer (__flp) points to the second line, with a size of 0xfffffffc. The next allocation fails.

First Grid Beam

January 22nd, 2009 § Comments Off on First Grid Beam § permalink

I’ve created my first grid beam using the grid beam jig I posted about. It took me about a half an hour to cut beam holes in an 8 foot beam. Like others, I’m curious if the number of holes will compromise the beam…

Only 5 more to cut.

Arduino for TextMate posted (beta)

January 12th, 2009 § Comments Off on Arduino for TextMate posted (beta) § permalink

I’ve added a page for the Arduino for TextMate plugin. Download from the dedicated page.

When we last left our hero…

January 11th, 2009 § Comments Off on When we last left our hero… § permalink

The problem with multitasking is that your time is divided amongst all the projects you have going on. Not only divided, but context switching has overhead. Because of this, and the limited shop time, I haven’t made much progress on any one area to warrant separate posts, so I’ll recap.

Cold Garage


The Cool Tools blog had a recommendation for the Dyna-Glo pro heater. Their usage was similar to mine, so I decided to try it. I have to say – while it heats up the place in no time, it is loud and smelly. But the garage is now usable until I can insulate it and install something more permanent… (Although my father says “There is nothing more permanent than that which is temporary”)

Grid Beam Bench (and experimental cartesian bot?)

At Maker Faire last year, I came across a neat display about Grid Beam. Basically this is a large scale wood erector set which involves 2×2 sticks of standard lengths, with a repeating hole pattern. These beams are joined using furniture connector bolts. By joining 3 beams together, you create a very strong ‘tri’-joint, which not only is self squaring, but creates a very rigid body. In fact, it seemed more rigid than the plastic and aluminum joints I currently use. Could I use a wood frame for the cartesian bot?

A book was released a few months ago; Half of which is an anthology of grid beaming, the other half goes into a little detail about assembly. You can get it from New Society publishers: 


Using the lathe and mill has been slowly destroying my detail bench, where I do the electronics work and debugging. Task switching between metal work and detail work also slows down the whole process, so I decided to build a ‘dirty’ bench for the metal and wood work. It seemed like a perfect opportunity to try out Grid Beam building techniques.

My first foray into Grid beam stick construction were failures. There is no margin for error while cutting the holes, as errors propagate down the stick pulling them out of square very quickly. In order to drill accurate holes, I built a jig:


This is mostly a standard drill press jig. The main difference is in the holder – there is a custom delrin tapered plunger, which aligns and holds the beam prior to drilling. I’ve only drilled these sample beams for testing, so we’ll see how the hold thing goes together. I’ll post separately on this progress.

Arduino Plugin for TextMate

The arduino plugin for textmate has been taking much more time than it should. I’ve almost completely rewritten it in order to clean up the code, refactor based on ‘learnings’ about Cocoa, add multiple Arduino support, and allow the serial monitor to stick around while compiling and uploading. Many of the issues I’ve encountered were specific to TextMate (such as NSConnection issues), and some Leopard problems (NSConnection doesn’t like being created on two different threads). However, I’m tracking down the last issue (If you shutdown the serial monitor, you cannot restart it without restarting textmate. NSConnection doesn’t seem to have a way of saying is the server still alive). Expect a beta by end of the weekend.

RepRap firmware refactor

I had worked on a design and implementation of Arduino design patterns which I will leverage in the Refactor. However, I hit a bug which doesn’t reproduce on the desktop test client, so I believe it is a specific problem with the Libc on the Arduino. That project was put on hold until I got the hardware debugger.  I have it now, and it will be the first thing I work on after I release the new Arduino plugin.

Hercules Extruder

With Shop time limited, this has bubbled down the list. Since my implementation depends on the Firmware refactor, it didn’t seem a high priority.

The Prometheus Fusion Perfection blog has developed a laser cut Herk extruder. It looks VERY sweet:

Laser cut Herk

(If that person emails me their address, I’ll send a milled stainless steel barrel and extruder head.)

Laser cut Hercules Extruder

December 21st, 2008 § Comments Off on Laser cut Hercules Extruder § permalink

The Prometheus Fusion perfection blog has started working on a Laser cut Hercules Extruder. It looks pretty cool. I hope that the plastic can withstand the pinch forces involved with this. Keep an eye on it. 

(I’d love to give credit to the author of it, want to send me your name? I couldn’t find it on your blog).

Cold workshop

December 20th, 2008 § 4 comments § permalink

My workshop is in the garage – an uninsulated and unheated area. Currently the workshop is too cold to work comfortably or safely (I don’t want to get wrapped up in the lathe while wearing a ski jacket).

I’ve been looking into an electric heating and cooling solution. I haven’t found anything that can cover the whole workshop area of about 1,000sft. Most portable heating and air conditioning units top out at about 400 sqft. Either I need to partition the area, or look into something that will work over the whole area – maybe a heat pump for a small house or condo. It would also be nice if I can wall mount it, so I don’t take shop floor space… 

Got any suggestions?