I mainly used a mixture of the LEGO pieces that I kept from my childhood and the ones my son had accumulated through years of gifts received. Just had to order a LEGO servo motor and two additional power cables to avoid destroying the only cables we had.

Building the drivetrain probably took the longest time in the entire project. Challenges were:

  • I had a limited set of LEGO Technic pieces at hand and didn't want to bother doing a design and ordering pieces and waiting
  • I had a mixture of studded Technic bricks from my childhood and modern studless ones and I had to get creative to reconcile the different connection paradigms and orientations
  • I had to fit a servo and a regular motor in confined space

Ended up building the drivetrain with rack-and-pinion steering -- which in retrospect was a mistake because it gives the robot limited mobility.

We had an IKEA SMILA ladybug children's room lamp lying around and I decided to use it as the enclosure for the circuit as well as a finishing shell. It's not a cockroach, but it's at least a six-legged relative. This is what that product looks like:

I was happy with how it came together. I kept things modular/serviceable. Here's how the robot is dismantled module by module:

And here's a closeup of the drivetrain with two motors laid out perpendicularly:

I don't have any photos of it, but I also put two photodiodes where the eyes are.

The funny thing about this project: I'm a software programmer by profession. That's the part I should have spent the most part to make nice. I ended up spending 70% of the time playing with LEGO, 20% learning about Arduino and electronics and only the remaining 10% on coding. I got bored when I arrived at the last step of working on the code to let the robot actually, properly run away from light. Here's the entire code where the main navigation logic is:

if (maxLight < 0.05) {
    // Happily in the dark. Stop where you are.
    steerCenter();
    stop();
} else if (absLightDelta < 0.05) {
    // Not enough directional light difference to steer away, run backwards.
    steerCenter();
    back(1.0);
} else {
    // Run towards dark.
    if (lightDelta > 0) {
        steerLeft(1.0);
    } else {
        steerRight(1.0);
    }
    forward(1.0);
}

 Here it is in action, awkwardly and inefficiently steering away from light:

 And there's the underbelly:

Soon after, I disassembled the drivetrain to return the LEGO pieces back to my son.