Recommended Posts

Hello fellow train builders,

I would like to share my most recent project theme; Lego Trains & Internet of Things.
Basically, I make connected trains and train related stuff. My aim is not to be 100% realistic or copy existing real world trains.

My goal is to bring Lego into the IoT movement, learn many great things along the way, and eventually help the next generations to get interested and pick up the necessary skills for a better world through technology.
Let's call this STEM through Play.(STEM=science, technology, engineering, and mathematics. Sounds like a mouthful, huh? but that's what I want anyway :classic:)

Without further ado, here's what I have built so far;

Automated Lego Railroad Crossing

 

 

Lego Train Voice Controlled Lights via Amazon Echo

 

 

Lego Train Controller App

 

 

Please bear in mind that this project is new and under development.
I welcome any sort of feedback and questions :classic:

I will also update this thread but if you'd like to keep up, here's my website which aggregates all the social channels related to this project: Legongineer

 

Edited by alican
added youtube videos

Share this post


Link to post
Share on other sites

To start of, I myself am working on a fully realistic and fully automated Lego train management system. I'm looking forward to see what other people come up with. But then I have to say - without being offensive - that the IoT movement is a big pile of stinking garbage. Every unnecessary device that's hooked up to the internet is just a potential security risk - software & hardware wise - produces unnecessary internet traffic that nobody needs (yes, those few kilobytes a day that your stuff sends may not sound like much, but lets just think about how many washing machines and fridges people have and suddenly the traffic situation looks entirely different). 

What I'm saying is keep your trains out of the web.

Other than that I'm very impressed with your app. Looks great and I love your lighting setup on the train! Will you also make it that the light colors change according to the direction of travel? In my personal setup I don't have any bi-directional trains, so I'm not too concerned to change colors according to direction of travel. But I'd be interested to hear how you would determine what way your train is actually going or how you define "forward".

Anyway, keep up the good work! 

Share this post


Link to post
Share on other sites

Nice work.  I like the app.  Does it have the capability to control more than one train? 

Share this post


Link to post
Share on other sites
2 hours ago, McWaffel said:

To start of, I myself am working on a fully realistic and fully automated Lego train management system. I'm looking forward to see what other people come up with. But then I have to say - without being offensive - that the IoT movement is a big pile of stinking garbage. Every unnecessary device that's hooked up to the internet is just a potential security risk - software & hardware wise - produces unnecessary internet traffic that nobody needs (yes, those few kilobytes a day that your stuff sends may not sound like much, but lets just think about how many washing machines and fridges people have and suddenly the traffic situation looks entirely different). 

What I'm saying is keep your trains out of the web.

Other than that I'm very impressed with your app. Looks great and I love your lighting setup on the train! Will you also make it that the light colors change according to the direction of travel? In my personal setup I don't have any bi-directional trains, so I'm not too concerned to change colors according to direction of travel. But I'd be interested to hear how you would determine what way your train is actually going or how you define "forward".

Anyway, keep up the good work! 

Thanks for the feedback :classic: Currently they are networked only locally, I did not allow access to the internet.
I will do that at a later stage when I can ensure security which is not a concern for the proof of concept stage. I will most probably use Amazon Web Services' IoT platform.
My actual job involves APIs, API gateways, and IoT basically so I'm aware of the risks.

The lights do not change color now as they are single color LEDs but I am planning to change them with RGB ones (when my order arrives) and allow changing colors based on direction, select different colors if desired, etc.

The directions are based on the actual PF IR protocol constants described here: http://www.philohome.com/pf/LEGO_Power_Functions_RC.pdf which I simply named from -7 to +7. + being forward and - being backward.

 

4 minutes ago, legobanker said:

Nice work.  I like the app.  Does it have the capability to control more than one train? 

Not at the moment, but this is trivial. I plan to implement this pretty soon. (I'm moving to a bigger flat at the end of the month so I'll have space for more trains :classic:)
The only thing that needs to be done is to allow adding train addresses inside the app and different train controllers will send the commands to different train IP addresses.

Edited by alican

Share this post


Link to post
Share on other sites

Security should be baked in from the outset, not a bolt on after the fact.  Just because you can hook it up to the Internet does not mean you should.

Share this post


Link to post
Share on other sites
1 minute ago, pirzyk said:

Security should be baked in from the outset, not a bolt on after the fact.  Just because you can hook it up to the Internet does not mean you should.

please refer to my post above

Share this post


Link to post
Share on other sites
15 minutes ago, alican said:

Thanks for the feedback :classic: Currently they are networked only locally, I did not allow access to the internet.
I will do that at a later stage when I can ensure security which is not a concern for the proof of concept stage.

 

Share this post


Link to post
Share on other sites
Quote

 I will most probably use Amazon Web Services' IoT platform.
My actual job involves APIs, API gateways, and IoT basically so I'm aware of the risks.

I guess elaboration is needed.

There are 2 ways;

  1. When trains are allowed to be accessed from the internet, they will refuse any connection other than the AWS IoT Gateway.
  2. Trains won't connect directly to the internet, a local Raspberry Pi or something similar will act as the local gateway which will refuse any connection other than the AWS IoT Gateway.

In both these scenarios authentication methods are provided by the gateway and authenticated requests get forwarded, others get dropped.

Share this post


Link to post
Share on other sites
34 minutes ago, pirzyk said:

Security should be baked in from the outset, not a bolt on after the fact.  Just because you can hook it up to the Internet does not mean you should.

I think this sums it up. I don't need a WiFi coffee machine, I don't need my washing machine to send a tweet when it's done washing and I don't see a point in controlling Lego trains via the  web. 

Share this post


Link to post
Share on other sites

With all due respect, people didn't see a point for personal computers, the internet, and touch screen at first either but here we are :classic:

Anyway, playing with Lego doesn't have a point either but people of all ages do anyway because it's fun.

 

 

Share this post


Link to post
Share on other sites
Quote

I think this sums it up. I don't need a WiFi coffee machine, I don't need my washing machine to send a tweet when it's done washing and I don't see a point in controlling Lego trains via the  web. 

But there are many in this hobby (LEGO-trains) who desire better and more comfortable solutions than what IR train remote control can give. I'm sure Alican's train is not connected to the internet because he can do it, but it is a good platform (local network or global) to control your trains in a comfortable way. This system can be also expanded with webcams and another controls (points), and gives a new way to maintain a layout at events and running trains without getting up everytime to switch points or follow the train with the useless LEGO IR control.

Also, I don't think that someone will break into his network just to make crash his trains at an event... You are right about that too many of our machines are equipped with internet and it is totaly unnecessary, but hey, we are talking about a hobby right now... 

Share this post


Link to post
Share on other sites

Thank you Ashi for pointing out another use-case.
Big layouts at crowded events can definitely benefit from something similar and as I explained in my post above, if I decide to open up to the internet actually, the security plan is there. Just not implemented yet.
Also, because the IR component can be totally sealed off if desired, everyone can have virtually unlimited channels so no need to worry about IR channel conflicts.


On another note, as I mentioned in the initial post, I want kids and teens to get interested in STEM fields/programming with a fun hobby.
Of course, there's Mindstorms and now also Boost for younger kids. I used to own a Mindstorms NXT as well, about 10 years ago.
After a while, your knowledge tends to overgrow what those sets have to offer. They are perfect for the very first entry into the field though.
I plan on detailing and explaining everything that went into making this project in a simple, course-like format.

I also have motorized, app/anything controllable track switches but video production has to wait until I move to the new flat unfortunately.
After that, the next step will be "sensorizing" a whole track layout where it makes sense and having it fully automated and also controllable with the rest of the automated system adapting to the new circumstances introduced by an external controller.

Share this post


Link to post
Share on other sites

I've seen the technique of putting an IR transmitter over a IR receiver used in the Audio/Video control room to control equipment like multiple VCRs, tape decks ,etc. from a central computerized console. Back the in 1990's, the system was very expensive.  Now you can do the same with a few dollars of parts from China and a bit of programming.

Sounds like a fun project.  I look forward to controlling your trains over the Internet.  :classic:

1 hour ago, Ashi Valkoinen said:

But there are many in this hobby (LEGO-trains) who desire better and more comfortable solutions than what IR train remote control can give. I'm sure Alican's train is not connected to the internet because he can do it, but it is a good platform (local network or global) to control your trains in a comfortable way. This system can be also expanded with webcams and another controls (points), and gives a new way to maintain a layout at events and running trains without getting up everytime to switch points or follow the train with the useless LEGO IR control.

Also, I don't think that someone will break into his network just to make crash his trains at an event... You are right about that too many of our machines are equipped with internet and it is totaly unnecessary, but hey, we are talking about a hobby right now... 

Another use could be to let visitors and guests drive your trains but have your Positive Train Control take over when they run a signal or go too fast.  It can make for fun interactive layout.  I am trying to do something like that with my off and on Arduino project.  I'll get there eventually.  I'm just finding it more fun to build rolling stock for my LUG events than soldering and programming right now...  :classic:

You don't have to break into his network to crash his system at a public event.  If it is wireless, there is always the risk of RF interference from other devices in the area causing problems just like sunlight or flourescent light can cause issues with the IR.

Share this post


Link to post
Share on other sites

Exactly, now it's actually cost-effective :classic:

1 hour ago, dr_spock said:

Another use could be to let visitors and guests drive your trains but have your Positive Train Control take over when they run a signal or go too fast.  It can make for fun interactive layout.

That's an excellent idea! I will definitely work on this :wink:

Also regarding physical security and interference in wireless vs. infrared, a secure local wireless connection is still way better than the regular IR control as someone with "malicious" intents can just bring their own IR controller and spam random commands.

Share this post


Link to post
Share on other sites

Hello alican

This is a cool idea and this is something that is very much in my own area of interest.

Have you seen this video from a company called Jayway? Their setup uses AWS IOT and Lambda functions to control the train.

Also there's an Australian company called Buddy that uses a whole Lego city including trains in their IOT demo setup- there is an article about it here although their setup is mainly for showing data gathering and how the IOT makes a "smart city"

And for those people who are complaining about the IOT- you are too late. The genie is already out of the bottle :sceptic:

 

 

Share this post


Link to post
Share on other sites

Hi EvilTwin,

Thank you for the heads up, I was not aware of these 2 companies, I will definitely look into how they are doing things :classic:

Edit:
After taking a look at the Jayway video, that is something well withing my capability as well. I actually control a lot of "dumb" appliances at home via Alexa this way :wink:

Regarding Buddy, what they've done seems great. We also use similar techniques at work to demonstrate "larger than life" concepts in an easily understandable way to customers.

Edited by alican

Share this post


Link to post
Share on other sites
11 hours ago, Ashi Valkoinen said:

But there are many in this hobby (LEGO-trains) who desire better and more comfortable solutions than what IR train remote control can give.

Thinking about this makes me wish Lego continued to produce 9V track and developed a DCC system to go with it. Imagine proper DCC for Lego; easy to use and readily available...

Share this post


Link to post
Share on other sites
On 6.1.2017 at 2:46 AM, xboxtravis7992 said:

Thinking about this makes me wish Lego continued to produce 9V track and developed a DCC system to go with it. Imagine proper DCC for Lego; easy to use and readily available...

Yepp, that'd be nice. There are instructions for bolting-on DCC onto 9V motors, but as all my precious babys are in working condition, I'm not ready to sacrify one yet. Maybe when the first one gives up the ghost... PF motor + DCC conversion :laugh:

And then, when all is set for DCC, control it by IOT means like @alican.

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.