Yes, mrr2 is back up on its side, but were putting in some heavy Electronics here and were getting pretty close to where we can sit it back down for good and today, Im showing you guys, the installation of my entire switch control machine that is Arduino based And Im going to explain why I chose to do this, but lets go ahead and get started with the construction of this first things. First, we need to attach some electronics and Im using my tried and true method of just some simple hot glue to attach the three motor drivers that I will need again. All the parts are going to be linked in the description below next I go ahead and attach the Arduino Nano Shield Im using an Arduino Nano to control all of the turnouts, and this Nano Shield puts these terminal Connections in there, making it easy to wire up Now, its time to wire everything up and Im going to be using wires with Dupont connectors on them, these actually work really great for putting in these terminals for little short runs now, each turnout needs two wires to connect to the motor drivers. So, Im going to be using 10 pins on the digital side. Fortunately I have 13.. So that is what were doing right here. Foreign. One of the big reasons that I use those Dupont connector wires is that the motor drivers have the DuPont connectors on them, which makes them extremely easy to wire up now they have one two three and four on the pins, so one and two control one of The motors and three and four control a another one.

Now, if youre wondering to yourself, this is all great Jimmy. But how do you know what to wire up, and how am I supposed to know what to wire up well: Ive done an entire video on how not only to wire up a tour to switch motor, but using slightly different components. How to do a snap switch and Ill link that, at the end of this video, alright, so what I just did was: I am using digital pins, two through 11, to connect to the motor controllers. Now what this is is, basically, you got ta have two pins per controller, just to tell the motors which way to go if youre, connecting this to a regular motor now were going to be using this to throw the tortoise switch Motors in two different directions. So I have all these pins and Ive connected them right here, and that is what we are doing right there to make things easier for wiring everything Im going to attach some terminal strips that will make connecting wires a whole lot easier. This one in particular, will be used for the five buttons that will control the turnouts and also for the power and ground connections now Ill need. Five Connections in total and Im hooking up the buttons to my analog pins, which will be a0 through a four and each one of these will connect to the terminal where I can split it off and ground the button so that it can read properly Im.

Also going to connect a 5 volt connection, a ground connection and a VIN connection which will power the Arduino this right here, the red wire is going to be my five volt connection, where I can connect things to 5 volt power from the Arduino and then Im. Also going to connect a ground wire right here, thats this white wire right here and then Ill also have the VIN connection, which is the black wire right here. That is whats going to bring power to the Arduino from the eventual 5 volt Hub that I hook up now, because Im going to have so many ground connections that it might be too much for that single terminal port to share Im actually going to put an Entire separate, smaller terminal strip in just to handle all of my ground connections. I do this using some jumpers to connect all of the terminals together. Next up, it was time to hook up all of the ground connections, and this is a lot of wiring and youre. Probably saying to yourself right now Jimmy this is a ton of wiring period and Im having trouble following it well, the bottom line is, if I tried to explain all the wiring. This video would probably be between 30 minutes and an hour long, but what I did was made you a schematic with everything and Ive attached it to the GitHub file, with the sketch to load onto the Arduino and Im going to put a link to all of That, in the description below now its time to wire up the tour to switch machines, tortoises have eight connections on them and connections.

One and eight which are on each end are for controlling the switch motor, so well need to go ahead and attach wires to pad one and eight. These are very easy to solder to, as a matter of fact, theyve got a little hole in them that you can hook a wire through and then just drop a little bit of solder. I know that there are connection terminals that you can put on these, but Ive never had an issue. Soldering, a tortoise switch machine, its a super, simple process, but all you have to do is that and then we can hook them up to our motor drivers so that we can power them. The l298m motor driver can control two tortoise switch machines. At the same time. One of the two terminal connections is for one motor and the other is for the second one. All you have to do is connect your wires there. It doesnt matter which one goes where it only matters. If you are going to be doing some signaling control by the Arduino with the tortoise, then youll need to know which one goes where so that you can have correct signaling but thats a whole other issue and were not tackling that today. Now its time to install our 12 volt terminal power, distributor, youve seen me use similar ones to this on mrr1. They work great for Distributing power. They also have a barrel plug Jack so that you can just plug any 12 volt DC power supply into it, and then you just connect wires to it and youre ready to go.

This one was slightly different, though, and Im going to go over it at the end of the video. This will eventually be used to power anything 12 volt on the layout right now, its just going to be used to power the three motor drivers so Im just going to connect those wires up to it again, its a little bit hard to see right here, which Is why I created that schematic and the GitHub page, and that is linked in the description below now Im going to need different voltages for different things on this layout, so I figured Id go ahead and install a different voltage power supply here. Originally, I was going to do five volts, but Im actually going to end up having this be a 9 volt power supply. This will power any arduinos. I have without any risk to any of the circuitry sure you could do it without the 12 volt power supply, but this works just fine too. I use a DC Barrel plug adapter to go ahead and connect to the power input on this particular terminal. By the way, I use hot glue to attach this one too thats, why you saw me just push it up there Im going to have all these parts Linked In the description below, and then the next thing that I did was just connect the wires that are Going to run power to the Arduino, I then connected my wires from that terminal to my Arduino, using the terminal strip that I had right here, which made wiring it a whole lot easier, its a lot easier to do these big screw terminals, rather than the tiny Ones on the Arduino Nano Shield, one of the last things that I did was connect all the ground connections to the button wires of where theyre going to come into the terminal.

Now at first I actually did this incorrectly and I had to do a fix before the final product and Im going to actually go over that in just a second next, I put some power on the layout Itself by using some Loctite power grip to glue a Power strip onto one of the legs, I always like putting a power strip like this on the layout, makes it really easy to power and then were going to plug everything in before I get to running it. I needed to rewrite my Arduino toward a switch motor code to be able to handle five tortoise switch machines. This is a really complicated thing right here and its also very specific, so I didnt want to do a whole tutorial on it, but I am going to put this code up on my GitHub page, along with the schematic, and if you want to check out how To control a tortoise switch machine with an Arduino Ive done a whole video on that, like I mentioned before, and that will be linked at the end of this video couple of things. That gave me a little bit of a headache that I wired incorrectly, that I just want to go over. One was originally. I thought I could just do one resistor for all of the buttons to go to the ground, so I had one resistor right here. Well, that didnt work out and my signals kept getting crossed. So what I ended up doing was doing making these little resistor jumpers with 1K resistors that are putting some heat shrink that connect to wires, and these little jumpers are for each of my five buttons that are going to connect and that fixed everything.

Just has a 1K resistor connected to some wire that are doing my from the button connection to my Ground Terminal. Now the other thing that actually gave me a lot of headache and I think its because Ive never encountered one that was created like this – is the my 12 volt terminal strip right here, and the reason that it gave me a headache is a. I didnt look at it properly because I bought a ton of these and it looked identical to the rest of them, but it actually has little spots for different terminals, with your positive and negative, rather than having one side be positive and one side be negative, which Is what literally every other terminal Ive ever used like this had so I had everything wired up and I could not get my motor drivers to turn on and have these little lights right here and I could not figure out why and then I looked at it And I actually had to grab my volt meter and I tested it, and I was like oh wait. This is where Im getting 12 volts not across this. So I just rewired that and that fixed that right up all right, everything is wired up and powered up, and the only thing I have right here is: I havent done buttons on the fascia yet because I plan on making a panel, but I have a little Test button wired up right here and we can just see how everything works foreign, so we can see now that everything works now theres a lot simpler ways.

Frankly, to do these tortoise switch machines and youre probably wondering why well Jimmy. Why did you decide to use an Arduino and all this complicated wiring to do the tortoise, switch machines when you could just use some toggle switches or something like that? Well, first of all, it wouldnt be me if I wasnt using an Arduino, but second of all, this is going to allow for a lot of potential customization. So lets say you want to control multiple turnouts simultaneously with specific functions and things like that lets say. For example, you have a yard ladder with these or another type of turnout that you can just modify the code, for you can tell a button to actually control and align switches rather than having to do the manual itself. So you can just have buttons on the specific sightings of a yard ladder rather than having to flip two turnouts. You can just hit that one button and itll align everything simultaneously and because Ive done everything right here, all I have to do is do some modifications to the code that are fairly simple. That would be able to control all of these. So when you are looking at something like this, its not necessarily The Simple Solution but its going to allow for upgrades and modifications and more complex things down the road so doing all of this work now is going to make things simpler. If I want to try something different like lets say with my runaround track, having both turnouts on each end, throw simultaneously to realign everything so thats, why I did all of this Ive still got a lot of work to do.

I got to put all the buttons on the fascia, so obviously Im not going to be reaching under the layout and grabbing a button. So I got to make that panel and put that on there. So I got to make my button leads longer, but everythings just going to hook up right here, its going to be nice and simple and Ive got to do some cable management, because thats not that great that doesnt I got ta I got ta, do some better Wire management so thats what Ive got going on Im nearly finished, putting all of the electronics in for mrr2 a lot of cool things going on on here.

https://www.youtube.com/watch?v=KSQoQiSwAwo