TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Can Lego City Powered Up trains be automated?

237 pointsby jweissmanover 2 years ago

20 comments

kerafover 2 years ago
I added my Lego Rollercoaster on Home Assistant[0] a little while back. Nothing fancy, just cut a Power Functions extension wire to put a relay in-between and an ESP board to control it. On one side I had the power pack and the other the motor. Would have loved to switch out the power pack for a constant power source but never got to it.<p>If you&#x27;re looking to do some Power Functions (PF) hackery, there are some interesting articles that cover the wiring and working of PF gadgets more in detail[1][2].<p>[0] <a href="https:&#x2F;&#x2F;twitter.com&#x2F;iamkeraf&#x2F;status&#x2F;1274433444446113792" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;iamkeraf&#x2F;status&#x2F;1274433444446113792</a> [1] <a href="https:&#x2F;&#x2F;www.hackster.io&#x2F;Notthemarsian&#x2F;take-control-over-lego-power-functions-ee0bfa#toc-understanding-the-power-functions-wiring-0" rel="nofollow">https:&#x2F;&#x2F;www.hackster.io&#x2F;Notthemarsian&#x2F;take-control-over-lego...</a> [2] <a href="https:&#x2F;&#x2F;www.philohome.com&#x2F;pf&#x2F;pf.htm" rel="nofollow">https:&#x2F;&#x2F;www.philohome.com&#x2F;pf&#x2F;pf.htm</a>
preinheimerover 2 years ago
As someone who likes lego and programming, I love this answer. But I hate how hard lego has made it.<p>Yes, with some work you can make your train stop and go. But I don&#x27;t think there&#x27;s a good track switching solution that&#x27;s lego only and automated. There&#x27;s an aftermarket motor thing that connects with USB. The lego only attempts end up unwieldy and usually lacking in reliability (e.g. <a href="https:&#x2F;&#x2F;rebrickable.com&#x2F;mocs&#x2F;MOC-11841&#x2F;1963maniac&#x2F;train-track-switch-controller&#x2F;#details" rel="nofollow">https:&#x2F;&#x2F;rebrickable.com&#x2F;mocs&#x2F;MOC-11841&#x2F;1963maniac&#x2F;train-trac...</a>)<p>The Duplo trains ship with pretty neat functionality out of the box: lights, whistle, brick reader that activates an action when it sees a certain brick. You can&#x27;t recreate this with lego with just a single power brick, as it&#x27;s four things: sensor, light, motor, sound. Lego train can only do two.
评论 #33869518 未加载
评论 #33872809 未加载
评论 #33867065 未加载
评论 #33867322 未加载
评论 #33867011 未加载
lodeover 2 years ago
Automating my Lego trains was my first introduction to programming, back in the late 1980s using GW-Basic. (When I was about 8 years old.)<p>I had several stations on a looped track, and controlled the train position by switching on the power to the motor for a certain time.<p>At first I used a photodiode taped to the CRT monitor (and controlling the motor by lighting up a square in the corner of the screen), later I upgraded to controlling a relay via the parallel port.
评论 #33868074 未加载
评论 #33871319 未加载
评论 #33867889 未加载
preinheimerover 2 years ago
On a related note, Lego is cancelling Mindstorms. So if you were dreaming up an advanced train city with Mindstorms as the brain you&#x27;d better stock up now.<p><a href="https:&#x2F;&#x2F;www.theverge.com&#x2F;2022&#x2F;10&#x2F;28&#x2F;23428766&#x2F;lego-discontinue-mindstorm-educational-robots" rel="nofollow">https:&#x2F;&#x2F;www.theverge.com&#x2F;2022&#x2F;10&#x2F;28&#x2F;23428766&#x2F;lego-discontinu...</a>
评论 #33866981 未加载
评论 #33871129 未加载
评论 #33866996 未加载
als0over 2 years ago
&gt; One of the weaknesses of the City Hub currently is that it requires a tethered Bluetooth device, such as a phone, tablet or computer, in order to function. By flashing the custom Pybricks firmware to the hub, we can overcome this limitation and write programs directly to the device.<p>This is why I come to Hacker News
post_breakover 2 years ago
It&#x27;s a shame they got rid of metal tracks and went to batteries. If you&#x27;re rich you can buy new replacements: <a href="https:&#x2F;&#x2F;shop.fxbricks.com&#x2F;pages&#x2F;fx-track" rel="nofollow">https:&#x2F;&#x2F;shop.fxbricks.com&#x2F;pages&#x2F;fx-track</a><p>Or try to buy old stock on ebay etc.
评论 #33867164 未加载
评论 #33867269 未加载
评论 #33874377 未加载
评论 #33867369 未加载
leetroutover 2 years ago
Is it weird to post the fake question and your own answer to the question at the same time?<p>I havent had much luck in the overflow communities so I am unsure how common this is. Is it what most people do?
评论 #33866542 未加载
评论 #33866691 未加载
评论 #33866922 未加载
评论 #33872204 未加载
Teknoman117over 2 years ago
In the past, the LEGO trains had a port on the motor to pull power from the tracks so you could run things like lights or small motors for effects.<p>There was no protection on the direction the power was going, so you could attach it to a motor port of an RCX brick. And therefore you had a programmable brick on the tracks. Side effect was that now the rails are also now powered so every train starts to move...
Pybricksover 2 years ago
Yes, you can automate LEGO trains with Pybricks. See <a href="https:&#x2F;&#x2F;beta.pybricks.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;beta.pybricks.com&#x2F;</a><p>Pybricks lets you run MicroPython scripts on the hub. Once loaded onto the hub, you can just start the script again by pressing the button. No constant connection required.<p>You can even add sensors that count the track sleepers so you can get a constant speed no matter the load. Here&#x27;s a demo with code.<p><a href="https:&#x2F;&#x2F;pybricks.com&#x2F;projects&#x2F;sets&#x2F;city&#x2F;60198-cargo-train&#x2F;speed-control&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pybricks.com&#x2F;projects&#x2F;sets&#x2F;city&#x2F;60198-cargo-train&#x2F;sp...</a><p>You can also automate the switches so you can get pretty creative with your layouts:<p><a href="https:&#x2F;&#x2F;www.facebook.com&#x2F;Pybricks&#x2F;videos&#x2F;989683888156075" rel="nofollow">https:&#x2F;&#x2F;www.facebook.com&#x2F;Pybricks&#x2F;videos&#x2F;989683888156075</a><p>With enough supporters, we may eventually even add a block-coding language as an alternative to MicroPython.
primitivesuaveover 2 years ago
I used to make all kinds of cool projects with lejos (<a href="https:&#x2F;&#x2F;lejos.sourceforge.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lejos.sourceforge.io&#x2F;</a>) and am now a bit tempted to get the new toys and test out the Python interface. Would be nice if Lego actually invested more time into making a standard programming interface for advanced users.
评论 #33872630 未加载
评论 #33874467 未加载
hinata08over 2 years ago
I would suggest to add some Train protection system (or even ETCS if you&#x27;re motivated) on your Lego railway <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Train_protection_system" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Train_protection_system</a><p>You can see that in some railway engineering firms.<p>There have been train protection systems for decades, to stop trains when something is unusual (over-speed, incapacitated driver, running a red light,...), when railways aren&#x27;t fully automated yet.<p>You can also encode information next to the tracks, and pick it up with the train ! This kind of system was a prerequisite for high speed trains. Drivers can&#x27;t read signs at cruise speed, so they are replicated on their dashboard. A fun but edgy automation would be to encode cards against humanity near the tracks, and to randomly route the train, to generate text.
jameshartover 2 years ago
The motivation of using a special device to untether from the app as being ‘to reduce screen time’ seems tenuous at best. Is using an app to program in a block language to control real trains in a customizable city really ‘screen time’? And even if it is, is it automatically <i>bad</i>?
评论 #33869400 未加载
marpstarover 2 years ago
Noticed that the question and answer were authored by the same person. Skimmed their other answers for fun and they are quite the expert. Very impressive ability to identify specific LEGO bricks.
Kon-Pekiover 2 years ago
Is this the 3rd generation of Lego City trains?<p>We have the first (?) generation in which each train uses IR (I think) and each controller can deal with 2 trains at once, but are selectable to 4 &quot;channels&quot; - so 8 trains in total. I wanted to buy another train or two a few years ago but they had switched to a bluetooth-only system.<p>We also have one of the Duplo bluetooth trains and it is pretty nice as well.
评论 #33867505 未加载
greesilover 2 years ago
Well there goes a weekend. I can&#x27;t wait to try this out for my kids.
jpace121over 2 years ago
I was not planning on buying a train set but now I may be… This looks way too fun.
extasiaover 2 years ago
I used to love motorised lego stuff. Building marble runs was my favourite...
评论 #33866855 未加载
cactusplant7374over 2 years ago
Is there any way to use the Flipper with these trains?
评论 #33868783 未加载
评论 #33872259 未加载
blobbersover 2 years ago
TLDR Stall at a dead end to reset the system using pybricks
评论 #33868304 未加载
alexheikelover 2 years ago
Why not?