LEGO Orrery Real-time Driver MOD
A real-time motor driver mod kit for the LEGO 42179 Earth & Moon Orrery
Introduction

I recently got my hands on the Lego Orrery set, which despite being an educational interactive toy is an impressively accurate functional model that simulates the orbital movements of the Sun, Earth, and Moon.
It features a manual crank that runs a gear system that simulates three motions simultaneously: the Earth orbiting the Sun, the Moon orbiting the Earth, and the Earth rotating on its tilted axis. While turning the crank manually is a fun way to visualize the seasons, and the moon's phases. I hated seeing the model sit idle on my shelf after I was done playing with it. So I began to wonder: is this model precise enough to be driven by a motor for real-time celestial tracking? As it turns out, it absolutely is!
The mod I've made consists of a custom PCB that can be directly mounted to the back of a NEMA17 stepper motor an can be attached to the LEGO set replacing the manual crank by only removing 5 LEGO pieces. I'm using esp32 as the brains and a tmc2208 stepper motor driver to silently drive the motor, there's a knob which can be used to go back or forward in time to see upcoming lunar phases, and a button that resets the model to the current local time. When left idle the Orrery Driver runs the motor to match the real time with an impressive rotation of
As always this project is fully open-source and I'm also planning to offer it as a plug & play electronics kit on Tindie as I have some PCB's and components left over from the project. Let me know if you're interested in the comments!
📝NOTE
You can find the ready to print CAD files, PCB Gerbers and Arduino code along with the components list in the project repo.
Hardware
The hardware consists of a ESP32-c3 super mini for it's small scale factor, a center detent potentiometer, a tactile button, RTC module and a tmc2208 silentstick stepper driver, and a nema 17 motor.
Since the LEGO Orrery is already quite compact, there was no room to hide a protoboard. To keep the footprint as small as possible, I designed a custom PCB that mounts directly onto the motor.
PCB

I've used JST-EH connectors on the pcb to make assembly easier, a dedicated power supply of 5V 2A is needed as the motor is power hungry when it accelerates. All the components are through hole so you can easliy solder them on your own with a basic soldering iron. Just make sure you clean any flux residue after soldering as the contacts are really close and can cause a short if not careful.
Freeform Soldering
📝NOTE
I didn't use sketches/drawings for the freeform brass structure, I ended up with this just with trial&error. So in these instructions I'll tell you how I managed to solder the structure. But I can't provide dimensions, etc. since I also don't know them.
The 4 digit 7 segment display can be mounted directly with a regular JST cable connector, but I went for a freeform look just for the aesthetics. I've used 0.8mm brass wire and a small set of pliers to bend them into shape.
Firmware

Driving the motor
Now we get to the fun stuff! How do we drive the motor so that it can match real-time? Through testing, I discovered that one full rotation of the crank rotates the Earth three times on its axis. This 1:3 ratio is the key to calculating the exact speed our stepper motor needs to maintain. But before we do that we need to know how many steps the motor takes to complete a single revolution (
Where
In my case the motor has
Now going back to the initial calculation of the
Uploading the code
Download the code from the repository and upload it to your ESP32 board via USB using the Arduino IDE, if this is the first time you are uploading code to your ESP32-C3 you might have to put the board in to download mode by holding the boot and reset buttons at the same time and then releasing the reset button after a few seconds.
Calibration
The display will prompt you to calibrate the orrery when you first plug it in, use the knob to move the orrery in to the winter solstace position as shown in the LEGO manual:

Simply press the button after you align the orrery and the orrery will start moving into it's real-time position!
📝NOTE
You only have to calibrate the motor once when you plug it in first so it knows where the gears are, once set there's the RTC module alon with the EEPROM of the ESP32 is used to save the state of the motor to keep track of time in case of a power loss. So you only have to calibrate it once!
And with that the build is finished! This project was really fun to build, I hope you enjoyed it as much as I did!
The PCB
The PCB mounted on the motor
Fully assembled
Schematic
Breadboard Prototype
Brass wire with a JST connector