LEGO® Powered Up custom train control

Update 1/4/2021 – I removed temporarily the link to the pdf guide because the latest update of the Powered Up app with the customizable interface broke my code, it no longer works properly. I need to rework it completely, I will publish information about the new version soon. Thank you for your patience and understanding.

The train controller interface of the Powered Up 3.0 app allows now to have multiple hubs connected, but it does not offer a convenient interface to control these trains the same time.

This guide provides 2 code variations with the following abilities using the slider control interface of the Powered Up app:

Simple interface

  • Control 2 trains with the 2 sliders
  • Control the lights of the 2 trains separately with 2 buttons
  • Stop button to stop all trains
  • Interface can be customized to control more trains/motors with one slider, e.g. coupled trains

Advanced interface

  • Control 4 trains with the left slider
  • Switch between the trains with the right button
  • Left number shows the speed of the current train, right number shows the train selected
  • Left button toggles the light of the currently selected train
  • Middle button stops the currently selected train

Disclaimer: the code in the downloadable pdf guide is experimental, not fully complete nor foolproof. It is created considering the limitations of the Powered Up 3.0 app. I’m sure it can be programmed in a more effective way, this is my approach that you can use as a baseline for your own solution.


Comments are closed.