Mr Hobbles

9v, Power Functions, and Powered Up working together seamlessly

Recommended Posts

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.

preview

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.

B54omGWWrm2wJT7?x=1680&y=665&a=true&file

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.

preview

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.

preview

preview

preview

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 by Mr Hobbles

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites
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 by Mr Hobbles

Share this post


Link to post
Share on other sites

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!  

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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 by Mr Hobbles

Share this post


Link to post
Share on other sites

@Mr HobblesWhat programming language do you use on the Pi? Looks like this combination works really nice!

Share this post


Link to post
Share on other sites
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/

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Excellent work. It's nice to see the old technology finding new uses and still being relevant.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 by Mr Hobbles

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

It will be the first thing I will do, as soon as the first of the two I have purchased arrives :pir_laugh2:

Share this post


Link to post
Share on other sites
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 ?

 

Share this post


Link to post
Share on other sites

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/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.