6

I'm building a motorized train. The locomotive has two Powered Up train motors, one at each end. However, no matter where I place the hub inside the locomotive, the wires on the train motors are too short to both reach the hub.

So, I have decided to try to connect each motor to a separate hub. The problem is that the motors have to spin in the opposite direction. I know that if I put one motor on the "A" output of one hub and the other motor on the "B" output of the other hub, then I can control the motors independently, but I was wondering if there was a way to program the hubs so that I can control both motors together. Is this possible? If so, what would an example program look like to do this? I can also program in Python and Java if that helps at all. Below is a picture of my current setup.

LEGO Powered Up locomotive

4
  • 1
    You could also try non LEGO brand extension cables: pv-productions.com/product/powered-up-extension-cable
    – Kirk Woll
    May 22, 2021 at 12:18
  • 1
    I don't have too much experience with PUp system and my collection is insufficient to test, but cannot you simply pair both hubs to use same "channel" and use "A" ends for each motor? You would then need to just turn rotate single motor-bogie.
    – Alex
    May 22, 2021 at 21:15
  • 1
    @KirkWoll Thanks! I didn't even know that existed.
    – user18358
    May 23, 2021 at 1:00
  • @Alex That's the problem, though… I can't simply turn one of the motors around because then the wire would be on the wrong side of the motor. It might be possible, but it would require modifying the frame of the locomotive to allow the wire to pass through on the other side.
    – user18358
    May 23, 2021 at 1:02

1 Answer 1

2

Yes, what you require is perfectly possible to implement in the Powered Up app on nearly any recent smart device. You do need to program a bit, there's a graphical programming interface which you can get to after tapping the "Create" button. Since you mention that you're experienced with actual programming languages like Python and Java, you should have no difficulty figuring out what the code blocs do. You'll have the option to either work with sliders that will be present on some makeshift GUI on your smart device to control the speed, or you can chose to connect a remote as a third device (the other two devices being the hubs) and work with the input from the remote...

Addition: I've found the following example program on reddit: enter image description here It's a successful attempt to control the train with the remote just like when the remote would be connected directly... it maintains a variable with the speed of a the train, which can be increased or decreased with the + and - buttons on the train remote, and then the speed is set to the motor. The only change you would need to make is setting the negative of that speed on the second train motor which will be connected to the second hub. That hub will be the third device connected, which is important for the port selection in the code blocks...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.