Basic Arduino Servo Control for Model Railroads

  Рет қаралды 15,546

DIY and Digital Railroad

DIY and Digital Railroad

Күн бұрын

#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 жыл бұрын
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!
@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
@barryolson8428
@barryolson8428 3 жыл бұрын
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
@forestbevins9819
@forestbevins9819 2 жыл бұрын
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.
@loispadgett6306
@loispadgett6306 3 жыл бұрын
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 🚂🚂🚂💻
@brianpagemodeltrains
@brianpagemodeltrains 3 жыл бұрын
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!
@panoramix3192
@panoramix3192 8 ай бұрын
Legend! Thanks :)
@NScaleDystopia
@NScaleDystopia 2 жыл бұрын
This was great. I'll be using this information soon. Thanks!
@KenN.OXN.805
@KenN.OXN.805 3 жыл бұрын
Thanks Jimmy. Will you be doing this with signal and control panel indicator led’s as well? That would be great.
@DIYDigitalRailroad
@DIYDigitalRailroad 3 жыл бұрын
Yes I have a lot planned.
@kenshores9900
@kenshores9900 3 жыл бұрын
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!
@jgr6955
@jgr6955 Жыл бұрын
Wow, great!! Thank you for sharing!
@mattw9667
@mattw9667 2 жыл бұрын
Well done Jimmy! Thank you
@harryramsbottom5362
@harryramsbottom5362 Жыл бұрын
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?
@graemewilson4126
@graemewilson4126 3 жыл бұрын
Wondering if and where this could be added to work with the SENSORs VIDEO
@steve87thpsap
@steve87thpsap 3 жыл бұрын
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 жыл бұрын
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.
@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.
@luukberndsen5600
@luukberndsen5600 Жыл бұрын
Can you also put 2 different servo’s with 2 different buttons at 1 arduino?
@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.
@mattw9667
@mattw9667 11 ай бұрын
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!
@raymondjackson6069
@raymondjackson6069 Жыл бұрын
Hey pal, it would be great if you included a diagram or schematic of the wiring layout. I couldn't find it.
@bryansmith1303
@bryansmith1303 2 жыл бұрын
To use the servo to switch a HO switcher, what kind if wire do I need?
@bernardc2553
@bernardc2553 3 жыл бұрын
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
@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?
@ModelSceneryTutorials
@ModelSceneryTutorials 3 жыл бұрын
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.
@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 жыл бұрын
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.
@djohnson1110
@djohnson1110 3 жыл бұрын
Jimmy, could this be activated by a sensor instead of by push button
@Drxxx
@Drxxx 3 жыл бұрын
Super video
@jamit2576
@jamit2576 2 жыл бұрын
How attach 16 servos to PCA9685 ? Please make a video and give Arduino sketch also .
@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.
@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
@needs2quit1atgmail87
@needs2quit1atgmail87 3 жыл бұрын
Ummm. Huh? I dont get it
@dusseljeef
@dusseljeef Жыл бұрын
Nice video, but the music is very annoying after a while!
@mattsynth
@mattsynth 3 жыл бұрын
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.
@medwaymodelrailway7129
@medwaymodelrailway7129 3 жыл бұрын
like the update.
@kennethmaney914
@kennethmaney914 Жыл бұрын
Try MEGAPOINTS CONTROLLERS IN THE UK. ALL PLUG AND PLAY AND WORKS BRILLIANTLY.
@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?
@napkin62
@napkin62 2 жыл бұрын
great code and patience
Controlling Model Railroad Switches with Arduinos!
14:11
DIY and Digital Railroad
Рет қаралды 20 М.
Add Realistic Slow Motion to Servo Point Motors
12:15
Little Wicket Railway
Рет қаралды 18 М.
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 37 МЛН
when you have plan B 😂
00:11
Andrey Grechka
Рет қаралды 65 МЛН
💩Поу и Поулина ☠️МОЧАТ 😖Хмурых Тварей?!
00:34
Ной Анимация
Рет қаралды 1,8 МЛН
Easy Model Railroad Backgrounds Anyone Can Do
9:24
DIY and Digital Railroad
Рет қаралды 17 М.
I Made an Automated Model Train With An Arduino!
25:20
DIY and Digital Railroad
Рет қаралды 76 М.
Model Railroad Arduino Block Signal Upgraded!
27:54
DIY and Digital Railroad
Рет қаралды 16 М.
Building a DCC-EX Command Station for My Model Railroad
19:16
White River Line
Рет қаралды 13 М.
Servo Motor Control for Model Railways Part 3 of 3 - Semaphore Signals
15:05
Little Wicket Railway
Рет қаралды 20 М.
Routing Control for Your Model Railroad Layout with Arduino
21:08
Ron's Trains N Things
Рет қаралды 27 М.
Arduino Tutorial 30: Understanding and Using Servos in Projects
18:05
Paul McWhorter
Рет қаралды 244 М.
Building a Cheap DIY Current sensor for DCC with an Arduino!
27:23
DIY and Digital Railroad
Рет қаралды 17 М.
SMAILS Vs TORTOISE Point Motors / Switch Machines at Chadwick Model Railway | 208.
18:26
Arduino based servo point motors and options for controlling electrofrog polarity
42:31