Mr Hobbles Posted June 9, 2020 Posted June 9, 2020 (edited) As a big fan of Lego trains and Lego electronics, I wanted to try and merge three generations of Lego electronics (9v, Power Functions, and Powered Up) and get them working together seamlessly. Before I describe the setup, here's a video: Last year I discovered the LEGO Dacta Control Lab (otherwise known as Interface B) - a long forgotten piece of 9v tech from 1992 that was never released outside of Educational markets. It connects to a computer via a serial cable, and allows the computer to control up to 8 motors, and receive input from up to 8 sensors. The software is long outdated and doesn't run on modern computers, but the serial protocol is well documented, so I wrote a Node.js application to talk to it. The best thing about it is that it's powered via mains powered, so no batteries - and it stays "awake" as long as the computer is sending keep-alive messages to it. Using the Control Lab and Powered Up, I could control everything with no modifications to official LEGO parts, and nothing extra other than a Raspberry Pi running some code. It got me thinking - I could control switches and signals from a computer. In addition, for the past couple of years, I've maintained node-poweredup, a Node.js library for controlling Powered Up stuff from a computer. So I made a small layout to put it all to the test. :) The switch is controlled via a Power Functions medium motor, plugged into the Control Lab. The switch motor design itself I found via a YouTube video and recreated. The signal has two Power Functions lights. Since each light has two bulbs, one of the bulbs is hidden inside the trackside cabinet next to the signal. The lights are also plugged into the Control Lab. Two trains are setup - one is a Maersk train loaded with Powered Up, and the other is the Metroliner with an old 9v motor. The track is a simple oval with a passing loop. The track is 9v metal, except the passing loop is plastic. This means that only the Maersk train can use this passing loop. The Maersk train also has a downwards facing colour sensor that detects red plates on the track. This allows the Maersk train to be forced to respect a red signal. The whole thing is controlled via a Powered Up remote. A Raspberry Pi sits off camera running all the logic. Hope you enjoyed, and it helps show some of the possibilities of combining all the Lego technologies. :) Edited June 23, 2020 by Mr Hobbles Quote
JWBDolphins Posted June 9, 2020 Posted June 9, 2020 That's very impressive, especially without modifying LEGO parts. I've had grand ideas of having a Raspberry Pi automate switches and crossing gates, etc., but that would include a lot of relays and so on to get the appropriate current to each piece plus lots of coding. (I've gotten as far as buying the Raspberry Pi and a breadboard but they've sitting in a box for 2 years.) If I'm understanding this right, the Control Lab does the work of the relays and things - Very cool! I haven't dived into the Powered Up stuff too much, but I like the direction LEGO is going with all the sensors and how you can program things. I'm very interested to see where they go with this and I'm especially interested to see all the cool ways people come up with to use it. Quote
Mr Hobbles Posted June 9, 2020 Author Posted June 9, 2020 (edited) 34 minutes ago, JWBDolphins said: If I'm understanding this right, the Control Lab does the work of the relays and things - Very cool! That's correct. :) If you look at the picture of the Control Lab, ports C and D drive the lights for the signal (green and red respectively). Port E controls the track switch - the computer (Raspberry Pi) sends commands to turn the motor on for 200ms at a time to flip the switch. And finally, port H is hooked up to the track, varying the power to control the Metroliner. Edited June 9, 2020 by Mr Hobbles Quote
JWBDolphins Posted June 9, 2020 Posted June 9, 2020 AH, I see! (For some reason the pictures weren't loading for me the first time - just the video was. But they are there now.) That is very slick, nice job! Quote
GianCann Posted June 9, 2020 Posted June 9, 2020 (edited) Great job @Mr Hobbles Edited June 9, 2020 by GianCann Quote
1963maniac Posted June 9, 2020 Posted June 9, 2020 1. You had a great idea. 2. It actually works. 3. And it's relatively simple. THIS IS AWESOME!!! I don't under stand all the discussion about the new powered up products. I'm still in the dark ages of Power functions (plug and play). Just don't make me do any programming. My train uses PF switches getting power from and old 9V train controller. My layout is small and simple, only two RC trains. Quote
Duq Posted June 9, 2020 Posted June 9, 2020 Very interesting setup! Question though: your wrote " The Maersk train also has a downwards facing colour sensor that detects red plates on the track. This allows the Maersk train to be forced to respect a red signal." But the red plate between the tracks is fixed and doesn't change when you change the signal. Can you explain a bit more about how that works? Quote
Mr Hobbles Posted June 9, 2020 Author Posted June 9, 2020 (edited) 11 minutes ago, Duq said: But the red plate between the tracks is fixed and doesn't change when you change the signal. Can you explain a bit more about how that works? Sure. :) Although I’m hitting buttons on the Powered Up remote, it’s not doing anything directly - the Raspberry Pi is receiving button presses and sending commands to the Control Lab and Powered Up hubs respectively. As a result, the code running on the Pi knows whether the signal is green or red. The red plate is really just used to know when the Maersk train is in front of the signal. When the code running on the Raspberry Pi is notified that the sensor sees the red plate, it checks the state of the signal. If it’s green, it does nothing. If it’s red, it stops the train. Its also how I can use the same button to toggle the signal or the switch. The Pi knows what state the signal or switch is currently in, so when it receives another button press, it just sets the signal or the switch the opposite way. Edited June 9, 2020 by Mr Hobbles Quote
JopieK Posted June 9, 2020 Posted June 9, 2020 @Mr HobblesWhat programming language do you use on the Pi? Looks like this combination works really nice! Quote
Mr Hobbles Posted June 9, 2020 Author Posted June 9, 2020 13 minutes ago, JopieK said: @Mr HobblesWhat programming language do you use on the Pi? Looks like this combination works really nice! Thanks, it does. :) I use Node.js/TypeScript. I've actually open sourced a couple of libraries to help people program Powered Up and Control Lab stuff: For Powered Up - https://github.com/nathankellenicki/node-poweredup/ For Control Lab - https://github.com/nathankellenicki/node-controllab/ Quote
JopieK Posted June 10, 2020 Posted June 10, 2020 On 6/9/2020 at 7:12 PM, Mr Hobbles said: Thanks, it does. :) I use Node.js/TypeScript. I've actually open sourced a couple of libraries to help people program Powered Up and Control Lab stuff: For Powered Up - https://github.com/nathankellenicki/node-poweredup/ For Control Lab - https://github.com/nathankellenicki/node-controllab/ Good to hear. I especially like the credits of the library ;) (just kidding). I tried the library in the past and it works great, I'm considering automate my trains using Python. Quote
Feuer Zug Posted June 10, 2020 Posted June 10, 2020 Excellent work. It's nice to see the old technology finding new uses and still being relevant. Quote
Toastie Posted June 10, 2020 Posted June 10, 2020 Wonderful! It is so nice to see electronics generations coming together - as the bricks ever did - and do. Also, 4.5V as well as the 12V generation seamlessly integrate into this family. 12V is no problem for PF - as 4.5V is not. It is so cool to run a 4.5V train off from PF hardware. IMHO PF is the ultimate control hardware for "dumb" LEGO devices, whereas the PoweredUp line is the most powerful environment for smart devices. Best Thorsten Quote
GianCann Posted June 23, 2020 Posted June 23, 2020 On 6/9/2020 at 7:12 PM, Mr Hobbles said: For Control Lab - https://github.com/nathankellenicki/node-controllab/ Hi @Mr Hobbles, I think this repo is private... can you check, please? Quote
Mr Hobbles Posted June 23, 2020 Author Posted June 23, 2020 3 hours ago, GianCann said: Hi @Mr Hobbles, I think this repo is private... can you check, please? My apologies! I forgot to set it public - it should be public now. Quote
GianCann Posted June 23, 2020 Posted June 23, 2020 59 minutes ago, Mr Hobbles said: My apologies! No problem! Thank you again for sharing your knowledge and your works (Note: a second 9751 in on the way... destination: Italy!) https://www.bricksandchips.it/2020/06/23/control-lab-e-circuiti-ferroviari-lego/ Quote
Mr Hobbles Posted June 23, 2020 Author Posted June 23, 2020 (edited) On 6/10/2020 at 11:31 AM, JopieK said: Good to hear. I especially like the credits of the library ;) (just kidding). I tried the library in the past and it works great, I'm considering automate my trains using Python. Yep! I remember we (and many others) helped form the majority of the first 20 pages or so of the "Powered up" thread...credit where credit is due! ;) Edited June 23, 2020 by Mr Hobbles Quote
BrickTronic Posted June 25, 2020 Posted June 25, 2020 Hello, Does anybody know what is inside the 9751 Module ? What Microcontroller is used ? Gianluca : did you have taken a look into your 9751 and maybe taken pictures ? Quote
GianCann Posted June 25, 2020 Posted June 25, 2020 It will be the first thing I will do, as soon as the first of the two I have purchased arrives Quote
GianCann Posted June 25, 2020 Posted June 25, 2020 1 hour ago, BrickTronic said: What Microcontroller is used ? Siemens SAB 80C515 ;) Today the postman is passed form my home: https://www.bricksandchips.it/2020/06/25/linterno-del-control-lab-9751/ Quote
Toastie Posted June 25, 2020 Posted June 25, 2020 30 minutes ago, GianCann said: https://www.bricksandchips.it/2020/06/25/linterno-del-control-lab-9751/ Now this is what I call decent electronics. This is so nice and clean. How much did you pay? I know, BL is our friend. Best Thorsten Quote
BrickTronic Posted June 26, 2020 Posted June 26, 2020 15 hours ago, GianCann said: Siemens SAB 80C515 ;) Today the postman is passed form my home: https://www.bricksandchips.it/2020/06/25/linterno-del-control-lab-9751/ Great Work ! I tried to find Datasheets. For the 80515 I found : www.keil.com/dd/docs/datashts/infineon/80x515_um.pdf But the H-Bridge Chip marked as "NOD-1001" I could not find. Maybe a Transistor-array or an ASIC produced only for Lego ? Does anybody know what this H-Bridge is, or where to find the Datasheet ? Quote
GianCann Posted June 26, 2020 Posted June 26, 2020 I also tried to search, but I didn't find nothing about this IC. Quote
brickerik Posted June 26, 2020 Posted June 26, 2020 Hello, Oh, it's exactly what I want to achieve, but with Java language :) I've already implemented Control Lab (JControlLab : https://github.com/e-amzallag/jcontrollab ), then I'm currently working on the PoweredUp Java implementation (JPowUp) All my Java libraries integrate together, included the LEGO Dimensions Toypad (JToyPad https://github.com/e-amzallag/jtoypad ) Nice to see that there are other guys with the same goals ! More information : https://www.dajlab.org/ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.