Recently my 4 year-old stepson saw a kid with an RC racing car in a park. He really wanted his own, but with Christmas and his birthday still being a long way away, I decided to solve the “problem” by combining three things I’m really passionate about: LEGO, electronics and programming.

In this short series of blogs I’ll describe how to build one such car using LEGO, Arduino and a bit of C++ (and Qt, of course!).

LEGO

Obviously, we will need some LEGO to build the car. Luckily, I bought LEGO Technic Mercedes Benz Arocs 3245 (40243) last year. It’s a big build with lots of cogs, one electric engine and bunch of pneumatics. I can absolutely recommend it - building the set was a lot of fun and thanks to the Power Functions it has a high play-value as well. There’s also fair amount of really good MOCs, especially the [MOC 6060 - Mobile Crane by M_longer][lego-moc-6060] is really good. But I’m digressing here. :)

!(arocs)

The problem with Arocs is that it only has a single Power Functions engine (99499) and we will need at least two: one for driving and one for steering. So I bought a second one. I bought the same one, but a smaller one would probably do just fine for the steering.

!(engine)

I started by prototyping the car and the drive train, especially how to design the gear ratios to not overload the engine when accelerating while keeping the car moving at reasonable speed.

!(image-prototype)

Turns out the 76244 Technic Gear 24 Tooth Clutch is really important as it prevents the gear teeth skipping when the engine stops suddenly, or when the car gets pushed around by hand.

(!clutch-cog)

Initially I thought I would base the build of the car on some existing designs but in the end I just started building and I ended up with this skeleton:

The two engines are in the middle - rear one powers the wheels, the front one handles the steering using the 61927b Technic Linear Actuator. I’m not entirely happy with the steering, so I might rework that in the future.

Controlling the Engines

We will control the engines from Arduino. How to connect the LEGO Power Functions to an Arduino? Well, you just need to buy a bunch of those 58188 Technic Power Functions Extension Wires, cut them and connect them with DuPont cables.