Basic Arduino Servo Control for Model Railroads

Поділитися
Вставка
  • Опубліковано 7 вер 2024
  • #modeltrains #modelrailroad #modelrailroading #arduino #diy #servo #arduinoproject
    Welcome back everybody! Be sure to subscribe! Today we are taking a look at the model railroad applications for small servo motors. We will be using arduinos to power these servos and in this case, we will be using a push button to activate them. This is a great program for slow throw turnouts.
    Sketch download
    github.com/DIY...
    Servo
    amzn.to/3f6o2WD
    Arduino
    amzn.to/3xZE5y7
    Resistor
    amzn.to/3hkdsOJ
    Button
    amzn.to/2QYfitT
    Breadboard
    amzn.to/2StdkBR
    Wires
    amzn.to/3uykseB
    Check out my Facebook page
    / diyanddigitalrr
    Support the channel on Patreon
    / diyanddigitalrailroad
    Check out my Instagram
    / diydigitalrailroad
    Check out my Etsy Store
    www.etsy.com/s...
    N Scale Train Set
    amzn.to/33TzsbS
    HO Scale Train Set
    amzn.to/311N17g
    O Scale Train Set
    amzn.to/3lAZCGu
    G Scale Train Set
    amzn.to/312Cn09
    I do a lot of 3D Printing. Here are some great printers
    Anycubic Photon
    amzn.to/2SAnJZn
    Creality Ender 3
    amzn.to/3lkMogX
    Camera I use
    amzn.to/2SyuPh5
    Support the channel with some Merchandise!
    teespring.com/...
    Connect with me at ddrrcommunity@gmail.com
    I do a lot of 3D Printing. Here are some great printers
    Anycubic Photon
    amzn.to/2SAnJZn
    Creality Ender 3
    amzn.to/3lkMogX
    Original Prusa Mini
    shop.prusa3d.c...
    Elegoo Mars
    amzn.to/386NZSa
    Anycubic Mega Zero
    amzn.to/3mHfdpi
    Qiditech Shadow S 5.5
    amzn.to/3cZl059
    Samaritan’s Purse
    www.samaritans...
    Camera Used
    amzn.to/2X87yWR
    “The godly may trip seven times, but they will get up again.
    But one disaster is enough to overthrow the wicked.
    Don’t rejoice when your enemies fall;
    don’t be happy when they stumble.
    For the Lord will be displeased with you
    and will turn his anger away from them.
    Don’t fret because of evildoers;
    don’t envy the wicked.”
    Proverbs 24: 16-19 NLT

КОМЕНТАРІ • 48

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

    Thank you Jimmy! This is exactly what I need! I have a bunch of servos from rc helicopters that I can now utilize as switch machines. Great job!

  • @forestbevins9819
    @forestbevins9819 2 роки тому +1

    Works great, but I need to be able to use an IR sensor instead of a push button or any other type of sensor to detect a train when it passes to throw the servo one direction and then the next pass to throw the servo back to the start position.

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

    Works great! I used Arduino Mega so just changed digital output to 22 instead of 6. Working up to combining LEDs to indicate servo status either straight or turned. Also will eventually be using PCA9685 because I have 30 servos to control. Thanks

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

    Hi Jimmy. You lost me at the beginning and that is not your fault. I just don't know anything about any of it. I think I would need hands on class to learn. I have always been that way in learning, if I read to learn don't get it but if I see in person I can get it.😏
    Thank you for doing this for all who can do it this way. Very well done.
    GOD BLESS 🚂🚂🚂💻

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

    joined train masters TV because of u. watched your 1st video NICE.

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

    There is so much to take in I’m this video! I’ll definitely be referring to it once I start animation on my layout

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

    Jimmy: Great video but you lost me when you build the bread board and programed the servo. Drinking Community Breakfast Blend with heavy cream. Rail on!

  • @brianpagemodeltrains
    @brianpagemodeltrains 3 роки тому +2

    Very informative, Jimmy, you must have done a lot of research on this - I went to DeVry and I still don't fully understand these things!

  • @steve87thpsap
    @steve87thpsap 3 роки тому +2

    Not that I understand, but it would be nice to explain/ reason why you do the positions with the pins. Like why did you pick 6, what does the Resistor do, and why that size. The programming is where I always lose it, because ( this is ME personally) I have no interest in the programming stuff. Just not for me. But I did like how you did the programming, labeled what the commands do and show so short cuts. Good for those people that want to do it, Thanks.

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

      Some of the arduino pins allow for Pulse width modulation or PWM. Pin 6 is one of them. That is why I picked that one. In terms of Resistors. I am not an engineer and I don't do the math for resistance. I just know from tutorials that a 1K resistor works with a momentary push button.

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

    This was great. I'll be using this information soon. Thanks!

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

    Servos servos 30 yrs of RC flying got plenty Good 1's now starts the..Which end goes in the Cement Jimmy.!!?? LOL I'm trying

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

    great code and patience

  • @medwaymodelrailway7129
    @medwaymodelrailway7129 3 роки тому +2

    like the update.

  • @kennethmaney914
    @kennethmaney914 11 місяців тому

    Try MEGAPOINTS CONTROLLERS IN THE UK. ALL PLUG AND PLAY AND WORKS BRILLIANTLY.

  • @panoramix3192
    @panoramix3192 7 місяців тому

    Legend! Thanks :)

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

    Wow, great!! Thank you for sharing!

  • @harryramsbottom5362
    @harryramsbottom5362 Рік тому +1

    This is fantastic. I have one servo working with this information. Now how do I get the other nine servos to work, or am i missing something?

  • @KenN.OXN.805
    @KenN.OXN.805 3 роки тому +2

    Thanks Jimmy. Will you be doing this with signal and control panel indicator led’s as well? That would be great.

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

    Jimmy -- thanks. I love your arduino tutorials and look forward to what (I hope) will be how to attach the servos to crossing gates and/or turnouts. I do have one suggestion, though. Before typing out the code, could you show a little drawing with the pseudocode? It might make it easier to understand the logic of what follows. Either way, though, great tutorials. Thanks again.

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

    Wondering if and where this could be added to work with the SENSORs VIDEO

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

    Well done Jimmy! Thank you

  • @mattw9667
    @mattw9667 10 місяців тому

    Evening Jimmy. I'm trying to use your sketch as a repeatable base in order to run more than 1 push button controlled servo. Have you by chance expanded your sketch to do such a thing over the past year? Any help or direction would be appreciated. BTW, got your sketch working well with my hardware!

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

    Can you also put 2 different servo’s with 2 different buttons at 1 arduino?

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

    Hey pal, it would be great if you included a diagram or schematic of the wiring layout. I couldn't find it.

  • @robertheer2708
    @robertheer2708 6 місяців тому

    Hello i have 2 questions. First is there a way where i can join the 5 dollar level but pay in dollars not euros? As they charge 5 euros plus a vat tax to join per months. I have a bank in America. Sec question I say a video somewhere you made tell how to take a ho model and convert it to print on a 3d printer but in N scale for model railroading. Thank you.

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

    Hey Jimmy...good video....of course I have to ask...why aren't you using digital pins? Basic code: int buttonState = 0; then buttonState = digital read(buttonPin); and then do the code for state high and low aka on and off....this way when layouts get bigger with more and more buttons and servos you won't run out of pins as you can use analog pins as digital pins. Just a tip for future code and tutorials.

    • @DeStoreholmskeBaner
      @DeStoreholmskeBaner 3 роки тому +2

      One reason for going the analogue way is to avoid having to cope with bouncing. When you press a button, it doesn’t happen instantly, but rather in a on-off-on-off way (multiple times that is), so you have to verify that it really is a push. Also, the bounce could easily be interpreted as multiple pushes. Doing the analogue is kind of easier to do instead

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

      @@DeStoreholmskeBaner you can account for the debounce in several ways...and in most of my code I haven't needed any debounce....the basic digital button code works just fine...it can be found in the example sketches. Also you can add code to look for multiple presses and ignore those presses.

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

    Super video

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

    What code changes must be made to use a toggle switch rather than a momentary contact button.

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

      It depends on the toggle switch. You could actually simplify the code a great deal depending on which one you used.

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

      Thank you. A double pole, single throw, either on on or on off on. I an struggling with arduino and sure would appreciate seeing that code.

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

    How would I make this work with continuous servos? I bought some 360 degree spinning ones by accident and am struggling to make the work…. Do
    I just need to bin them and start again?

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

    Great explanation of the code! I'm curious if you had any issues with the Arduino not having enough power for the servo? I tried using servos with an Arduino, one servo using 2 buttons to turn it. After three uses, the pin stopped working, tried another one, and that stopped as well. The Arduino essentially was unusable. What I could find on this is the the Arduino can't handle the amperage of the servo. Could turning off the servo in the code eliminate this?

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

    Jimmy, could this be activated by a sensor instead of by push button

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

    To use the servo to switch a HO switcher, what kind if wire do I need?

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

    How attach 16 servos to PCA9685 ? Please make a video and give Arduino sketch also .

  • @CM-ARM
    @CM-ARM 3 роки тому

    As usual I'm lost. Right now I wish you were here helping me. I just got a Digitrax Evolution starter set and can't get it to work. My DCS 210+ will not read the track and I can't get my DT602D to work with it. If I replace the 210 with a DCS 100 it will. I don't know if I got a bad 210 or am I doing something wrong! Anyway I'm still trying to have fun, Chris lol not.😩😥

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

      A lot of times with products like this, they can have issues in the firmware they were loaded with that was fixed in later versions after they left the factory. I would try to update the firmware on all of your devices. Here is a link to all of the firmware downloads from digitrax www.digitrax.com/downloads/. They have instructions on how to install the firmware there as well. I'm sorry you're not having fun and I wish I could do more!

    • @CM-ARM
      @CM-ARM 3 роки тому

      Thank you Jimmy, I actually moved the Local Net cable from port A to C and plugged my remote into A and it worked. I'll still do the update and I let Digitrax know, Chris

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

    You never explained how to actually center the servo and find out where "center" actually is, as it is critical to center the servo so you can correctly mount the control horn to be able to switch the turnout effectively.

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

    Ummm. Huh? I dont get it

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

    Nice video, but the music is very annoying after a while!

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

    Could you be anymore confusing with your coding, it is just about impossible to follow what you are doing. Try "Little Wicket Railroad" coding for servos, it makes more sense and is easer to follow.

    • @pierre-de-standing
      @pierre-de-standing 3 роки тому

      Also the IoTT channel has a great how-to, broken down into three videos (17,18 & 19), on adding the whole thing for DCC operation.

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

      I disagree. I found this to be very well done and very clear. That said, reviewing other videos and other code always helps as you may not want to do exactly what Jimmy has done.