Це відео не доступне.
Перепрошуємо.

Arduino for Lego Trains #11: Controlling Power Functions Trains

Поділитися
Вставка
  • Опубліковано 7 жов 2016
  • This introduction tutorial explains the basic steps to control a Lego Power Functions train with an arduino! From wiring up an infrared LED to writing the code, this tutorial has everything you need to know to automate your Power Functions train!
    Power Functions library: tinyurl.com/2p... *NEW LINK 12/12/2021*
    LED Resistor calculator: led.linear1.org...

КОМЕНТАРІ • 94

  • @trevorjohnson7353
    @trevorjohnson7353 7 років тому +7

    I am impressed with the start of the video, having the POV of the train. Really awesome camera work throughout. These videos of yours are really inspiring me to invest into my own LEGO arduino combinations. Thanks for these high quality video tutorials.

  • @DerrickWindsor
    @DerrickWindsor 7 років тому +11

    Well done ! You have a pleasant voice, a neat pommie accent and you make the technical bits sound easy - great for building confidence in your viewers! Looks like it is time to dump the N-gauge and get a few Lego trains! I also love ARDUINO - I use it in my Christmas Villages.

  • @bmemike
    @bmemike 7 років тому +8

    This is great! I loved the series and watched them all, but never really considered doing anything with it because I wasn't going to get the old tracks and motors. This definitely opens up a lot of possibilities with a very simple solution.

  • @JohnEdwa
    @JohnEdwa 7 років тому +8

    I would also suggest to go to google, search for "Arduino pin max current", notice it's 40mA, and use transistors for your LEDs.
    It will survive the 200mA with IR leds as they a pulsed very briefly, but if for some reason your code hangs and leaves them on you are going to cook the Atmega chip.

    • @theREAL9er
      @theREAL9er 7 років тому +1

      i agree it would probably survive in this situation but i did add a 2n3904 to drive the leds

    • @sirtinley-knot2944
      @sirtinley-knot2944 3 роки тому

      So to avoid this could you do the same thing but use the 5v constant and make the io pin gnd?

  • @CrouchStuart
    @CrouchStuart 6 років тому +1

    This is a fantastic tutorial! I followed the steps and now have one of my LEGO trains controlled with an Arduino + IR emitter. Thank you for a great step-by-step approach :-)

  • @anime-pasan8745
    @anime-pasan8745 6 років тому +6

    Thank you very much!!!
    Everything works!
    The best explanation!
    With best wishes from Russia!!!

  • @AndrzejSkrobski
    @AndrzejSkrobski 2 роки тому

    I realise this is an old video but I just found it recently and just wanted to thank you for posting it. It inspired me to play with my Lego trains again - this time in a more advanced way, with an Arduino.
    I’m very happy I found your channel! Very interesting topic and great info. Thanks again!

  • @raymondbrown3299
    @raymondbrown3299 7 років тому +4

    I have following you posts for sometime now. Thankfully you came up with something I can use. I am a Power Function user (no metal wheels). I have the using Qt Creator (C++). I know that Arduino uses C++ as well. Thank you...!!!

  • @MrAlex-ej8ov
    @MrAlex-ej8ov 7 років тому +5

    BEST LEGO CHANNEL EVER!

    • @MrAlex-ej8ov
      @MrAlex-ej8ov 7 років тому +2

      is my new profile picture showing up? its a yamanote line e231 500 series train.

    • @JH-ew6ib
      @JH-ew6ib 7 років тому +1

      trains rule no

  • @angelogiacon6499
    @angelogiacon6499 7 років тому +3

    Fantastic mate good stuff! I am looking forward to doing this in conjunction with motorised points and sensors to make the train stop at stations automatically etc! Thanks from Oz!

  • @itanc1
    @itanc1 Рік тому

    Awesome! Love this! I’ve just started printing track for an aerial line round my living room. Will be implementing full Arduino control. Thanks for sharing1!

  • @captinsmilly1337
    @captinsmilly1337 7 років тому +2

    Thank I. Have been waiting for you to do your first video

  • @axltrain838
    @axltrain838 7 років тому +1

    Thank you I am definitely going to use this in the future for my projects

  • @ildna8257
    @ildna8257 6 років тому +1

    He makes it look easy

  • @sergioquesadaberdonce8748
    @sergioquesadaberdonce8748 6 років тому +1

    That's great! But, I think you should make more videos about the power functions trains.

  • @theREAL9er
    @theREAL9er 7 років тому +1

    very nice tutorial, i got everything to work first try

    • @theREAL9er
      @theREAL9er 7 років тому +1

      however i added a 2n3904 to drive the leds because the arduino pins arent capable of much current

  • @yakacm
    @yakacm 7 років тому +2

    Just a small point, but when searching for a datasheet, isn't it better to search on the components code and the word datasheet instead of the code and pdf? Not all datasheets are PDF's, obviously most are but some are weblinks, and true there is usually hundreds of results for popular components, but sometimes obscure components are hard to find and by just searching on PDF you may mis a datasheet. Can I just ask something, how come when you search on google it's the Polish version, when you are very obviously from England, home counties by the sounds of it, why and how come? Are you hiding in flat coming out when he leave to buy hamster food? Great videos BTW, thanks.

  • @paulzaim7900
    @paulzaim7900 7 років тому +5

    Thank you so much for this, i've tried getting the codes that the remote sends to the reciver but it did'nt work=)

    • @pablosaizortuno4740
      @pablosaizortuno4740 3 роки тому

      The Lego reciver has two cable outputs posibilities; one BLUE and one RED. Yo must write in the arduino code the same color than the one that you have conected. This could be your problem, because this happened to me.

  • @JH-ew6ib
    @JH-ew6ib 7 років тому +1

    I want to control my oo gauge railway automatically (technically the type of Lego railway which gets power from the track) could you do a video on the Lego trains which get their power from the track because oo gauge railways are literally the same thing

  • @MaxSupercars
    @MaxSupercars 7 років тому +2

    Thank you for tutorial!

  • @karmabasedj8184
    @karmabasedj8184 5 років тому

    Nice work. 2 questions: Did you write the PowerFunctions library yourself? If so a video about how you decoded the default remote would be nice. Lastly, can you control multiple trains like this with a single arduino?

  • @quboss2008
    @quboss2008 Рік тому

    Siemka Polaku , niezła robota ❤

  • @Bougiebricks
    @Bougiebricks 6 років тому +1

    Really great video

  •  4 роки тому

    The old lego train get power from track ? That was pretty cool , like , battery won't last long right , on the other hand , powered track is last forever as long as get electricity , can someone tell me more about that powered track lego train ?

  • @dcamperman
    @dcamperman 4 роки тому

    This has given me some great ideas, how easy would it be to control the trains via a web page controlling the arduino to have real time control of them?

  • @BiscuitCatProductions
    @BiscuitCatProductions 7 років тому +1

    So I take it that you're back or something?

  • @djm1k399
    @djm1k399 7 років тому +1

    can you mace same with te old rc trains like the 7897 ice or the 7898 cargo train

  • @PSIXOtheX
    @PSIXOtheX 7 років тому +1

    Interesting tutorial. May I ask,where did you get this Ir library from and specialy timings and frequency of ir pulses that can be registered by the Lego Ir receiver?

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +1

      Maybe this video will help: ua-cam.com/video/6RttvmTGm74/v-deo.html

    • @PSIXOtheX
      @PSIXOtheX 7 років тому +1

      It seems useful, thanks!

  • @andrew9275
    @andrew9275 Рік тому

    Question do you have a code for PU trains. Your code for Bluetooth and Power Functions i go also use this year. I have in total 5 trains. 2 PU and 3 PF (bluethooth and some with Sbrick)

  • @train-traum-madabouttrains5005
    @train-traum-madabouttrains5005 5 років тому +1

    Very nice video! ;-)

  • @evelgenius7541
    @evelgenius7541 2 роки тому

    Is there a way to write our own power functions library? I don't have access to the PFlibrary in the link he shared

  • @syaduinotech3681
    @syaduinotech3681 3 роки тому

    Hello sir.. very good video.. thanks so much. I got inquiry, can we used the tsal6200 instead of tsal6400?

  • @vdtimon5821
    @vdtimon5821 6 років тому

    Fantastic video !!

  • @fopmeer564
    @fopmeer564 5 років тому

    I went looking for the TSAL6400 but there is very hard to come, there is a replacement that you use more here for

  • @TooBaldeh
    @TooBaldeh 3 роки тому

    2:22 how do i buy that part inside the train.

  • @NANONilsWORLD
    @NANONilsWORLD 6 років тому +2

    and the next this year 2018....the BLUE TOOTH Controlling ^^

  • @TitinaNasturbova
    @TitinaNasturbova 6 років тому +1

    I find your videos always good but this is a slight disappointment : Why cant you just connect the function to the battery already in the train? I mean, it is illogical that the train will have two power sources, when in fact you could use the Lego battery box to operate both the wheel movement and the remote onboard control unit. No ?

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  6 років тому +1

      +TitinaNasturbova Thanks. Yes, you can use the Lego battery box, which is what I do in the next video. But it requires buying a dedicated lego cable, destroying it, and soldering a custom cable from it. This video aimed to show the proof of concept (onboard IR control) without that expense or complexity.

  • @antalervin19-
    @antalervin19- 2 роки тому

    Can i use TSAL6100 instead of TSAL6400?

  • @kyriacosktenas8182
    @kyriacosktenas8182 6 років тому +1

    Mate great vid. I get this message when I'm done writing code : 'LegoPowerFunctions' does not name a type. It probably refers to the copied files, which may have failed. Is that it ? :)

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  6 років тому +1

      Did you download the library I linked to and install it on your computer?

  • @DieuTopGun
    @DieuTopGun 4 роки тому

    Merci beaucoup de la part d'un Français :D Tu a fait un très bon travail :)

  • @TheGamingMansubscribe
    @TheGamingMansubscribe 3 роки тому +1

    Czy pan jest z Polski?

  • @kyriacosktenas8182
    @kyriacosktenas8182 6 років тому +1

    When you write code your first line is :" #include " ?

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  6 років тому

      Yes. #include tells the Arduino IDE to look for commands in the legopowerfunctions.h file, which you need to copy from the provided link to your computer.

  • @hjhuk555
    @hjhuk555 5 років тому

    Does anyone know if there is a powerfunctions library that works with the newer bluetooth lego trains?

  • @sergioquesadaberdonce8748
    @sergioquesadaberdonce8748 7 років тому +1

    Thank you

  • @TheCodex808
    @TheCodex808 3 роки тому +1

    But you have 120 volt not 220 like shown it shows 🔌 from another country come on here. I live in the United States. And play with my train sets too and set them up also but the settings are off I need to check the local Lego sales office I guess to help me out!

    • @TheCodex808
      @TheCodex808 3 роки тому +1

      Will keep this saved too to help me with my layout ideas also!!

  • @PabloVivCo
    @PabloVivCo 3 роки тому

    Excelent, this totally works, thanks to the master hacker!

  • @riemerdijkstra5974
    @riemerdijkstra5974 9 місяців тому

    lowest resitor I had was 560 ohm so I guess my raqnge will be limited by a lot

  • @arthurdevolder7297
    @arthurdevolder7297 7 років тому

    hey,
    Great video! But I was wondering if this also works with another type of train (7898). I tried it but is won't work. :(

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому

      Sorry - 7898 is an RC train, not Power Functions, so you'll need to use a different method.

  • @hechajo
    @hechajo 7 років тому +18

    FAKE: He plugged in USB first try

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +6

      Like Stanley Kubrick, I took 156 takes until I got it right.

    • @baljeep_gay
      @baljeep_gay 6 років тому +1

      I did too, but mine's USB-c

    • @karlhunt
      @karlhunt 4 роки тому

      Meh, 50/50 chance. I'll allow it.

  • @deonrevis5872
    @deonrevis5872 7 років тому

    Hello Arduino lego trains, I really would like to do a project like this, so could you please help me understand the whole resistor cable thing and create a detailed supply list, It will be really helpful thanks!

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому

      You can check out the project blog for a full guide: arduinolegotrains.wordpress.com/2017/03/26/tutorial-controlling-power-functions-trains/

  • @kyriacosktenas8182
    @kyriacosktenas8182 6 років тому

    Can you also explain what BLUE in code means ? Thanks

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  6 років тому

      Lego Power Functions transmitters and receivers use 8 channels: RED 1-4 and BLUE 1-4. You can see this indicated on both the transmitter and receiver. In this case, BLUE tells the arduino to transmit commands to the motor connected to the Blue plug on the Power Functions receiver (ie the one inside your train).

  • @ericramirez7450
    @ericramirez7450 7 років тому +1

    so..... I need my Old Arduino, or a new one cause I left it die in some lab of the University. Awesome video

  • @mint-o5497
    @mint-o5497 7 років тому

    On your website it says I need a 100ohm resistor but in your tutorial you said you needed a 39ohm resistor, Im confused??????

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому

      The video shows you how to calculate the resistor value for that specific IR LED (the TSAL6400). In most cases, a 100 Ohm resistor will work fine for most IR LEDs. If the resistor is too high then the IR range will be low, but if the resistor is too low then you risk damaging the Arduino, so 100 Ohm is a "safe" value.

    • @mint-o5497
      @mint-o5497 7 років тому

      Alright, Thank you

  • @sergioquesadaberdonce8748
    @sergioquesadaberdonce8748 7 років тому

    can I do the same thing with an uno board??

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому

      Sure! The only difference between the Uno and Nano is the size, so the setup and code is identical.

  • @maddyaurora
    @maddyaurora 5 років тому

    who does have exacly one 39 Ohm resistor?

    • @artbecker5618
      @artbecker5618 4 роки тому

      Current limiting resistor. Without one, all LEDs would try to operate at maximum current and blow themselves up.

  • @BostonAbramsBrickCloset
    @BostonAbramsBrickCloset 7 років тому

    Is this a dumb question... I cannot find the parrameters for a resistor for this led I'm thinking of getting to try this
    www.adafruit.com/products/387

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому

      From the video: "Go to the datasheet and find the forward current and forward voltage values." The website you linked shows "Approx 1.6V forward voltage", and the datasheet that's linked on that page says "Continuous Forward Current - 100mA". Those are the values you need when using the resistor calculator shown in the video at 2:55.

    • @BostonAbramsBrickCloset
      @BostonAbramsBrickCloset 7 років тому

      Arduino Lego Trains thanks

  • @dk-gl
    @dk-gl 6 років тому +1

    Dobry angielski (zdradziłeś się z Google Polska) :)

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  6 років тому +2

      bo jestem Anglikiem! ale mieszkam w Polsce od dawno.

  • @FARIS__KHAN
    @FARIS__KHAN 7 років тому +2

    do you have a fiverr account?

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +1

      Not any more, because the fees are too high. What would you like me to do?

    • @FARIS__KHAN
      @FARIS__KHAN 7 років тому +1

      oh mann:(Actually basically the features that you have on ur channel but all combined into one.But using wireless communication between the train and the components on the train track.

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +1

      Don't worry, wireless communications will feature in the next video!

    • @FARIS__KHAN
      @FARIS__KHAN 7 років тому +1

      Arduino Lego Trains but is it possible to cut the wires of the motor and connect it up to the L298 Motor?because I'm having problems with which wire to connect to which pins

    • @FARIS__KHAN
      @FARIS__KHAN 7 років тому +1

      hi i got a question to ask,if i were to strip the wire of the wheel motor, to connect directly to the motor driver,where does the wire have to go on the motor driver that will be on the train.

  • @santoshthakur5287
    @santoshthakur5287 6 років тому

    .

  • @santoshthakur5287
    @santoshthakur5287 6 років тому

    .