ChatGPT, the Worst Summer Intern Ever [Hackaday]

View Article on Hackaday

Back when I used to work in the pharma industry, I had the opportunity to hire summer interns. This was a long time ago, long enough that the fresh-faced college students who applied for the gig are probably now creeping up to retirement age. The idea, as I understood it, was to get someone to help me with my project, which at the time was standing up a distributed data capture system with a large number of nodes all running custom software that I wrote, reporting back to a central server running more of my code. It was more work than I could manage on my own, so management thought they’d take mercy on me and get me some help.

The experience didn’t turn out quite like I expected. The interns were both great kids, very smart, and I learned a lot from them. But two months is a very tight timeframe, and getting them up to speed took up most of that time. Add in the fact that they were expected to do a presentation on their specific project at the end of the summer, and the whole thing ended up being a lot more work for me than if I had just done the whole project myself.

I thought about my brief experience with interns recently with a project I needed a little help on. It’s nothing that hiring anyone would make sense to do, but still, having someone to outsource specific jobs to would be a blessing, especially now that it’s summer and there’s so much else to do. But this is the future, and the expertise and the combined wisdom of the Internet are but a few keystrokes away, right? Well, maybe, but as you’ll see, even the power of large language models has its limit, and trying to loop ChatGPT in as a low-effort summer intern leaves a lot to be desired.

Lock Up Those Chickens

This chicken coop door needs a latch to prevent raccoons from sliding the aluminum door up. And yes, I could have built the whole thing from scratch, but I was in a hurry.

The specific task I needed help with was simple: a latch on the automatic door of my chicken coop. The details of why I need this are better left unsaid, but I will say that the latch is my attempt to deal with the cruel equation “11 Chickens + 1 Raccoon = 8 Chickens.” The first part for the latch that I had in mind was a simple bracket — something with two arms rising from a base that could be attached to the coop door (a sheet of 2-mm aluminum). This bracket will support a spring-loaded arm to engage a crossbar in the frame of the coop door, and hopefully prevent anything with clever little claws and a taste for take-out chicken from working under the lower edge of the sliding door and getting into the coop.

From my experience with Fusion 360, I knew it would be pretty easy to whip up a couple of sketches, extrude the arms up from the base, drill some holes, and tidy things up with the proper chamfers and fillets. The trouble with that is that I moved to Linux quite a few years ago, so Fusion 360 isn’t really a viable option. Yes, I know there are workarounds using Wine or VMs, but I’m also not interested in playing in Autodesk’s cloud. Of course, there’s FreeCAD, too; in fact, just prior to this project I had started fiddling with it, but I’m still in the early part of the learning curve and not terribly productive with it yet.

That final point gets to the crux of the matter, though. When I was learning Fusion 360, I found that it quickly became the case that perfecting the 3D model was mentally more important to me than what I was designing. I would spend hours getting everything just right, only to find out that something didn’t quite line up, or I had some constraint wrong, and I’d have to start all over again. I have every expectation that my mind will treat FreeCAD the exact same way, not as a means to an end but as the end itself. That’s a slippery slope, especially when there’s so much else I have to do.

The Mysteries of OpenSCAD

This is when I had the idea to outsource my design to someone — or something — else. Credit where it’s due; I got the idea to enlist ChatGPT after seeing [ROFLhoff]’s Hackaday.io project about repairing a broken Toyota speedometer. The project required a knob to easily spin the speed sensor that drives the speedo for bench testing. With just a brief description of the part needed, [ROFLhoff] was able to prompt ChatGPT to generate OpenSCAD code to create a model of the knob.

I thought that was pretty slick and decided to do the same. The bracket seemed like the best place to start, so I gave ChatGPT the following prompt:

My first attempt at getting ChatGPT to do my dirty work. Sorry if the units upset you — it’s how I think.

I know I wasn’t terribly specific — I didn’t say how far in from the corners the mounting holes should be, for instance — but I figured that was something I could tweak later. And besides, when you hand a job over to a subordinate, you should be able to just vaguely describe what you want, and let them run with it. Right?

Maybe not, because here’s what I got back from ChatGPT:

// Bracket dimensions
base_size = 1; // One inch square base
hole_radius = 1/16; // 1/8 inch hole radius
arm_width = 1/4; // 1/4 inch arm width
arm_height = 1/2; // 1/2 inch arm height
arm_gap = 1/4; // 1/4 inch gap between arms

// Base
base = cube([base_size, base_size, 1]); // 1 unit height

// Holes
hole_offset = hole_radius + 1/16; // Offset from base edges
hole = cylinder(h = 1, r = hole_radius);

// Calculate arm positions
arm_x = (base_size - arm_width) / 2;
arm_y = (base_size - arm_height) / 2;

// Arms
arm1 = cube([arm_width, arm_height, 1]); // 1 unit height
arm2 = translate([arm_width + arm_gap, 0, 0]) cube([arm_width, arm_height, 1]);

// Combine all parts
bracket = base - translate([hole_offset, hole_offset, 0]) hole +
          translate([hole_offset, base_size - hole_offset, 0]) hole +
          translate([base_size - hole_offset, hole_offset, 0]) hole +
          translate([base_size - hole_offset, base_size - hole_offset, 0]) hole +
          translate([arm_x, arm_y, 1]) arm1 +
          translate([arm_x, arm_y, 1]) arm2;

// Render the bracket
render(bracket);

Now, it’s important to note that at the time, I had even less experience with OpenSCAD than I did with FreeCAD. And by less, I mean zero — I’d never used OpenSCAD before. So the code ChatGPT created didn’t mean all that much to me. But it sure looked reasonable, especially to someone who used to code for a living — I could see all the parameters up at the top like constants, the calculations used to figure out where to put the arms, and the creation of the cylindrical holes. But I had no idea what translate was, and I couldn’t really see how the holes would be punched through the base.

Strictly speaking, though, that wasn’t my problem. In the ideal world, I would just copy the AI-generated code into OpenSCAD and get a 3D model ripe for tweaking, right? Perhaps, but in the reality-based world, I had no such luck. The code ChatGPT generated didn’t work in OpenSCAD — it just threw a syntax error on line 21. I told ChatGPT about the error and asked to have it fixed, but the code that came back was essentially the same and threw the same error. Disappointing.

If You Want Something Done Right…

At this point, I figured I had two choices: either keep fiddling with the ChatGPT prompt, or start learning enough OpenSCAD to figure out what ChatGPT was doing wrong. All things considered, the latter seemed like the smarter route, so that’s the way I went. It was quickly apparent that ChatGPT didn’t have the slightest idea how to program OpenSCAD — for example, note the complete lack of difference() commands, which are needed to make the holes, from the AI-generated code. This led me down the very rabbit hole I was trying to avoid, and I spent a few hours learning enough OpenSCAD to do the job myself:

// dimensions in mm [width, depth, height]
base_size = 25;
base_thickness = 3;
upper_size = base_size - 10;
upper_height = upper_size;
base = [base_size,base_size,base_thickness];
upper = [upper_size,upper_size,upper_height];
slot_width = upper_size/3;
slot = [upper_size + 2,slot_width, upper_height];
hole_dm     = 3;
hole_margin = 1.5;
axle_dm = 4;

module bracket() {
    difference() {

        cube( base );

        abs_margin  = hole_margin + hole_dm / 2;
        x_hole_dist = base.x - 2 * abs_margin;
        y_hole_dist = base.y - 2 * abs_margin;
        x_values    = [abs_margin : x_hole_dist : base.x - abs_margin];
        y_values    = [abs_margin : y_hole_dist : base.y - abs_margin];

        // holes
        $fn = 25;
        for (x = x_values, y = y_values)
        translate( [x, y, -1] )
        cylinder( d = hole_dm, h = base.z + 2);

    }

    translate([(base_size-upper_size)/2, (base_size-upper_size)/2,0])
    difference() {
            
        cube( upper );
        translate([-1,upper_size/3,upper_size/3]) cube( slot );
        translate([(upper_size/2),-1, (base_size/2)-2])
        {
            $fn = 25;
            rotate([-90,0,0]) cylinder(d=axle_dm, upper_size + 2 );
        }
            
    }
          
}
module latch() {
    $fn=25;
    difference() {
        union() {
            cube([35.5, (axle_dm + 5)/2,slot_width-1]); // main arm
            translate([35.5,(axle_dm + 5)/2 -0.8,0]){
                rotate([0,0,-185]) cube([(axle_dm + 5)/2, 10, slot_width-1]);
            }    
            translate([0,(axle_dm + 5)/2,0]){         // lever
                rotate([0,0,135]) cube([15, (axle_dm + 5)/2,slot_width-1]);
                
            }   
            cylinder(d=axle_dm + 5, h= slot_width-1); // pivot body
            
        }    
        cylinder(d=axle_dm, h=slot_width+1);          // pivot hole  
    }    
}

bracket();
translate([0,50,0])
latch();
Here’s what I finally came up with in OpenSCAD.

Was It Worth It?

Granted, my OpenSCAD code has both the bracket and the latch, but even accounting for the added complexity, I feel like ChatGPT’s first pass at doing what I wanted was half-assed at best. This is about the point where I realized that ChatGPT was behaving like an earnest and eager-to-please but somewhat clueless summer intern. Given the same instructions, such an intern might go off and spend a few hours Googling how to do the job, maybe hitting StackExchange or r/openscad for some help, and coming up with some code that they figured would do the job. That they didn’t even bother to see if OpenSCAD would interpret the code would be grounds for a Stern Talking-To™ with a meatspace intern; but with a virtual intern, what recourse did I have?

Honestly, although I didn’t get the magic help from ChatGPT that I was hoping for, this experiment in AI-assisted design wasn’t a complete loss. The original code may have been crap, but it at least gave me the impression that OpenSCAD programming wasn’t entirely foreign territory for me; flawed though it was, I could see that it’s just a combination of coding and 3D modeling, and intuitive enough to take a stab at. So now I know just enough OpenSCAD to be dangerous, all thanks to ChatGPT — the worst summer intern ever.

And as for the coop door latch, that project went in an entirely different direction once I realized that I could make the bracket and the latch from bent sheet aluminum — which forced me to learn not only FreeCAD but the Sheet Metal workbench as well. So ChatGPT actually forced me down two rabbit holes I’d hoped to avoid.