If you'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].
[0] https://twitter.com/iamkeraf/status/1274433444446113792 [1] https://www.hackster.io/Notthemarsian/take-control-over-lego... [2] https://www.philohome.com/pf/pf.htm
Yes, with some work you can make your train stop and go. But I don't think there's a good track switching solution that's lego only and automated. There's an aftermarket motor thing that connects with USB. The lego only attempts end up unwieldy and usually lacking in reliability (e.g. https://rebrickable.com/mocs/MOC-11841/1963maniac/train-trac...)
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't recreate this with lego with just a single power brick, as it's four things: sensor, light, motor, sound. Lego train can only do two.
I wish this was the default interface that LEGO provided but I’m thankful for the PyBricks team creating a solution.
I can vouch for that! I can say - with great confidence - that the best job I ever had was in Legoland, Billund while I was in high school. The job: keep the outdoor small models running from 15:30 when the real engineers left, until park closes. Then leave a note about the stuff I couldn’t fix myself.
The electronics were industrial PLCs wired to a control computer, and the mechanics inside the models were made from industrial type stuff that you might see on a robot, conveyor belt or the like.
Most of the models (trains, cars, cranes etc.) were built on a metal chassis or skeleton.
Fond memories of getting paged by the system with “ALARM: Cars, Norway” to discover that a kid had dropped her soft ice on the highway ;)
I think this is the first time i saw the wonder of programming, sad that its harder to do this now.
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.
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.
Wiring the serial or parallell port to something wasn't hard. Instructions for bit banging them where generally found in the library (paper books). Serial had weird voltages but was near indestructible. Parallel was TTL just like anything else digital, so some 74 ICs got you mostly there.
The era where you basically needed to solder if you wanted a computer was just over, so electronic knowledge was still easy to find.
We're all engineers now, the box is treasured and still works. Finding a PC with a parallel port has become challenging though.
Plus there are a bunch of off the shelf solutions on Amazon (YMMV).
https://www.theverge.com/2022/10/28/23428766/lego-discontinu...
While Lego promotes use of their proprietary apps, other bluetooth shims can facilitate connections. I was able to connect to a Boost hub without issue using MIT's Scratch website to execute instructions. As far as I can tell, only Spike can operate untethered by BT with the default firmware.
I've been integrating some BBC Microbit with Geekservo Lego compatible microservos and the overall experience is similar. Lego throughout is easier to integrate but doesn't lend itself to as much customization/experimentation. Using the MIT Scratch IDE is similar to MS Makecode used for Microbit. Compose your blocks, flash your microprocessor. Some things I like about Makecode are GitHub integration and the ability to seamlessly move between blocks, JS and Python.
There isn't enough IO and connectivity for any Mindstorm or new Lego MCU to make an advanced train city. You'd be better off with ESP8266 on ESPNow mesh operating glue-your-own or Geekservo units.
## SPIKE Prime and SPIKE Essential
All SPIKE Prime and SPIKE Essential sensors and motors are compatible with each other.
## MINDSTORMS® EV3 / NXT and SPIKE Essential
MINDSTORMS EV3 and NXT components aren’t compatible with SPIKE Essential because they use different connection cables and ports.
## WeDo 2.0 and SPIKE Essential
WeDo 2.0 motors, sensors, and hubs aren’t compatible with SPIKE Essential.
## Powered UP / Control+ and SPIKE Essential
The Control+ L and XL motors can be plugged into the SPIKE Essential hub and detected by the SPIKE app, but other elements won’t be detected.
https://www.lego.com/en-in/service/help/spike_prime/spike-es...It is part of their education line.
https://www.lego.com/en-se/product/lego-education-spike-prim...
https://www.raspberrypi.com/news/raspberry-pi-build-hat-lego...
This is why I come to Hacker News
Or try to buy old stock on ebay etc.
The "best" model railroads have electric track at a constant voltage and DCC or other controlled locomotives, so that you're not "driving" the train with the voltage on the track.
Now what I really wish they'd bring back is the Space Monorail...
Agreed. I still think about that thing. I was about 10 when it came out and used to go and stare at the box at the toy store. When the new Futuron LEGO minifigs came out with the first revamp to the Classic Space suit, it just looked so damn cool. To this day they always make me think of the monorail.
It's been nearly 20 years since I last pulled out my LEGO trains... That and the Rokenbok.
I havent had much luck in the overflow communities so I am unsure how common this is. Is it what most people do?
At least on Stack Overflow it's a common way of sharing knowledge.
Source: been using SO quite intensely, have many reps.
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...
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.
You can even add sensors that count the track sleepers so you can get a constant speed no matter the load. Here's a demo with code.
https://pybricks.com/projects/sets/city/60198-cargo-train/sp...
You can also automate the switches so you can get pretty creative with your layouts:
https://www.facebook.com/Pybricks/videos/989683888156075
With enough supporters, we may eventually even add a block-coding language as an alternative to MicroPython.
https://www.raspberrypi.com/news/raspberry-pi-build-hat-lego...
You can see that in some railway engineering firms.
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't fully automated yet.
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'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.
> I use a setup similar to the above to allow an automated train to run around my son's city without the need to have a screen nearby the whole time.
It’s a criticism that I hear regularly of the requirement to use an app for various of the motorized Lego kits: Having a phone in hand often leads to the result that the kids stop controlling (or even building) the kit and rather start playing on the phone. It’s also a bit an expensive thing to hand to your six year old so they can control their Lego train.
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 "channels" - 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.
We also have one of the Duplo bluetooth trains and it is pretty nice as well.
You could use an RCX to control and power the train motors. Fun times from a simpler world, the downside was obviously that you could have only one train running on the grid because the power was supplied back to the rails!
Really interesting ways to move balls around.
https://lego.github.io/lego-ble-wireless-protocol-docs/
So it shouldn't be too hard to add one.
Keep in mind that as noted in this article, the default Powered Up Hub behavior is as a "passthrough pipe" to the host device, so just using a Flipper might be a bit obnoxious.