Jump to content

Recommended Posts

Posted
1 minute ago, Toastie said:

 

A 9V motor can never do that; in contrast.

All the best,
Thorsten. Wait: :pir-huzzah2:

 

a modded one with all the neccessary sensors could but for pure 9v you are correct

Posted
20 minutes ago, XG BC said:

a modded one with all the neccessary sensors

My dream!

Did some serious research into that, could be done - but making it compatible with PUb is - for me - the major obstacle, as PUp software and everything else, like Legoino depending on the hub firmware depend on the UART protocol. I believe PyBricks as well, but I don't know. Maybe they use their own routines.

Nevertheless, running speed control firmware based code is tricky. Precise speed control, as in PI or PID, relies on parameters such as friction and mass (response behavior), but hub/firmware based routines are not - as far as I know - allowing such parameter adjustment. So my plan was to use the electronics of a PUp tacho motor inside a train motor - seems to be not feasible. Too bulky. And: RPMs may not match at all.

Best,
Thorsten

Posted
9 hours ago, Toastie said:

My dream!

Did some serious research into that, could be done - but making it compatible with PUb is - for me - the major obstacle, as PUp software and everything else, like Legoino depending on the hub firmware depend on the UART protocol. I believe PyBricks as well, but I don't know. Maybe they use their own routines.

Nevertheless, running speed control firmware based code is tricky. Precise speed control, as in PI or PID, relies on parameters such as friction and mass (response behavior), but hub/firmware based routines are not - as far as I know - allowing such parameter adjustment. So my plan was to use the electronics of a PUp tacho motor inside a train motor - seems to be not feasible. Too bulky. And: RPMs may not match at all.

Best,
Thorsten

that is true as we cant really change the parameters of a pu hubs internal firmware as far as i know. we would need some kind of tach sensor on an non driven wheel to detect wheelspin.

Posted

Hi @Toastie

two quick remarks:

You can use any motor for load control, without any "sensors", the motor and the EMF are good enough, all DCC Decoders use this, with execellent results.

PID of course can be adjusted (Pybricks i.e. allows that)

Posted

PID of course can be adjusted (Pybricks i.e. allows that)

Hi @Lok24,

yes, in Pybricks it is adjustable, but in the ominous LWP3.0 document for the PUp hubs I did not find anything.

In the same direction: As my remark was on the usage of a TLG train motor, regardless of make (9V, RC, PF, PUp), none of them have any BEMF gear nor would I know how to tap into that.

Best,
Thorsten

 

Posted
5 minutes ago, Toastie said:

In the same direction: As my remark was on the usage of a TLG train motor, regardless of make (9V, RC, PF, PUp), none of them have any BEMF gear nor would I know how to tap into that.

 

?

All DCC decoders use EMF wihich is generated by rotation and electromagnetic induction, with any simple motor. Measument takes place in PWM intermission

Posted
3 minutes ago, Lok24 said:

All DCC decoders use EMF

I am talking about TLG PUp hubs and TLG motors and not DCC decoders or other motors. So yes, I may use a TLG train motor but would not know how to control the rpms with a PUp hub, that's all I am saying.

I am also quite familiar with EMF - not in LEGO trains but on a larger scale in the lab - all our turbo pumps are controlled that way - at final 30000 - 60000 rpm, classical rotation sensors have some difficulties in following the spinning wheels :D

Best,
Thorsten

   

Posted
10 hours ago, Lok24 said:

Hi @Toastie

two quick remarks:

You can use any motor for load control, without any "sensors", the motor and the EMF are good enough, all DCC Decoders use this, with execellent results.

PID of course can be adjusted (Pybricks i.e. allows that)

ok interesting i wasnt shure about it. i knew emf is used in brushless sensorless escs to controll the phases but i didnt know it could also be used for that purpose. i also dont have any powered up stuff and thus no way of trying

Posted

The train motors (and other DC motors without encoders) cannot be used directly for speed control. Back EMF cannot be measured by the motor or the hub.

But you can get very good results by adding a color sensor to measure the speed by detecting the tracks:

The shunter train won't need this though as it uses a motor that already has a rotation sensor.

But if there's room, it's still nice to integrate the color sensor anyway in order to detect colors on the track.

Posted
5 hours ago, Pybricks said:

But you can get very good results by adding a color sensor to measure the speed by detecting the tracks:

Nice!!! You are referring to detecting the sleepers, right? In your video, the color contrast between sleepers and their foundation (table surface) is rather stark - in other train layouts with ballasted track this may become a bit more challenging, I suppose. Anyway, this is a really nice example!

Did your Pybricks speed control program use any P(I/D) algorithm? That could also be fun to implement in code and then use it for educational purposes. When I did that on my RCX trains (rotation sensor on one non-powered axle, 9V train motor), it was really fun to play with the PID parameters and use the RCX data-logging function to record 1) setpoint 2) actual speed and 3) motor power level. These are classical examples for PID control; however, doing that on a train is fun. It is very simple to change inertia/friction by adding cars and/or implement a wild R40 curved track segment and one straight track only segment and then inspect the data-log. Each inertia/load setting (for educational purposes, used that in a PChem lab, as we control e.g. the temperature of an ion source housing (= "metal block") with resistive heating) has optimum parameter settings. Also, a learning function can be programmed. That is a little more work, but really fun to do. And: The folks did comprehend much faster how that ion source heating works ...

Very nice!
Best
Thorsten

     

Posted (edited)

Thanks! The program is here. For speed control, a P-controller with a position that linearly increases with time is all you need (So, I=0 and D=0). No matter the P value, you are guaranteed to reach the desired speed eventually for any weight or number of cars. This is true in theory and practice.

So perhaps counterintuituvely, to achieve perfect speed control you don't actually need to measure speed; only position. And that's a good thing because that's all we have on a train with a color sensor. Indeed, it knows its position by counting the sleepers.

We allow you to calibrate the color sensor for your track colors, so that should help if contrast is lower in your application. The hysterisis uses in this example isn't currently available for colors, but we perhaps we should add that.

Edited by Pybricks
Missed one word.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...