Version 1.6
Updated 30 September 2020
The Brick Automation Project does not collect, access nor transmit any personal information.
Originally created by Vincent Vergonjeanne, he has graciously released source code for Version 1.5. As I was interested in automating and controlling multiple LEGO Powered Up Hubs, I revised the software and have produced what I call Version 1.6.
Features added in Version 1.6 include, see the Change Notes for a complete list:
- Multiple Unit (MU) operation. Multiple trains/motors can be linked to act as one.
- Added Technic Hub.
- Displays Battery V and mA.
- Hub rename function. Allows rename of Hub, not just display within the program.
- Invert function. Allows motors to reverse 'normal' direction. Good for switch machines and locos that run 'backwards'.
- Color output buttons for Color & Distance Sensors.
- Light brightness buttons for Lights.
- Emergency Stop. Use the space bar to stop all hubs.
The .msi installation file can be downloaded here BAPsetup.msi; this includes the executable plus the supporting and examples layout files. Alternatively you can install it from the Windows Store, The Brick Automation Project. Two example project files can also be downloaded:
The source code is forked from the original GitHub here GitHub.
I also designed a new switch machine that works well with the Powered Up Hubs and The Brick Automation Project. There are two different configurations:
- Low Profile. This works well for normal turnouts, and can contructed in a mirror image for left and right switches. I can also be rearranged, with a few different pieces to fit closer to the leading track.
- Narrow Profile. This works well for double crossovers, and could be easily modified for normal turnouts also.
Table of Contents:
What is the Brick Automation Project
Disadvantages and Advantages of the Brick Automation Project with Powered Up Hubs
Equipment required for the Brick Automation Project
Operation and Lessons Learned
Change Notes
Conclusion
What is the Brick Automation Project
The Brick Automation Project is software to connect all your LEGO Powered Up devices to single computer via Bluetooth. It used the same protocols as the LEGO Powered Up system, but allows more devices to connect - only limited by your bluetooth adapter. You can control and monitor devices, as well as create event driven programs, including your own customized code. Additionally, it can be used to automate functions, such as throwing switches based on events or identified routes. It also has the cabability to automatically run multiple trains with the anti-collision function.
Disadvantages and Advantages of the Brick Automation Project with Powered Up Hubs
Disadvantages:
- Not 'pure' LEGO software.
- Need a PC near devices.
Advantages:
- Can run multiple trains on the same track at the same time.
- Since LEGO train layouts tend to be reconfigured frequently and since LEGO 9V train track does not lend itself to a block control system, which requires sections of track to be electrically isolated from each other, the Brick Automation Project provides a method to run multiple trains on 9V or RC LEGO track.
Equipment required for the Brick Automation Project
All that is required is a LEGO Hub and a PC with Bluetooth capability (same requirements as stated by LEGO). Some accessories that enhance the experience are listed below, all of which are LEGO products:
- Hubs (e.g., System/Train Hub, Move Hub, Technic Hub, WeDo 2.0 Smart Hub). Typically one train hub is built into a locomotive. The other types are good for controlling sensors, motors and lights.
- Sensors (e.g., Color Distance Sensor, WeDo 2.0 Motion sensor). Sensors are used to trigger events, such as marking the end of a track section for automation and anti-collision.
- Remote Controls. Remote controls are used to drive trains and can also be event-driven via the Brick Automation Project in order to control non-train motors, such as the motorized Crocodile Locomotive.
- Motors (e.g., train motors, switch machines, crossing gates). Motors are used to propel trains, throw switch machines, and the like.
- Lights. Lights are used for locomotive headlights or any other illumination effect.
- When starting trains for automatic movements, place them at the end of the designated section so that they pass in the allotted time.
- Sections do not need to be organized like model railroad block control, just section where decision need to be made.
- Remember automatic trains and routes are one direction, so sections can be arranged for only that direction.
- Changed tracking of Bluetooth devices by address and advertising to eliminate tracking duplicates
- Reformatted console text
- Added Technic Hub to list of devices
- Add MU (Multiple Unit) function, where motors (i.e., Train Motors and Switches) can be link to function together; changes background color to indicated 'linked' ports
- Reformatted Programs tool strip menu
- Added 'Change Speed' option to list of functions under program events
- Changed style of and increased track bar size, and reformatted windows/panels for size throughout
- Changed email address and removed pre message
- Removed donation link, changed to lgauge.com for info
- Changes lights to default to 50% when hub is connected
- Added flag to help read battery status from Sytem Hubs
- Added battery voltage and amperage
- Modified to help get distance sensor data
- Lowered sensistivity on color sensor, does create occassional reading errors, but seems to be a little more accurate
- Added Hub rename functionality to change the Bluetooth device name
- Added invert funcion, to reverse motor direction for locos and switches
- Added buttons to manually change the color output of sensors
- Changed switch motor duration for different design
- Fixed various typos in code and displays
- Changed automation function to ignore train with no path selected
- Changed stopping of trains to NOT use brake functionality
- Modified anti-collision to provide Red, Yellow and Green 'signals' on Hubs
- Added functionality to disconnect button to 'hide' panel when selected again
- Added pre-set buttons for light brightness
- Changed distance sensor to show absolute value (0-10) and rough equivalent cm from WeDo 2.0 Distance and Color/Distance Sensor
- Plays 'chimes' when speed is adjusted to zero manually
- Added name for amended by, with created by
- Disabled 'welcome' screen
- Added 'emergency stop' - use space bar to stop all hubs
- Changed default maximum speed to 50 for automatic sections
- Added port info is removed when a device is disconnected
- Added Icon from spash screen
Thanks to Vincent Vergonjeanne, multiple LEGO train operation and automation is quite powerful. For those interested in complex LEGO train layouts, I highly recommend taking a look at the Brick Automation Project.
I hope this information was useful to you. Please feel free to contact me with any questions or comments at tom@lgauge.com.