https://www.automationdirect.com/brx
(VID-BS-0002) Learn how to create Pinewood derby finish line controller using a Factory Automation PLC
Our FREE Practical Guide to Programmable Logic Controllers eBook: https://www.automationdirect.com/ebooks/plc-handbook
[Music] oh yeah programmable logic controllers or plc's are typically used to run factory equipment and you're probably even wearing or using something right now that was made in a factory controlled by a PLC and somebody had to program the PLC to make that happen in this video we're going to use the PLC to decide which Pinewood Derby car wins the race let's let assume that the Pinewood Derby track Electronics has sensors wired to the PLC to tell us when the cars have crossed the finish line now as soon as the first car crosses the Finish Line we want to turn on the light over that car's Lane to indicate the winner so it looks like our PLC needs to watch these two Finish Line signals and it needs to Output these two light signals we'll have the Finish Line wires come into the PLC on inputs X1 and X2 and we'll control the winter lights from the plc's output Terminals y1 and Y2 let's also assume there's a reset signal to clear the lights and get us ready for the next race we'll have that signal come into the PLC on input x0 now our job as a PLC programmer is to watch these Finish Line signals make a decision and then turn on one of these outputs to indicate the win of the race and also to use the reset to clear the lights plcs come in lots of different shapes and sizes we're going to use this do more PLC from automation direct because the software is free and it has a free built-in simulator so we can test our code without having to buy any hardware if we were going to use a real PLC and not a simulated one we would set it up like this first you get a Bas this is a nine slot base but you can get them in several different sizes this is one I just happen to have laying around then you select the processor you want this is the do more processor that comes with the free software and free simulator okay we need some inputs to read those Lane sensors right so we grab an input module like this one and plug it into the base now based on that diagram we had a second ago we wire Lane one to terminal one lane two to Terminal Two and our reset button to terminal zero and we'll also need a wire to supply our reference signal to the sensors Let's see we need two outputs to turn on the lights so we add an output module this one has 16 outputs we only need two of the outputs for this project one for each light we want to turn on from our diagram we want to wire light one to terminal one and light two to Terminal Two and again we'll need a reference signal here for the lights so again if we were using a real PLC that's how we would wire it up the good news is we don't have to buy and wire up a PLC to try our program the do more software comes with a free simulator which looks like this using this we can test our code for free let's see it looks like this simulated PLC has 16 inputs x0 through X15 again we're only using x0 one and two right and when we click on these buttons it's just like the track Electronics sent us a signal this X1 input is Lane one the X2 input is lane two and the x0 input is our reset button the simulated PLC also has 16 outputs y0 through y15 again we're only using two of them y1 and Y2 to turn on the Finish Line lights there's a bunch of other stuff here but we don't need to worry about that for this program okay so let's write our program go ahead and launch a software and you should get a screen something like this now we want to start a new project so we click on new let's give it a name I'm just going to call it PWD for pinewood derby now you want to make sure you're connected to the do more simulator and then say okay great we're ready to start programming here we go plcs use something called ladder logic because it looks kind of like a ladder each line of code is called a rung like a rung on a ladder think of this as the power and we want to connect that power to drive an output like a light or a motor in our case it's the Finish Line lights now right now this power is running directly across this wire to the output but we want to control the output based on our Finish Line signal right so we highlight this block and we click on this contact right here and let's give it a name let's call that finish one that's a sensor that tells us when the Pima derby car has crossed the finish line now the software needs to know which input that's connected to so click on this guy right here and let's see finish one was connected to X1 right we say okay so now when the P derby car crosses the Finish Line This cont will close and it'll let power flow down to what well we need it to flow to our Finish Line light right so click on that and we want to set the winter light so I'll call it winter Light number one and say okay the software wants to know what that's connected to so winter light one is connected to what y1 exactly great so now when the car crosses the Finish Line it'll turn on light one let's do the same thing for lane two we need to put a contact here we'll call that finish two the software says what input is that connected to well that's connected to X2 and he's going to set the signal at winter Light 2 again the software wants to know what terminal that's connected to that's connected to terminal Y2 on our PLC and we're ready to go now the only problem with this this is not really what we want to do is it all this is going to do is turn on the light when the car crosses the line for both of them we really want only one light to turn on and we want it to be the light of the winning car don't we okay well how do we do that let's see if the car crosses the line and light two is not lit yet he must be the winner right well that's easy click right here and grab this contact right here and put winter light two in there let's try that okay so what this says is this contact is always closed until witer light two goes active so in other words when the car crosses the line it'll close this switch it'll see this switch is already closed because Car 2 hasn't crossed the finish line yet and it'll light our light we need to do the same thing down here if Car 2 crosses the line but Light number one is not lit then we need to turn on light number two so let's do that cursor right here use this guy we want winter Light number one now and say okay well great this is exactly what we want if car one crosses the finish line and Light number two is not lit then turn on light one if car number two crosses the finish line and winter one is not lit then turn on light two we need to do one more thing we need to reset these lights when the user presses the reset button well again come over here grab a regular contact and we want the reset line which we assigned to x0 to reset that's this guy right here the two lights we need winner one and here's a trick with the cursor right there hold on the control key press the down arrow and let go of the control key now we can add another light here so we want to reset again that's this guy winter Light number two well that's our whole program this is Lane one this is lane two and then we can reset the winter lights when we're done this yellow line here says we haven't checked our program yet so you hit this check mark and it verifies that everything's great the green line means we haven't saved it so I'm just going to save it real quick and we're ready to go now normally we would download this to a PLC we don't have a PLC so let's bring up our simulator click on the simulator button right here a little dialogue comes up telling me about it just say Okay say okay and it's asking us what do we want to do do we want to go online with this PLC and view our disk project that's this guy right here do we want to go online and view what's currently in the PLC no we don't want to do that do we want to cancel so we want this guy and it's warning us it's saying hey the PLC does not have this program in it yet yeah we know that so let's continue and we're ready to go here's our simulator right here now there's a lot of stuff here but we really don't need very much of it all we need is these three inputs right here x0 1 and two and the two outputs y1 and Y2 right now this switch right here tells me that the PLC is in stop mode we need to bump that up to terminal mode so we can program it to write the program to the PLC we just hit this button right here we're going to take this program hit this button and that transferred the program down to our PLC let's go ahead and run our program by clicking on run and we should be ready to go if the car in lane one comes down and trips the Finish Line sensor which we know is connected to X1 what happens sure enough the light connected to y1 lights up and then when car2 comes down and trips his sensor nothing happens that's exactly right okay let's get rid of those guys let's reset our lights remember that was x0 and try it again this time Car 2 comes down he hits his sensor and sure enough that light lights up saying Car 2 won the race when car one comes down nothing happens perfect that's exactly what we wanted so that's all there is to it we now have a Pinewood Derby track controller that tells us which car won the race what if we wanted to modify this program to control a four-lane track how would we do that well it would look a lot like this it's the exact same program except now we've added two more rungs of ladder to handle Lane three and Lane four and now each lane needs to check all of the other lanes before lighting its light for example Lane one needs to check the lights two three and four before lighting its light in lane four needs to check Lanes one two and three before lighting its light otherwise it's the exact same thing that we did before isn't it then we have to do one more thing the reset button needs to reset all four four lanes not just two and that's all the logic you need to implement a four-lane track so for your project I'm going to challenge you to see if you can do an eight Lane track controller that wouldn't be hard at all would it you're just going to add four more rungs of ladder for Lanes 5 through eight and you're going to clear lights 5 through eight that's it then you have an eight Lane controller see if you can program that and test it in the simulator well that's how PLC programming goes the bigger the factory you want to Monitor and control the more rungs of ladder logic you add and now you know how to do it now please understand this was a very simple example of what a PLC can do plc's can do a whole lot more but this should be enough to get you started and hopefully help you understand that maybe someday you could be programming the controllers that run our factories check out the resources listed on the website to learn more about programming plc's with latter logic we want to thank automation direct for supplying the resources for this video automation direct sells plc's and just about everything else you need to automate a factory including sensors wire Motors drives push buttons lights tools safety gear servos just about anything you can imagine so if you want to learn more about Factory automation check out automationdirect at automationdirect.com
Voted #1 mid-sized employer in Atlanta
Check out our
job openings