skaako

Using an Android Phone to control your trains

Recommended Posts

Hi everyone, i have been playing around with Google App Inventor for a while now and realized there was no mention of it here on Eurobricks. My original post was here on the Lego Technic/mindstorms forum but my first idea was how it can be used to control Lego trains :)

I think by using an NXT hooked up to an IR transmitter such as the Hi-Technic IRLink, it can be used to control PF trains quite easily. And with a bit more programming can be used to control many layout features, such as lighting, remote operated switches etc. The app connects to the NXT via a Bluetooth connection and many commands can be sent and received by using the built in Mindstorms components in App Inventor.

I'm currently away from all my lego at the moment :( so i havn't been able to try it out in practice yet, but it looks like there can be a lot of potential :)

To make apps in App Inventor is really quite simple by use of a Visual designer for the screen layout, and then a block editor for creating the programming behind it. It does have potential to make some very complex and sophisticated apps though.

I look forward to seeing and making some cool controls in the near future :)

Edited by skaako

Share this post


Link to post
Share on other sites

That's very cool Skaako, for I have only had my Android phone now for about a month, though my Train layout has been ongoing for several years now. This sounds like it is worth more investigating. I hope you are able to get back to your Lego soon and let us know what else you find.

Thanks for sharing eh

The legodac Brickerage Firm

Share this post


Link to post
Share on other sites

Thanks, your most welcome :) It will still be a while before me and my Lego are reunited again, but it will be fun when i can get something up and running.

Oh yea i forgot to mention, to use App Inventor it doesn't even require you to have an android phone to make the apps as it has a good emulator too, although you will need a real phone to make use of the bluetooth functions.

Share this post


Link to post
Share on other sites

Hi everyone, i have been playing around with Google App Inventor for a while now and realized there was no mention of it here on Eurobricks. My original post was here on the Lego Technic/mindstorms forum but my first idea was how it can be used to control Lego trains :)

I think by using an NXT hooked up to an IR transmitter such as the Hi-Technic IRLink, it can be used to control PF trains quite easily. And with a bit more programming can be used to control many layout features, such as lighting, remote operated switches etc. The app connects to the NXT via a Bluetooth connection and many commands can be sent and received by using the built in Mindstorms components in App Inventor.

I'm currently away from all my lego at the moment :( so i havn't been able to try it out in practice yet, but it looks like there can be a lot of potential :)

To make apps in App Inventor is really quite simple by use of a Visual designer for the screen layout, and then a block editor for creating the programming behind it. It does have potential to make some very complex and sophisticated apps though.

I look forward to seeing and making some cool controls in the near future :)

The problem with the Hi-Technic IRLink is its pathetic range. Indoors it's about a foot and in a display venue you might as well forget it. You need an amplifier design like the one Mark Bellis has published or like a friend made for me. The range in a hall was still only a couple of feet but it was useable with enough carefully sited transmitters. There's a video here of my first public attempts at NXT train control and this shows the NXT & IR parts.

Jonathan

Share this post


Link to post
Share on other sites

The problem with the Hi-Technic IRLink is its pathetic range. Indoors it's about a foot and in a display venue you might as well forget it. You need an amplifier design like the one Mark Bellis has published or like a friend made for me. The range in a hall was still only a couple of feet but it was useable with enough carefully sited transmitters.

Hi Johnathan, thanks for info about the IRLink, i won't be recommending using this then. I havn't had any experience with using this product, i was just under the assumption that it had a decent IR transmitting range. Do you know if their IR Transmitter has better range? i think they have this as another product.

Thanks again :)

Share this post


Link to post
Share on other sites

Hi Johnathan, thanks for info about the IRLink, i won't be recommending using this then. I havn't had any experience with using this product, i was just under the assumption that it had a decent IR transmitting range. Do you know if their IR Transmitter has better range? i think they have this as another product.

Thanks again :)

The power limitation is down to the NXT brick as it strictly limits the power available to sensors. To improve it would need a redesign of the IRLink so it can take an external power source but my experience with IR is that it would still struggle to reach more than a few feet in an open environment. I don't believe HiTechnic make any other IR transmitters, certainly not with a NXT-G block for PF. What we need is for TLG to redesign PF to use Bluetooth instead of IR. That would really open up the possibilities!

As an alternative approach, consider using NXT to control 9V trains. One of my fellow Brickish members has used a 9V controller with a NXT servo motor attached to the speed dial to control a train that was part of a GBC. It was odd to watch but worked very well.

Edited by Snapshot

Share this post


Link to post
Share on other sites

I'm trying to do the same with the iPhone/iPad as a research project. As soon as I have results I will post them of course :)

Share this post


Link to post
Share on other sites

The power limitation is down to the NXT brick as it strictly limits the power available to sensors.

Hi Snapshot,

that is entirely true. However, when we shoot for PF, then the NXT HiTechnic IR Link is just perfect. As you said, IR is not the way to go, but RF is. There is rather cheap and reliable RF stuff available. PlayMobil (I know, I know, don't mention it here but) sells lame 27 MHz stuff dead cheap. I think we can do better:

The NXT along with the HiTechnic IR sensor is capable of generating virtually any code we want, including the PF protocol. We either boost that IR signal with - again - rather cheap IR remote extenders, or we come up with a reasonable IR RF link. PF does not need a back channel. All we need to do is blow out the corresponding PF RF signal and have an RF receiver on the other side.

What do you think?

Regards,

Thorsten

Share this post


Link to post
Share on other sites

The power limitation is down to the NXT brick as it strictly limits the power available to sensors. To improve it would need a redesign of the IRLink so it can take an external power source but my experience with IR is that it would still struggle to reach more than a few feet in an open environment. I don't believe HiTechnic make any other IR transmitters, certainly not with a NXT-G block for PF. What we need is for TLG to redesign PF to use Bluetooth instead of IR. That would really open up the possibilities!

When i get the time i would like to build my own version of an IR transmitter for PF that is compatible with the HiTechnic devices blocks. I wasn't aware their IRLink was so under powered. You're right, it would be best for it to have it's own power connection, and i was thinking of making it so multiple IR LED's can be connected so they can be placed in various locations around the layout, i.e. in tunnels, blindspots etc.

I think the cost to integrate Bluetooth with PF would cost too much for TLG as the IR PF trains are really quite adequate for their intended market. And i'm guessing that with using IR it avoids costs for TLG in gaining approvals as they would need if it was an RF or Bluetooth device, the same as how there is less toy regulations for a battery powered device compared to a plug-in device. And of course IR is much more cheaper to design and build.

I'm trying to do the same with the iPhone/iPad as a research project. As soon as I have results I will post them of course :)

That would be really cool to see when you have something up and running :)

..The NXT along with the HiTechnic IR sensor is capable of generating virtually any code we want, including the PF protocol. We either boost that IR signal with - again - rather cheap IR remote extenders, or we come up with a reasonable IR RF link. PF does not need a back channel. All we need to do is blow out the corresponding PF RF signal and have an RF receiver on the other side..

Hi Thorsten, for the IR i will look into making my own device, it will be a while before i get the time for it. For using a phone as a controller, i'm not going to be using a NXT for my own layout but instead using a Bluetooth serial module directly interfaced to my own controller. This controller will have the ability to send IR signals to my IR-PF trains, and it is also connected to a RF transceiver for communications with the RF train (still havn't finished yet), and also control lighting and switching. I still want to make use of RF transceivers in the trains for future uses, currently it is just used to acknowledge that a command is received.

So many things still to do default_laugh_new.gif

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.