Arduino & Lego PF Motors

Working through the book Arduino Workshop by John Boxall I’ve finally come to the chapter describing how to build an Arduino Tank Robot. However, instead of buying a premade robot chassis I decided to make it out of Lego Technic instead, something I played a lot with as a child.

This presented me with some interesting challenges, first of all, how to interface the Lego Power Functions motors with the Arduino. Luckily, I’m not the first one doing this stuff, and I quickly found a great blog detailing how to cut the motor cables. As I didn’t want to permanently destroy the great Lego set I had just bought (the 42042 Crawler Crane), I bought some new cables and an extra motor from Lego.

Preparing the cables was easy: cut them, strip and tin the two outer wires for the battery pack (+9V and GND), and the two inner cables for the motors.

Cutting the cables (Lego fans should look away!)

To check if it all worked, I built a quick circuit with a TIP122 transistor according to this Arduino tutorial (though a bit simplified, I didn’t really need the switch). It worked perfectly, and I was able to control the motor speed with some simple PWM code. Next step was to run 2 motors off the Adafruit motor shield. As you can see in the video below, it all worked perfectly.

Jump on over to the first entry of how I built and programmed my Arduino Lego Robot: Arduino Lego Robot – Entry 1.

Arduino Lego Tank Robot

Leave a Comment

Your email address will not be published.