Amoreternum

Slowing down train motors

Recommended Posts

Hello everyone,

at the moment I'm building HoMas BR 10001 and while I'm still waiting for the final order of bricks to arrive, I'm already tinkering with what I have with me. The loco is powered by two PF train engines in the tender, but i noticed that from standstill to moving, there's a serious spike in acceleration - fitting for a streamlined high speed engine on the main line, but not something that I want to do while maneuvering the engine in my yard. I do own a SBrick and intend to use it, is there any way to slow down the engine output by manually programming a custom control interface on the app? I'd like the engine to be slow as well as fast, if possible. Replacing the motors for, for example L motors would require serious rebuilding.

Thanks ahead!

Share this post


Link to post
Share on other sites

Well. No. I believe - I don't have an SBrick though.

However, there are two things a bit in your way. For one, the train motors expose a "light weight" motor response (cf. Philo's motor comparison page): The torque is next to nothing. Such a motor gains all its power at high speed ... the gearing in the motor tells you that right away. With that the other issue is that for program control, i.e., feedback loops, you need a sensor that tells you the actual rpm's on any train axle. As far as I know, TLG only (optionally) equipped the RCX Brick with a (TLG) rotation sensor. As far as I know. So I build this, which is however no option for you as well (beware though: >10 years old!!!) because he RCX is too big:

The combination PUp hub + PUp L motor would do, when you use the "motor speed" setting in your program and not the "motor power" setting. The PUp L-motor has an onboard rotation sensor, which the hubs do read - and thus they can control the speed by dynamically by adjusting the power delivered to the motor, when you ask them to do that. Furthermore, the PUP L-motor has a gearing that gives it much more torque at lower power (per se).   

Programming a ramping function for the train motors (9V, RC, PF) never worked for me. The friction forces of the trains I ran this way were simply too "incalculable" by any program. But maybe others here on EB know better!

Best
Thorsten

 

Share this post


Link to post
Share on other sites

I think the SBrick lets you program a power curve so a linear input of 0-255 will give a non-linear power output that climbs quicker or slower at first and then reverses at the end.

Share this post


Link to post
Share on other sites
4 hours ago, zephyr1934 said:

I think the SBrick lets you program a power curve

But that would not solve the problem, would it? I tried that as well on my RCX controlled trains. The thing is at low power settings (regardless how you "slope" them), basically nothing happens - other than motor whining. And then all of a sudden, all hell breaks loose. OK, it is not all hell :pir-huzzah2:

That is the problem with low torque at low power motors, isn't it?

Best
Thorsten

 

Share this post


Link to post
Share on other sites
4 hours ago, Toastie said:

But that would not solve the problem, would it?

No, I wouldn't have thought so. The problem is the stall speed of the motors themselves.

Without any load they will turn at power outputs as low as 20% but loaded you seem to need at least 40% to get the train moving. For train motors with their relatively high gearing this means that the train will suddenly leap forward as if scalded. Smooth getaways just don't seem to be possible.

I did have some success with slow getaways and stops with the Mindstorms controlled D800 Warship loco by using the servo motor with it's speed and angle sensor, so I would imagine that the same could be replicated using Powered Up large Technic motors, as you suggest. It would take a bit of coding in the app, but it wouldn't be too hard to achieve.

47606322502_a6aa5740f0_z.jpg

Video of RoboTrain 1.0 under test.

Share this post


Link to post
Share on other sites

And here I thought this would be a matter of a simple 'no' :D thanks alot so far for your answers!

I think I should consider switching to PUp at least for some projects, seems to offer what I'd need for this one - unfortunately, it's also the solution that requires the most space, more actually than I have. The 10001s tender, at least according to HoMas instructions, is supposed to house the PF battery box, the IR receiver and those sit on top the two train motors, switching to PUp would not get me that much space. I already tried building a dummy tender in roughly the same size for two PF L motors (which I can power with a custom supply via one or two rechargeable 9V battery, so no problem with a battery box although the gearing is a friction nightmare), but doing the same with PUp would not be possible due to size limitations. I might have to somehow try to move the motors into the loco, but again, this would require some rebuilding. Well well. And here I thought this was going to be easy!

By the way, I think Toasties description of hell breaking loose is pretty close to what actually happens. 

Share this post


Link to post
Share on other sites
13 hours ago, Hod Carrier said:

It would take a bit of coding in the app

As far as I remember (I don't do the "apps" - just tried it once, to see whether the "speed" setting = PID controlled power output to the PUp L motor actually works), when using the "speed" (not power) command, I could run my Crocodile at 5% (!) speed without noticing any slowing in curves or so. Even a smooth start ramp may be used (according to the LWP3.0 protocol).

Best
Thorsten 

Share this post


Link to post
Share on other sites
20 hours ago, Toastie said:

As far as I remember (I don't do the "apps" - just tried it once, to see whether the "speed" setting = PID controlled power output to the PUp L motor actually works), when using the "speed" (not power) command, I could run my Crocodile at 5% (!) speed without noticing any slowing in curves or so. Even a smooth start ramp may be used (according to the LWP3.0 protocol).

I was pretty excited to hear that. Unfortunately the train motor and the M-motor do not come with the required sensor. If you need to use one of those, you get no better behavior than from any PF-motor. Oh my... :'(

Share this post


Link to post
Share on other sites
43 minutes ago, Black Knight said:

If you need to use one of those, you get no better behavior than from any PF-motor.

Absolutely true. As far as I know, PUp-wise only the L and XL motors do have the internal rotation sensor.

Now what would easily resolve the issue: TLG gives us a reasonably designed PUp rotation sensor :excited: - then we can do speed control with all motors ... it won't happen though.

Best
Thorsten

 

Share this post


Link to post
Share on other sites
1 hour ago, Toastie said:

Absolutely true. As far as I know, PUp-wise only the L and XL motors do have the internal rotation sensor.

According to pybricks, only the PU train motor and the PU M-motor do not have the rotation sensor -- all other PU motors seem to have one.

Share this post


Link to post
Share on other sites

Ahh - yes - thank you for that link!

Now then: No rotation sensor for sure - just making one for these two is dumb. And since TLG has/is phasing-out PF - no reason for them as well.

Just imagine: All motors without internal sensors (9V, PF and the two candidates you pointed to) could be run in a controlled fashion, would there be such a sensor.

Best
Thorsten   

 

Share this post


Link to post
Share on other sites

Sure, the battery box went from $15 to $50, but it has a lot of great control options. "Just do not use it with a train motor, okay?" Sigh, if they are going to charge so much for the battery box hub, why can't they make the train motor take advantage of the power control. Sigh...

Share this post


Link to post
Share on other sites
30 minutes ago, zephyr1934 said:

Sigh, if they are going to charge so much for the battery box hub, why can't they make the train motor take advantage of the power control. Sigh...

I have a radical idea (no not that one: If the door swings both ways, we could reverse the particle flow through the gate ...) but I just googled PUp motor internals. I bet this has been discussed elsewhere, so maybe this needs to be moved/merged/deleted by mods. Did not check, sorry. It is meant to be a joke though: Too expensive, may not work. BUT: TLG could do that easily >in< a train motor - there is ample of free space in there - for sure!!!

Here we go: This link shows the internals of a dumb PUp M motor: https://bricks.stackexchange.com/questions/10367/what-is-inside-the-lego-powered-up-m-motor. @Philo tells us (https://www.philohome.com/wedo2reverse/connect.htm) that the hubs simply recognize dumb motors by measuring the resistance between PUp pins 5 and 6 (OK, they do A/D conversion of the voltage at one of these pins): A short for a PUp train motor and 2.2 kOhms for the dumb PUp M motor. All other (smart) PUp motors like PUp L do something different, which is Philo also reporting here: https://www.philohome.com/wedo2reverse/protocol.htm  

What's inside an PUp XL motor is shown here: https://bricks.stackexchange.com/questions/15031/what-is-inside-the-technic-powered-up-xl-motor. Here we can see, that there is 1) an additional electronics board and b) a ring magnet is sitting on the geared output axle. c) I may be wrong, but the one chip in the front is mounted in a way that the (segmented?) ring magnet and the chip (hall?) sensors could compose a simple rotation encoder, as used in many devices, e.g.: https://www.analogictips.com/rotary-encoders-part-2-magnetic-encoders/

This is what we do: Open (which seems to be an irreversible process) a PUp L motor. The circuit board should be smaller than that of the PUp XL motor. Desolder/remove the motor + the ring magnet. Get out the circuit board. Put the ring magnet on a 9V axle. Build something nice "around axle and circuit board", @coaster can maybe do that :pir-huzzah2: - and BINGO: We have a PUp rotation sensor with(!) power output (lines M1 + M2) to a motor. We wire these to any type of train motor, 9V/PF/RC/PUp. We sure hope, that the characteristics of the PUp L rotation number is somewhat close to that of the train motor axles (which it should be, looking at my Croc), so that the control algorithm in the hub does not freak out. The PUp hub thinks it has an PUp L motor attached to one of its ports. We set speed to x% and - done.

Well that wasn't such a chore now, was it? (3:23)

 

Spoiler

 

 

 

 

Best,
Thorsten

Share this post


Link to post
Share on other sites
1 hour ago, Black Knight said:

for picking up the power from the tracks. =) 

Of course! Missed to mention that! (Btw: Do the 590s really exist in red? Wow. What's their current value? In Bitcoins?) 

And if I were the King of TLG, I would issue an order, that the electronic pieces of the already existing PUp motors be arranged in a way that the resulting PCB fits nicely into a 9V train motor. And I would give such a dirt cheap board along with the magnet and a (on one side wired) PUp connector >for free< :pir-huzzah2: to any LEGO freak buying an original, highly overpriced PUp hub, provided they declare that she or he is a train head who believes that the end of the 9V line pushed us years closer to the coming end of this world.

Yeah. If.

Best
Thorsten

 

Share this post


Link to post
Share on other sites
On 5/16/2021 at 2:03 PM, Toastie said:

As far as I remember (I don't do the "apps" - just tried it once, to see whether the "speed" setting = PID controlled power output to the PUp L motor actually works), when using the "speed" (not power) command, I could run my Crocodile at 5% (!) speed without noticing any slowing in curves or so. Even a smooth start ramp may be used (according to the LWP3.0 protocol).

Best
Thorsten 

Do you mind me asking how you control your Croc? Is it using the PU remote? If so, how do you access the L Motor's speed command rather than power command?

On 5/17/2021 at 12:44 PM, Toastie said:

Just imagine: All motors without internal sensors (9V, PF and the two candidates you pointed to) could be run in a controlled fashion, would there be such a sensor.

I don't wish to say too much at the moment, but I have something on my workbench at the moment that could help builders using all versions of the Technic motors to run their models in a more controlled fashion without the need to modify anything or resort to third party offerings. It won't help users of the train motor, though. Unfortunately those guys are on their own. Watch this space, as they say.

Edited by Hod Carrier

Share this post


Link to post
Share on other sites
On 5/19/2021 at 11:53 PM, Hod Carrier said:

Do you mind me asking how you control your Croc? Is it using the PU remote? If so, how do you access the L Motor's speed command rather than power command?

@Hod Carrier: Absolutely, my pleasure!

I am either using a standalone ESP32 Node MCU - which I program using the Arduino IDE with the Legoino library of Cornelius Munz installed (https://github.com/corneliusmunz/legoino), and behold,

or I am using my own VB6 SP6 program (no joke, yes the stuff from around 2000) with the /n software IPWorks Bluetooth active X control from 2016 - they gave me that one gracefully for free.

The VB6 program gives me free access to any of the commands/methods described in TLGs LWP protocol (https://github.com/LEGO/lego-ble-wireless-protocol-docs) [which is static since 2018 :sceptic:, still buggy, but this is all I have]. This is the code I am using the set speed sub command (section 3.27.5. of the LWP3.0 doc):
"Output Sub Command - StartSpeed (Speed, MaxPower, UseProfile) [0x07]"

Furthermore, the Powered Up App (programming mode) can do that as well, just tried it to be sure. It is described here https://www.eurobricks.com/forum/index.php?/forums/topic/162288-powered-up-a-tear-down/&amp;page=22&amp;tab=comments#comment-3185689

@Lok24 and many others know a >lot< more on how to use the app for train control, I just work here. The glitches he reports are gone, as far as I can tell - one year has passed since then ... and yes, you can control trains with the PUp remote hooked up to the PUp app, the train hub as well, and the the remote talks with the app which in turn talks to the hub. (So the remote is not directly paired with the hub). I never tried that, see above, don't like to use a smart device to do translations. But apparently it works very well.

@kbalage has assembled a >very nice< summary of PUp hard and software including TLGs apps. I find this page most helpul, when tinkering with the Powered Up app (which I hardly do, but it is nice to test things): https://racingbrick.com/powered-up-code-block-guide/

I am sure, you have all these references - maybe others find them useful.

 

With regard to:

On 5/19/2021 at 11:53 PM, Hod Carrier said:

It won't help users of the train motor, though. Unfortunately those guys are on their own.

That was, what I meant with "9V/RC/PF/PUp motors": The respective train motors. Nearly impossible - but maybe I can't resist and will carve out the electronics of a PUp L motor ... maybe :pir-huzzah2:

And I am >very much< looking forward to what you come up with!!!

All the best
Thorsten

 

Edited by Toastie
came up with? Man.

Share this post


Link to post
Share on other sites

Thank you for that very comprehensive rundown, Thorsten. My own computer/electronics knowledge extends just far enough to know how to turn on the laptop and type "How do I...?" into a search engine, therefore I'm afraid that your solutions are very much beyond my abilities at this time. However, they do sound very impressive. It sounds as though you've found a good way to combine two hobbies that you love into one absorbing passtime.

I have found @kbalage's excellent website and YouTube channel and am very grateful to him for all the hard work he has done in decoding the PUp app and programming environment and explaining it in very accessible ways. Using his knowledge base as a starting point I have found the programming to actually be quite easy. I'm no coder and have only some experience of coding for Mindstorms, but I found that coding for PUp was a lot more intuitive than was the case with Mindstorms (although to be fair the tasks that I was writing code for are not comparable which may have made the task easier). I think that there may still be some bugs in the system as I did get some inexplicable behaviour, but I have found mostly that, if I can conceive of the code I need, I can write it quickly and easily and have it working correctly first time.

Share this post


Link to post
Share on other sites

I had a couple hours and tried to program my croc with PU-Hub, PU-L-Motorand pybricks (MicroPython directly on the hub). As the L-motor has the rotation sensor, I was able to make the train run really smooth: I made a loop ramping up the speed (not the power!) slowly, running for a bit, then ramping down the speed again (a little faster than up). This was absolutely awesome*) to watch and the train behaved exactly the same: if with 6 carriages or without any; accelerating and decelerating just like a real train would.

Now I am sad, that there still is no lithium battery for the "CityHub", there is no rotation sensor in the train motor and the CityHub only has two ports and no speaker. Well, some people are hard to please.

 

*) maybe not from an engineer's point of view, but for a toy ;)

Share this post


Link to post
Share on other sites
4 hours ago, Black Knight said:

I had a couple hours and tried to program my croc with PU-Hub, PU-L-Motorand pybricks (MicroPython directly on the hub). As the L-motor has the rotation sensor, I was able to make the train run really smooth: I made a loop ramping up the speed (not the power!) slowly, running for a bit, then ramping down the speed again (a little faster than up). This was absolutely awesome*) to watch and the train behaved exactly the same: if with 6 carriages or without any; accelerating and decelerating just like a real train would.

Now I am sad, that there still is no lithium battery for the "CityHub", there is no rotation sensor in the train motor and the CityHub only has two ports and no speaker. Well, some people are hard to please.

 

*) maybe not from an engineer's point of view, but for a toy ;)

I think that the powered up app actually has a block to control the ramp up and ramp down time for the motors with speed sensors. But yeah, the crocodile has a good amount of torque.

There is the keybrick one but we all wait for the next batch which was announcend months ago.

Share this post


Link to post
Share on other sites
On 5/24/2021 at 2:11 PM, Tcm0 said:

But yeah, the crocodile has a good amount of torque.

True, is has that because of the PUp L motor. But the thing is that with PID control you would compensate for the low torque in the train motor - if it had a rotation sensor. Or if there were a PUp rotation sensor. 

With 4+ XL motors on a decent train, there is no real need for PID control. They "just do it" by using their muscles = torque at low speed (and "high" speed, where high is limited ...).

Best
Thorsten

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.