Troubleshooting the Gamepad connection with LMS-ESP32


Updated on:

Pairing issues with your Bluetooth gamepad, Pybricks and the LMS-EPS32 board can come from many parts in the system. Here’s a step-by-step troubleshooting guide to find and elimintate these problems.

Preliminary Checks

  • Ensure you have flashed the latest PyBricks firmware on the hub.
  • Use our LMS-ESP32 installer web site to flash your LMS-ESP32 board with the BluePad32 LPF2 for PyBricks projects firmware.
  • Confirm that the LMS-ESP32 is connected to the correct Port, the same as indicated your Python program where it says: p=PUPRemoteHub(Port.D)
  • Check if the controller is paired with the LMS-ESP32. Pairing is different for each brand and model. For a PS4 gamepad, you pair by holding the PS and Share button at the same time. When the gamepad is paired, it shows a constant blue light on the back.

Initial Testing of the gamepad connection

Run the program. Do this with the LMS-ESP32 connected to the correct port and the controller paired.

# Add in pybricks, with the contents of
# to run this. 

from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pupremote import PUPRemoteHub


def btns_pressed(btns):
    pressed = []
    if btns & 1:
    if btns & 2:
    if btns & 4:
    if btns & 8:
    return pressed

def dpad_pressed(btns):
    pressed = []
    if btns & 1:
        pressed.append("D") # Down
    if btns & 2:
        pressed.append("R") # Right
    if btns & 4:
        pressed.append("L") # Left
    if btns & 8:
        pressed.append("U") # Up
    return pressed

while 1:
    lx, ly, rx, ry, btns, dpad ='gmpd')
    print("Left: {},{}.  Right: {},{}. Buttons:{}. Dpad:{}".format(lx,ly,rx,ry,btns_pressed(btns), dpad_pressed(dpad)))

Observe the PyBricks IDE lower part for joystick positions and button states. If the controller is not connected, the program will run but show all zeros.

Try Resetting LMS-ESP32

If the above doesn’t resolve the issue, try pressing the small reset button on the LMS-ESP32 to see if it starts functioning correctly.

Try Reconnecting LMS-ESP32

  • Disconnect the LMS-ESP32 from USB.
  • Connect it to the hub on port D.
  • Power on the hub.
  • Pair it with PyBricks.
  • Try running the program above.

Checking BluePad32 Firmware

  1. Connect the LMS-ESP32 to the robot.
  2. Power on the robot.
  3. Connect the LMS-ESP32 with a USB cable to the PC.
  4. Start a serial monitor (here’s a browser-based serial monitor for Chrome:
  5. Press ‘Connect’ and select the appropriate COM port.
  6. Press the small reset button on the LMS-ESP32.
  7. Look for an ‘Ack received’ line, indicating correct recognition by the PyBricks hub.

Pairing Gamepad with LMS-ESP32

After the above steps, pair the LMS-ESP32 with your controller and look for a confirmation message like ‘Gamepad is connected’. Note: The actual text may vary based on the controller type.

Additional Steps for Troubleshooting a Gamepad connection with LMS-ESP32

  • Ensure you’re following the instructions in our gamepad connection guide correctly.
  • Recheck all connections and setups if issues persist.
  • Consider reviewing the code for any potential mismatches or errors in the setup.

If these steps do not resolve the issue, it’s advisable to reach out to us for further assistance.

Like this article? Help us make more!

Your support matters

We appreciate your support on Patreon and YouTube! Small things count.

Become a Patron

Don't miss a thing

Subscribe below to get an email when we publish a new article.

Share this with someone who needs to know

Leave a Reply

Item added to cart.
0 items - 0.00