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
In the Pybricks programming environment, you need to upload our bluepad library first.
- Create a new file in Pybricks (by clicking on the small ‘+’ symbol). Name it test
bluepad.py
. - Copy the contents of
bluepad.py
from GitHub and paste them into the new Pybricks program with the namebluepad.py
. This is a library script that helps to read gamepad data and control NeoPixels and Servo motors connected to the LMS-ESP32. - Create a new program and name it
gamepad_print.py
. Paste the program code below into the new program.
from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch
hub = PrimeHub()
from bluepad import BluePad
bp=BluePad(Port.A)
while True:
lx, ly, rx, ry, btns, dpad = bp.gamepad()
print("Left: {},{}. Right: {},{}. Buttons:{} Dpad:{}".format(lx,ly,rx,ry,btns, dpad))

- Run the program
gamepad_print.py
. - 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. When using the new LMS-ESP32v2 board , the on-board NeoPixel is used as a debug indicator. When the connection between the LMS-ESP32 and the hub is correct, it is green, when not, it is red. Furthermore, when a Bluetooth connection is established between the LMS-ESP32 and a gamepad, the color blue is superimposed mixing with either red or green leading to the following colors: red: no bluetooth, no hub connection, green: no bluetooth, correct hub connection, purple: bluetooth connection, no hub connection, cyan: bluetooth and hub connection both established. So. under normal proper operation, the on-board NeoPixel color is cyan.
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.gamepad_print
.py
Checking BluePad32 Firmware
- Connect the LMS-ESP32 to the robot.
- Power on the robot.
- Connect the LMS-ESP32 with a USB cable to the PC.
- Start a serial monitor (here’s a browser-based serial monitor for Chrome: https://googlechromelabs.github.io/serial-terminal/).
- Press ‘Connect’ and select the appropriate COM port.
- Press the small reset button on the LMS-ESP32.
- 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.