Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Aren't the current limiting resistors also there to protect the LEDs?

Originally I planned a whole description of the LED circuit, how to read a datasheet, what the resistor does etc etc blah blah blah. But that made the vid 15mins long, and IMO even 10mins is too long for a tutorial, so I had to delete it! So the key information ("Protect the Arduino: Use a Resistor!") is the only bit that remained :grin:

Trains and Arduinos? Awesome! I'm taking a class right now in which we're doing stuff like this, with toy trains instead of Lego trains. I think you would enjoy looking at the past projects. :sweet:

Wow, that's real microcontroller programming! Using the Arduino IDE is quite a bit simpler, although the next tutorial will be covering the Interrupt functions of the arduino chips.

  • 4 weeks later...
Posted

LOL. I like how your switches magically worked at the beginning of the video. Good work. That is quite useful. Your code is getting bigger. Do you have a text version available?

  • 3 weeks later...
Posted (edited)

So this is really cool. I have been thinking a lot about automating part of the layout we used. Last Legoworld (in NL) we had a big layout but ended up with only one train driving at the same time. We had to switch manually, I think the arduino can do a lot for us here.

I really appreciate how you started in small steps, this will definitely help, and yes you finally made me choose between the pi and arduino.

I am going to start simple as well, just by doing some basic learning and then start with automation of the train, switches and railcrossing. I think that is enough for now :)

As I am a newby, I do have a question.

In video 1, you connect the L298N Motor driver to a power supply, what kind of power supply can you use here. Is this just an old 12V powersupply where you cut off the end and used both wires to plug in the L298N?

Edited by aawsum
Posted

So this is really cool. I have been thinking a lot about automating part of the layout we used. Last Legoworld (in NL) we had a big layout but ended up with only one train driving at the same time. We had to switch manually, I think the arduino can do a lot for us here.

I really appreciate how you started in small steps, this will definitely help, and yes you finally made me choose between the pi and arduino.

I am going to start simple as well, just by doing some basic learning and then start with automation of the train, switches and railcrossing. I think that is enough for now :)

As I am a newby, I do have a question.

In video 1, you connect the L298N Motor driver to a power supply, what kind of power supply can you use here. Is this just an old 12V powersupply where you cut off the end and used both wires to plug in the L298N?

Yes. You can use an old 12V supply, which you can also use to power the arduino.

Nice video, clear explanation!

  • 2 weeks later...
Posted

New video! The Automated Marshalling Yard!

In this video, two locomotives exchange 3 wagons between a main loop, a station and a siding. It uses as many features of the previous tutorials as possible.

It's also the last video in this series... for now. It's been great fun making them, and it also shows what can be done with an Arduino, some lego, and zero programming experience :laugh:

Posted

Have really enjoyed watching these tutorials, very informative and excellent production. :thumbup:

Also excited to hear at the end of the last tutorial you may well be looking Powerfunctions and bluetooth later. Arduino for track side sensors and automation, and bluetooth to control trains using a hybrid system is an interesting avenue to explore.

Posted

Yes, there are lots of things I still want to explore in both the hardware and the software; the problem is just time and money :D I needed to finish these tutorials before my baby is born, because after that I will be too busy (or exhausted!) to make any more videos for at least a few months.

But my lego won't stay in boxes forever, and hopefully I'll have some spare cash to buy one of the PF trains and some newer-style motors for the track switches/points too.

Posted

The IR control of a PF train is real simpel btw. I found a small library on the internet and managed to get a pf train running, where the speed was handled by the arduino via a infrared led.

Only issue I have so far is that the signal from the IR LED is very weak and only worked directly in front to a max of 20cm. Still have to manage that, but the control functions worked fine.

Posted

Thanks for doing the tutorial videos. They have been fun to watch. Congrats on baby. Get all the sleep you can now. :wink:

Have really enjoyed watching these tutorials, very informative and excellent production. :thumbup:

Also excited to hear at the end of the last tutorial you may well be looking Powerfunctions and bluetooth later. Arduino for track side sensors and automation, and bluetooth to control trains using a hybrid system is an interesting avenue to explore.

I had some hybrid combination of bluetooth to arduino to PF train going. http://www.eurobricks.com/forum/index.php?showtopic=110202

The IR control of a PF train is real simpel btw. I found a small library on the internet and managed to get a pf train running, where the speed was handled by the arduino via a infrared led.

Only issue I have so far is that the signal from the IR LED is very weak and only worked directly in front to a max of 20cm. Still have to manage that, but the control functions worked fine.

You can use multiple IR LEDs to strenghten the signals. I ran my IR LED without resistor and it bounced pretty well off my white ceilings. It is risky for blowing the LED but I have other old TV/DVD remote controls for salvage in case.

  • 8 months later...
Posted

New video time: POWER FUNCTIONS!

 

 

Thanks to my crowdfunding campaign I was able to buy a Power function set, so I was able to work out the simplest way to control the new type of Lego trains with an Arduino!

This tutorial is extremely basic; you don't have any real user input into what the train is doing, but don't worry! Coming up next will be Bluetooth control, onboard Arduinos and wireless Arduino-to-Arduino communication, so future layouts will have much more playability.

 

  • 4 weeks later...
Posted (edited)

I would like to thank you very much Richfilth for all your jobs on arduino for Lego trains : you made me discover the arduino and the power of that card for such wonderfuls projects !
And the potential of conceiving incredibles things !

I just have a question : you say, you use as much LN298 to control several trains..... but in my comprehension, you control power delivered to rails sections to "simulate" the fact that you control several trains, is that ?

So, in this case, we join the world of model railways by creating block sections of rails in the layout to get control over several trains and with this method, we avoid power problem that we can have sometimes when we put multiple 9V motors on a circuit.

Edited by LegoLow
Posted

Yes LegoLow, that's just how it works; you have to make independent blocks or track loops to control multiple 9V trains. Video 10 uses two independent sections, which is the main loop and the siding, and these sections join at a shared station using motorized sidings to cut power between the two sections.

New video: ARDUINO ON BOARD!

This tutorial places an arduino on board your train, so you can take your programs with you as you move! I've built the arduino onto a wagon so that you can see all the components, but this could also be build into the locomotive itself and just the battery located in a second wagon.

The existing Power Functions parts remain on the locomotive, so it takes just seconds to convert from Arduino control back to "standard". I've also added two distance sensors for crash detection, so your trains can now run along a single line backwards and forwards instead of going round and round in a loop!

Posted
On 05/12/2015 at 9:15 PM, Richfilth said:

It's been a month, so it's time for another tutorial! This time, it's an Automated Decoupler:

 

This is just awesome, Rich! This is the idea for my layout - only in 12 volts (actually, your layout in the video is virtually the same as mine). But now that I have seen what you have been able to do with Arduino and 9V I am re-thinking my plans. I have plenty of 9V motors and track (just need some switching points) so it should be a bit cheaper than sourcing old 12 volt stuff.

I am going to check out your other videos to see if I can answer this next question, but, the thing I am perplexed about with your video is how you are getting one train to stop whilst another is running on the same 9 volt track. I thought this was impossible! Hopefully you already have this covered in one of your other videos. 

BTW, the video production quality is great. As someone who has some experience with this, I can see quality when I see it, and your effort is outstanding.

Posted

Younge, thanks for the kind words! I make tutorial videos as part of my day job, and I try and transfer those skills to these tutorials (even if the cameras aren't as high-quality as I'd like!), so your appreciation is very much appreciated!

The Automated Coupler video only uses one locomotive, so maybe you're thinking of another video with two trains? Tutorial 6 uses two trains on two separate loops (no shared rails), while tutorials 8 and 10 use the track points to isolate sections of the track so that another train can run; you see this most clearly in Tutorial 8, where the parked train is between two points and therefore cut off from the power going to the other train.

Posted
2 hours ago, Richfilth said:

...The Automated Coupler video only uses one locomotive, so maybe you're thinking of another video with two trains...

Yep, I just realised Rich! I think I was confused when I was watching your video because your layout is the same as mine, so I think I just saw what I wanted to see - if that makes sense.

Hmmm, might need to think about this a bit more before I make a change.

  • 5 months later...
Posted

Hi guys, long time no see!

I've made another video: this one embeds an Arduino on the train and removes the Power Functions IR receiver. This onboard arduino receives commands from a Master Arduino by the track, which can switch track points and could even read other sensors or control signal lights if you want to.


All the code, parts lists and 'how to' guides are now available on the project website: arduinolegotrains.wordpress.com.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

Announcements

  • THIS IS THE TEST SITE OF EUROBRICKS!

×
×
  • Create New...