Article Summary
Hybrid LEGO robots mix motors that run from a roughly 9 V battery box with microcontrollers that need 5 V or 3.3 V. Here is why a linear regulator is the wrong way to bridge them, how a buck converter does it, why every ground must connect, and how to power servos without browning out the board.
Hybrid LEGO robots, LEGO motors with an Arduino, ESP32 or Raspberry Pi in charge, usually fail on power before they fail on code. LEGO's motors run from a battery box at around 9 V, the electronics want 5 V or 3.3 V, and the obvious bridge between them, a linear regulator, turns the difference into heat inside a plastic model. This guide covers the physics and the fixes: a buck converter, a shared ground, decoupling, and servos that run at microcontroller voltages.
Quick answer: use a buck converter to make 5 V from the LEGO battery, connect every ground together, put a capacitor across the converter's output, and power servos from the 5 V rail rather than the board's 3.3 V pin.
Two electrical systems in one model
| Part |
Power |
Signals |
| Power Functions and Powered Up motors |
From a battery box or hub, most with six AA or AAA cells: about 9 V alkaline, 7.2 V rechargeable |
Driven by the box or hub |
| Arduino Uno or Nano |
5 V, or 7 to 12 V into VIN (Arduino's recommended range) |
5 V |
| ESP32 development boards |
5 V into USB or the 5 V pin, regulated on the board |
3.3 V |
| Raspberry Pi |
5 V; the official supplies are rated 5.1 V at 3 A for the Pi 4 and 5 A for the Pi 5 |
3.3 V |
| GeekServo (LEGO-compatible servo) |
3.3 to 6 V, 4.8 V rated (KittenBot) |
Servo signal from any pin |
Current depends on the load, so measure it rather than trusting a table: put a multimeter in series, or an INA219 current sensor, and run the model through its heaviest movement.
Battery Box
$34.99
Powered Up Technic Battery Box, two output ports, six AA batteries.
The linear regulator trap
A linear regulator such as the 7805 makes 5 V by dropping the rest of the voltage across itself, and every volt it drops becomes heat:
Heat (W) = (Vin - Vout) x current
9 V to 5 V at 0.5 A: (9 - 5) x 0.5 = 2 W of heat
Efficiency: 5 / 9 = about 56 percent
To see how hot that makes the regulator, multiply the watts by the junction-to-ambient thermal resistance in its datasheet; for a small package without a heat sink, that is tens of degrees per watt above the room. ABS, the plastic LEGO bricks are made from, is normally used up to about 80 °C and softens near its glass transition at about 105 °C. A warm regulator tucked inside a closed model is how bricks get warped.
The buck converter fix
A buck converter switches the input on and off rapidly and smooths the result with an inductor and capacitor, so it wastes far less power than a linear regulator. Two common modules:
| Module |
Input |
Output |
Current |
Notes |
| LM2596 |
4.5 to 40 V |
1.2 to 37 V adjustable |
Up to 3 A |
Texas Instruments part; the larger module |
| MP1584 |
4.5 to 28 V |
Adjustable |
Up to 3 A |
Monolithic Power Systems part; higher switching frequency, much smaller module |
Set the output with the module's trimmer and a multimeter before connecting anything, and check the efficiency curve in the datasheet for your battery voltage and load. Parts: LM2596 buck converter modules on Amazon and MP1584 buck converter modules on Amazon.
Ripple and decoupling
A switching converter leaves a small ripple on its output, which can show up as random microcontroller resets, jumpy analog readings or servo jitter. A capacitor across the output helps:
[Buck OUT+] --+-- [Microcontroller 5V]
|
[100 uF electrolytic] in parallel with [0.1 uF ceramic]
|
[Buck OUT-] --+-- [Microcontroller GND]
Common ground
The most frequent cause of erratic behaviour in hybrid robots is a missing shared ground. A control signal is a voltage measured against ground; if the motor driver and the microcontroller have separate grounds, they disagree about what the signal means.
Symptoms
- Motors jitter or run at random speeds
- Motors ignore commands, or run flat out whatever the command
- Behaviour changes when you touch the wires
The fix
RIGHT: one shared ground
[Battery] (+) ---------------> [Motor driver VIN]
[Battery] (-) --+------------> [Motor driver GND]
+------------> [Microcontroller GND]
[USB power] -----------------> [Microcontroller 5V]
WRONG: two separate grounds
[Battery] (+/-) -------------> [Motor driver] no link to the board
[USB power] (+/-) -----------> [Microcontroller] isolated
Bring every ground to one point, a star ground, so motor currents do not flow through the microcontroller's ground wire.
Servos at microcontroller voltage
GeekServos are small hobby-style servos in LEGO Technic-compatible housings with an axle output, made by KittenBot. They run at 3.3 to 6 V, so a whole build can live on one 5 V supply with no 9 V side at all. The signal wire goes straight to a microcontroller pin; the power wire goes to the 5 V rail, not to the board's 3.3 V pin, because KittenBot rates the servo at about 200 mA and a board regulator is not meant to feed motors.
With LEGO motors:
[LEGO battery] -> [Buck converter 5V] -> [Microcontroller]
[LEGO battery] -> [Motor driver] <- control signal from the microcontroller
With GeekServos:
[5 V supply] -> [Microcontroller]
[5 V supply] -> [GeekServo power]
[Microcontroller pin] -> [GeekServo signal]
all grounds shared
Parts: GeekServo LEGO-compatible servos on Amazon.
Troubleshooting checklist
- Are all grounds connected?
- Is the buck converter's output the voltage you expect? Measure it with a multimeter.
- Is there a capacitor across the converter's output?
- Can the battery and the converter supply the current you measured at the heaviest load?
- Are servos powered from the 5 V rail rather than a board pin?
- Are all connections secure? Loose wires cause intermittent faults.
Powered Up builds can also skip the extra electronics altogether by programming the hub itself:
Technic Hub
$89.99
Powered Up Technic Hub with four ports, programmable with Pybricks so no separate microcontroller is needed.
Technic Large Motor
$39.99
Powered Up Technic Large Motor, powered and controlled by the hub.