Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LEGO Duplo Train Remote Control

A custom remote control for the Lego duplo 10427 train, built with a Seeed Studio XIAO ESP32S3 microcontroller. Designed for and tested with the LEGO DUPLO Train set 10427. Connects to the train over BLE using raw NimBLE and the LEGO Wireless Protocol 3 (LWP3).

Hardware

  • Board: Seeed Studio XIAO ESP32S3
  • Potentiometer on GPIO2 (D1) for variable speed control
  • 4 push buttons (active low, using internal pull-ups):
GPIO Pin Function
3 D2 Water/action sound cycle
4 D3 Horn
5 D4 Stop (brake)
6 D5 LED color cycle

Features

  • Variable speed — potentiometer maps linearly to 0-100% forward or backward, with a 15% deadband around center for stop
  • 11 LED colors — cycle through off, white, green, yellow, light blue, dark blue, purple, purple pink, light pink, red pink, red
  • 7 action sounds — cycle through recorded sound, cat, nothing, beach, rain, birthday, night
  • Horn — plays the train horn sound
  • Stop button — immediately stops the motor
  • Auto-reconnect — automatically scans and reconnects when the train is turned off and back on
  • Debounced buttons — using the Bounce2 library

Building & Uploading

Requires PlatformIO.

# Compile
pio run

# Upload to board
pio run -t upload

# Serial monitor
pio device monitor

Dependencies

Configuration

Pin assignments, potentiometer deadband, speed limits, and timing are all configurable in config.h.

Protocol

Communicates with the Duplo Train Hub using raw LEGO Wireless Protocol 3 (LWP3) packets over BLE:

  • Service UUID: 00001623-1212-efde-1623-785feabcd123
  • Characteristic UUID: 00001624-1212-efde-1623-785feabcd123
  • Motor packet format (11 bytes): 0B 00 81 34 11 51 01 [CMD] 01 [SPEED] 00
    • CMD: 01=forward, 02=backward, 03=stop, 04=LED, 06=action, 07=horn

Acknowledgments

This project is based on the excellent work by drndos and his duplo-train-controller. Many thanks for figuring out the BLE protocol, the raw LWP3 packet format, and providing a working NimBLE implementation that made this project possible!

About

remote control software for Duplo 10427 train

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages