Controlling Kato Turnouts with an Arduino!
Вставка
- Опубліковано 7 вер 2024
- Welcome back everybody! Be sure to Subscribe!
In this video we take a look at how to control Kato turnouts with an arduino! It's actually a lot easier than you would think!
Code for Arduino
docs.google.co...
Arduino UNO
amzn.to/2XeN10h
Arduino L298P Motorshield
amzn.to/2BMXgzE
Bread Board
amzn.to/2EmHKfH
Additional components
amzn.to/2EmsI9N
Wires
amzn.to/2GRC0Mu
Power Supply
amzn.to/2GVu1OC
Support the channel with some Merchandise!
teespring.com/...
You can contact me at diyanddigitalrr@gmail.com
I've been looking for a way to get LED indications for Kato turnouts on my switch panel for hours - finally found a way to do it without relays! Thank you.
Awesome! I made my own slow mo switch machines using servos and SPST switches with red/green LEDs. The total cost of the build is about the price of one switch machine, and I can run 12 servos with the library, but only 10 with the number of pins I have.
Absolutely fantastic! I just followed your setup myself and it worked almost flawless. There are a few duplicate lines I removed, but I think otherwise everything worked fine! Thank you for the great info! Looking forward to trying the signal code next.
One other quick note, I looked over the code for a bit and realized you could simplify it a bit further. Let me know if you'd like, I can send you it. I tried it out a number of times, and it simplified the process. I'm going to turn it into a class and I'll share it with you if you'd like. This way you can upload a library eventually that makes it "configurable". Hope that helps!
Wonderful series you are doing. To your critics I would suggest the easiest way to do something is hire someone to do everything for you and learn nothing. You are teaching many great skills with a tactile result. Keep up the great work.
Thank you for this video. I didn't want to re-invent the wheel to control Kato coil turnouts on my T-Trak project. I will be porting this to microPython and a Lolin mini ESP32 board with motor sheild. Plan to have module to take to shows and run as a layout at home..
Hello for France, sorry for my bad language. I'm a neewbie with the arduino. Your tutorial and explications are a great mine of information and solution for me.
Forgive me for asking what may be a dumb question: I see a lot of videos of prototypes done on breadboards, but how do you move forward to the actual layout? Do you still use the breadboard underneath with longer leads? Or is it all soldered connections?
i am trying to buy an arduino L298p Motor shield. the ones I have found Don't have a switch in the upper left hand corner or the little box on the left side attached to the PC. does this matter? Keep up the great videos. Thanks Barry olson
Thanks for the video. Have you figured out how to determine the switch position at power up? Eg, if you leave the switch on the divergent route when you shut down for the day, then come back and power up, won’t the sketch make the assumption the switch is set for the mainline?
i saw the same issue. on startup, lights will show green, but switch is in unknown position. can be easily fixed by adding "switchstraight(0);" as last line in setup(). this switch position will now match the light.
How do I also control this Kato turnout from a DCC-EX CommandStation? I’d like to do it both ways - 1. In my DCC-EX automation and by an analog momentary switch.
Same here.
Great video Jimmy nice job. The reversing loop you mentioned there is a video on this you tube somewhere I have seen however the guy doing it has only done 1 end of a reversing loop if you did a video teaching how to 2 ends that would be very cool keep up the amazing tutorials regards Paul
This is a very good and well described. Thanks for your help! Will this only work on Kato uni-tack turnouts?
First of all, new subscriber, find your posted vids excellent, that well I decided to invest in the Arduino Uno kit, but I do have a few questions, 1.can I use light detection resistors to activate the points? For the purpose of automating the layout. 2.how would I go about using this method? As new to the world of Arduino. 3.do you have a vid on this sort of thing already? I have seen the one where you use a servo but I wil be using Solenoids
Another great video Jimmy. Where do get the time to do all of this stuff? Thanks
hi Jimmy... pretty cool of all the stuff you can do with arduino... thx for sharing... vinny
Also - (3) did you power both the Kato turnouts in the crossover - or just the one? If just the one could you power both from the same Arduino?
Also - (4) can you use the same 5v power supply to power multiple Arduinos powering multiple Kato turnouts around the layout?
Dennis
You can use a single power supply to power all of the Arduino microcontrollers and turnouts with their respective voltage requirements as long as the power supply can deliver enough current. Also, you can control multiple turnouts using a single Arduino board(each turnout will require two digital pins of the Arduino board) and using an L298N motor driver module which can drive 2 turnouts each. If you want to control a large number of turnouts, get an Arduino Mega board, it has more than 50 digital I/O pins.
Looks very good and quite easy to achieve . . . however (1) what is the advantage of using an Arduino? and (2) can you now connect with a DCC system and add an accessory decoder and hook up to JMRI?
Dennis
So the real advantage of this is when you need to automate a turnout. Kato Turnouts will always cause a short circuit if a train crosses them when they are not thrown in the proper direction. One of my longer term projects is an arduino based DCC reversing loop, and this automation of the turnout is key to that project.
In terms of DCC, it is possible, you would have to figure out how to make it controlled by a decoder though.
@@DIYDigitalRailroad
Would not using insulated rail joiners on all 4 tracks exiting the turnout avoid the short? That's Mike Fifer's solution.
I have only just started researching Kato for a new layout and there seems to be some confusing inconsistencies. For example the #4 turnout seems to have solved the problem you mention by being either "isulfrog" or "electrofrog" (to use a couple of Peco terms) by moving a little screw on the rear. I am guessing that this is an enhancement that Kato will add to the #6 turnout once their inventories of the old turnout are sold.
Dennis
Using a DCC decoder to control a turnout from a DCC control station is more expensive than using an Arduino microcontroller to do the same, in fact, an Arduino microcontroller can also be used to make a DCC decoder, combining that with a motor driver will allow it to control turnout switches using the DCC control station and you have got your own stationary decoder. Here is a DCC decoder made using an Arduino microcontroller board:
ua-cam.com/video/Uix0lzoN84w/v-deo.html
Thank you very much for sharing this great how to video
The man from Amazon is on his way with another Mega and a shield. I have some spare Kato points so will probably be trying to get it to work on Christmas Day, I'll keep you posted if you like?
great tutorial.
Thanks
I'm assuming that you could add more code to use additional pins on the Arduino to use the other motor output on the shield to control a second turnout. Could these shields then be stacked until you run out of pins on the Arduino to keep adding turnouts to the controls?
Also, the reversing loop mentioned elsewhere in the comments sounds intriguing. Ive avoided them so far in my layout design because thinking about how to make the polarity work without shorting anything out makes my brain hurt whenever I think about it. I'd love to see a tutorial about that once you've figured it out.
Nice tutorial. I just build my first DCC++ system using one of your videos. Now I would like to add 2 Bachmann turnouts. They are the normal dc turnouts. Can I still use the same motor shield to throw the turns using JMRI?
Bachmann turnouts are actually snap switches which require different wiring. Here is my tutorial on snap switches ua-cam.com/video/OZw8n_Sn_eE/v-deo.html
Interesting and it seems almost unique tutorial on how to control Kato turnouts with Arduino. I have a total of 16 that I ultimately want to control via the JMRI GUI rather than push switches, should this be possible if I invest in an Arduino Mega?
This is a research project of mine with CMRI and JMRI.
What Size Resistor ???
Is there not four servo outputs on the board that you can use?
Could you achieve the same thing with a Nano? Don't know a whole lot about Arduino so I was just curious.
Can you use this L298p Motor shield for a DCC++ system? Use motor A for the DCC++ train control and motor B for programming and Kato switch power? If so, what are the pin assignments for the two motor channels? Another tip: on the button switch, wire one side of button to ground. Other side to a digital/analog pin. Use the Arduino built-in pull-up resistor via PinMode(button, INPUT_PULLUP); this eliminates the external resistor and 5vdc power wire. I assume for multiple turnouts, use a 1/2/4/8/16 relay board. For additional digital IO pins, use I2C to control up to eight HiLetGo PCF8574T IO Expansion Boards with 8 I/O pins per board. Thanks for the videos. I am at the planning stage of an Kato N-scale layout with 9 car ferrys (10x ferrys) as staging. The ferry arrives as a 3 foot section of un-powered track on a board.
Awesome video, Jimmy!
Is there a way you could help me tweak your code to use two bi-color LED's? I'd like to be able to show RED on the mainline and Green on the Diverging track when the switch is thrown. And vice versa... Hope this makes sense to you...
Hey David! If it’s 2 separate LEDs, all you have to do is wire one signal opposite from the other. So connect the main red and diverging green to the same place and vice versa.
@@DIYDigitalRailroad Another quick (probably stupid) question: Can I use a standard momentary button switch? It only has two leads, so how does that get hooked up in place of the little push button in your demonstration, which appears to have 3 connections?
No stupid questions! Yes you can!
I know this video is over a year old and it looks like you have made changes to the sketch over that time. It looks like the snap switch sketch is what you are publishing now and that is fine because it does work with the L9110s and L 298n motor drivers pushing Kato turnouts. I was wondering what happened to the LED part of the sketch? I tried adding them like the original video shows about Kato turnouts and get very strange errors. Above my head . Could you give me ideas on adding the LEDs back into the sketch.?
Let me take a look at the old sketch and modify it.
@@DIYDigitalRailroad Thank you
Hi can you post the code to your site? Also how many turnouts will the L298P shield operate?
Whoops! I thought I did! I will do that when I get home tonight!
Hi again I can't find where you posted the code.
@@michaelmeredith6929 Sorry for the delay. Here is the code. docs.google.com/document/d/1Q-Ou9vSzVKzSx91fTXGOHeweL08_AWO9wO7ahMLRqVw/edit?usp=sharing
Thanks a lot. ...Michael
I just found your channel after hearing about it being hacked from Ron's Trains and Things. I am trying to duplicate what you have done but I get an error in the google docs code at the last step involving the switchstraight case. I get the error "a function-definition is not allowed here before { token". The code looks like the step above for switchturn, so I am at loss as to what is going wrong. Any thoughts? Great channel, I am new to the Arduino world but I am diving in to give it a try on my layout.
I will try to duplicate the error and get back to you.
@@DIYDigitalRailroad I am rewatching the video, and the file linked in the notes does not match what you are typing on the screen. I will revise what I copied to the IDE using what you are doing in the video and see if that works. On a side note have you looked into using 12 volt relays and sending a pulse for X msecs to throw and release a switch.
No Joy, it still has same error in the switchstraight part at end. If it matters I am using Arduino 1.8.13.
@@rahoover427 I will give it a shot tonight.
@@DIYDigitalRailroad Thanks, not a big deal, still working on getting DCC++ and JMRI to work as well. I went over to your Arduino Block Signal video and tried that one and get the same error on the last loop statement as well, maybe something in my Arduino setup.
How difficult is it to connect this setup to servos? That's what I have on my lauout. Plus I have about 40 switches. Can one ardiuno control all that.
This particular motorshield can only power 2 servos at a time. I believe there are connections that can power up to 4 at a time. You would need multiple arduinos to control 40 turnouts. I am planning more tutorials on different types of turnouts.
@@DIYDigitalRailroad Thanks for the reply. Watching your videos has sparked an interest in model railroading. My field of interest is in automation. But in the past it was getting expensive. Now with ardiunos I am thinking of dusting the layout off and going at it again.
@@DIYDigitalRailroad okay, but my idea here would be this: use a multiplexer and relais. Then you need only 1 motor shield, lop the signal to the ralis contacts, and select the needed outputting relais via the multiplexer. This way you can also easily throw multiple switches, and switches rows.