Remote Control a LEGO Technic with a Gamepad Like the PS4 Sixaxis

| | , ,

Get ready to merge the worlds of LEGO Technic and gaming for an exhilarating remote-controlled experience! This blog post will walk you through building a remote-controlled car using a PS4 Sixaxis gamepad. Let’s dive right in.

First, take a look at the end result. I start the Technic hub, then start the program by pressing the green button again. For this video, my gamepad was already paired, so the LMS-ESP32 board picked it up right away.

Step 1: Build a Basic Car for remote control with a gamepad

For starters, you’ll want a car to control. If you’re not sure where to begin, why not start with the hot-rod design from my website. It’s a sturdy, versatile car that makes a perfect base for this project. That car has two small angular technic motors and uses a differential for making smooth turns. You can replace the hub with a Large Technic Hub, or just use the MINDSTORMS Robot Inventor hub from the building instructions. Both work fine with this guide!

Step 2: Integrate the LMS-ESP32 Board

Get an LMS-ESP32 Board

This board acts as the intermediary between your gamepad and your LEGO Technic Hub. Get your hands on an LMS-ESP32 board through my website. It is soldered and plug-and-play with the included wire. This board gives your LEGO builds the ability to run Python code and interact with other devices and custom electronics.

Flash the ‘BluePad32 LPF2 for PyBricks projects’ firmware on the LMS-ESP32 board

Head over to to install this firmware on your LMS-ESP32. If you use Chrome, you can flash the board straight from the browser! The ‘BluePad32 LPF2 for PyBricks‘ firmware makes it compatible with PyBricks and allows it to communicate with your gamepad.

Step 3 Code the Hub to process Gamepad stick and button information

Install PyBricks on the Technic Hub

Navigate to to install Pybricks on your Technic Hub. PyBricks allows you to run Python code directly on LEGO Hubs. You can install – and revert to LEGO firmware – in seconds. Just click the gear icon and follow the guide.

Create in PyBricks

Copy the contents of from GitHub and paste them into a new PyBricks program with the name This script is part of the PUPRemote library that enables remote procedure calls on your LEGO device.

Create in PyBricks

Next, grab the code from GitHub and paste it into another new PyBricks program. This is the code that will control your hot rod. The essential code works like this:

from pupremote import PUPRemoteHub

# Set up an LMS-ESP32 with Bluepad-Pybricks on port D

# Add the gamepad command and data structure

steer = Motor(Port.A)
fwd = Motor(Port.B)

# Helper to translate values
def scale_stick(val, min_val, max_val, deadzone=25):
    if -deadzone <= val <= deadzone:
        val = 0
    return (float(val + 512) / 1024) * (max_val - min_val) + min_val

# Reset steer angle by finding the limit
steer.run_until_stalled(-200, Stop.COAST, 40)
steer.run_target(300, 0)

while True:
    lx, ly, rx, ry, btns, dpad ='gmpd')
    if -512 <= lx <= 512: # Gamepad is connected if it returns regular values
        turn = scale_stick(rx, 100,-100)
        spd = scale_stick(ly, 110,-110)

Step 4: Run the Code to remote control your Technic hub with a gamepad

Once you’ve pasted the code, run the program. You’re now ready for some remote-control action! Hit the play button in Pybricks.

Pairing the Gamepad: Connect the PS4 sixaxis to LMS-ESP32

To connect the gamepad, put it in pairing mode. The LMS-ESP32 board will pick it up and pair. In the case of the PS4 sixaxis gamepad, you put it in pairing mode by first turning it off. Then, turn it on by holding the PS and Share buttons simultaneously. This will pair it with your LMS-ESP32 board.

Have Fun Driving!

Your remote-controlled car is now ready for action! Steer it around using your PS4 Sixaxis gamepad.

About the PUPRemote Micropython library and communication protocol

The PUPRemote library used in this project allows for easy remote procedure calls on pyboards. It’s a powerful tool that opens the door to a plethora of custom electronics projects. The underlying standard is the LEGO® Powerfunction 2.0 (LPF2) communication standard. This standard is also known as LEGO® PoweredUp, LPUP, or PUP. Hence the names PUPRemote and PUPDevice. The protocol is how sensors and motors communicate with most LEGO hubs and battery boxes. You can explore it further on our GitHub repository. Please fork and contribute. Documentation of our PUPRemote library is on

More Remote Control Project Ideas for (PS4) gamepads and LEGO Technic Hubs

Why stop at cars? The possibilities are virtually endless. Here are some ideas:

  1. BattleBot Arena: Create a fleet of LEGO Technic battlebots, each controlled by a PS4 gamepad. Host a battle with friends to see whose robot comes out on top. Use the gamepad to control the bot’s movements, as well as activate weapons like flippers or hammers.
  2. Technic Crane Operator: Build a LEGO Technic crane with full 360-degree rotation, and a winch to lift and lower objects. Use the PS4 gamepad’s joysticks and buttons to operate the crane, replicating real-life crane operations in miniature.
  3. Adventure Racing Course: Set up an obstacle course and use the PS4 gamepad to navigate your LEGO Technic car through ramps, tunnels, and tight turns. Incorporate sensors to start and stop a timer, turning it into a race against the clock.
  4. Mini Golf with Technic Windmills: Build LEGO Technic windmills and other obstacles for a mini-golf course. Control each obstacle’s movement using your PS4 gamepad. Try to time your mini-golf shots while also manipulating the obstacles to make the game challenging.
  5. Motorized Liebherr: Control the awesome Technic Technic 42100 or 42146 from the comfort of a gamepad instead of an awkward mobile phone.

Each of these projects could be a fun and challenging way to combine the functionality of a Technic Hub with the versatile control options a PS4 gamepad – or any Bluetooth gamepad – offers.

So what are you waiting for? Unleash your creativity and bring your LEGO Technic creations to life with the power of remote control.

Happy building and driving! Please share your creation online and let me know!


Make your custom robot electronics speak like a custom LEGO sensor with PUPRemote Library

Leave a Reply

Item added to cart.
0 items - 0.00
%d bloggers like this: