-
Notifications
You must be signed in to change notification settings - Fork 7
2 Get Started
- To run the software you will need a PC/Laptop running Windows or Linux. As of now, it has only been tested on Windows 10 and Ubuntu.
- To automate your LEGO devices the PC needs to have Bluetooth Low Energy (BLE) capabilities. Most mobile devices come with BLE capabilities. On a desktop PC you can use a modern Bluetooth USB dongle to enable the capability.
Brickrail uses only official LEGO hubs and motors for layout operation and communication. This is great because most users that want to automate their LEGO Trains might already have a lot of these devices. The only caveat is that for operation with brickrail, the LEGO hubs need the Pybricks firmware. Pybricks is a open source project that enables your LEGO hubs to run complicated and efficient micropython programs. This enables the layout operation in brickrail as well. Pybricks firmware is very easy to install and it is even easier to go back to the official firmware. The way to install this firmware is described in a later section. Visit the Pybricks website to see the other possibilities enabled by the firmware.
To automate LEGO trains, you have to have at least one Train running a Pybricks-compatible LEGO Hub, a compatible LEGO Motor and one Lego Color & Distance Sensor (88007) pointed down at the track. Most current LEGO City Train sets come with one hub and a train motor, but the sensor needs to be sourced separately. You can get one at the LEGO Shop or at bricklink.
In summary, per train you need:
- 1 Lego bluetooth hub compatible with pybricks (Lego PoweredUp City hub (88009) recommended)
- 1 PoweredUp Motor capable of running the train (Lego PoweredUp Train Motor (88011) recommended)
- 1 Boost Color & Distance Sensor (88007)
The Layout will be automated using "blocks" which are sections of the track marked using colors on the track at each end. The train will only be able to stop in these blocks. To detect them reliably, the colors need to have a high chroma value. This means bright and very saturated colors work best. I recommend regular Blue or Red LEGO 2x8 plates mounted centered on a straight LEGO Track. You will need at least two of them per block.
If you want to run a more complicated layout than a simple loop, you'll need to incorporate switches. For automation, at least some of these switches need to be motorized. Any pybricks-compatible LEGO motor will do.
You'll also need a mechanism that switches your switch using a ~0.6 second long pulse of the motor in one direction, and switches the other way with a pulse in the other direction. The pulse can be configured in the layout_controller micropython file.
To operate all switch motors as well as other future stationary devices like rail crossings and signals, brickrail uses a stationary "Layout controller" hub that can be any pybricks-compatible LEGO Bluetooth hub. Lego Technic "Control+" hubs (88012) are recommended because they are price-efficient and have 4 ports. You can get them quite cheaply on Bricklink.
How many layout hubs you will need depends on how many switches/stationary devices need to be automated and the distance between them. If the switches are far apart you will need either a 3rd party extension cable or you need to operate two layout controller hubs for the two switches.
- Head to the releases page on the brickrail Github repository: https://github.com/Novakasa/brickrail/releases
- Download the .zip archive matching your platform (not the source code)
- Unzip the archive to your favorite directory
- Execute the Brickrail binary (Brickrail.exe on Windows, Brickrail.x86_64 on Linux)
- That's it!
On Linux, you might need to enable execution permission for the executable to be able to run it.
For example on ubuntu, right click the file Brickrail.x86_64
, click "Properties", switch to the "Permissions" tab and enable "Allow executing file as a program".
Alternatively, from a terminal run chmod +x Brickrail.x86_64