Pinterest Stumbleupon Whatsapp
Ads by Google

plc programmingIn the world of manufacturing, there are computers, and then there’s computer automation.

While you may think you know all there is to know about computers, you just haven’t even scratched the surface of using computers to automate things until you’ve used a programmable logic controller – known in the automation industry simply as a “PLC”. A PLC is nothing more than a computer with a processor, except that the architecture is created in a way that is focused on interacting with the outside world. It gets information from the outside world through inputs – digital and analog sensors, relays and other assorted gadgets. It interacts with the real world through outputs – motors, valves, conveyor belts, actuators and much more.

In between all of the inputs and outputs is the PLC – the heart of the beast and the brains behind the entire operation. PLC programming makes the decisions based on input from the real world, and then immediately interacts with the real world through the outputs – all in fractions of a second. These are essentially robots.

Where Computer Automation Programming Came From

Before computer systems, manufacturing equipment was all manually controlled. What that means is that a person would press buttons to directly control devices. For example, an operator might press a button to move a conveyor belt until a bottle is underneath a spout. Then they would press another button to open the valve and fill the bottle, and then press the conveyor button again. This was the stage of automation that initially replaced (and in some cases saved) human hands.

plc programming

The evolution of PLC programming came from how these “manual” control systems were wired. In many cases, there were some “smarts” factored into the electrical wiring in order to safeguard the machine. The schematics included input push buttons and output contact relays that looked like the following on the prints.

Ads by Google

how can i learn plc programming from home

Those are contact relays – one is called “normally open” and the other “normally closed”, meaning that one would close the electrical circuit when activated, and the other would open it. Relays could be activated by anything – a pushbutton, a limit switch struck by an object, etc. On the output side of the wiring, electricians would use the following signal to represent an output coil that might turn on a motor or other device.

how can i learn plc programming from home

With the advent of not only computer processors, but also advanced sensor devices like infrared proximity and level sensors, many of these “manual” processes where a human being still had to make decisions, started getting replaced with computer automation programming inside these high-speed processor units called PLCs.

So, what makes a PLC different than a regular computer? PLCs are made to cycle quickly, and to interact quickly with the outside world. If you look at the first image in this article of an Allen-Bradley PLC system, you may be surprised to learn that only the very left module is the actual computer. The bulk of the “rack” includes various modules that interact with input sensors or devices, and then other modules to control output devices as well.

As these systems were being used to replace systems that used to be wired and maintained by electricians, the control “language” had to be something that those electricians could understand. That was how “ladder logic” was born.

Computer Automated Programming Uses Ladder Logic

While this may change at some point in the near future, up until now these PLCs utilized various versions of “ladder logic.”  Ladder logic is a programming language that looks very much like those old style electrical diagrams and those electrical symbols, but it’s laid out inside the processor in a sequential “program” that controls everything.

how can i learn plc programming from home

This PLC programming looks like an electrical schematic, but these are only symbols used to represent some function.  Input relays are examining some sensor in the real world, the output symbols are turning on or off a real-world device, and any boxes in the middle represent various mathematical calculations or other “functions”, just like you’d have in any other computer software.

They are laid out on “rungs” in the program – and all rungs are scanned nearly simultaneously. If you think about how computer programmers are accustomed to writing sequential programs where the script is processed one line at a time – it can take some time to get used to writing a program where everything is happening all at once.

But if you consider how quickly an automated “robot” has to respond to any change in the real world, you can see why this quick scan time is critical.

plc programming

When it comes to the high-volume, precise demands of the high-tech manufacturing world today, you can see why these high-speed, programmable computers are at the heart of what gives any manufacturer a competitive advantage.

Automating any process involves understanding the process, understanding the machinery, and then thinking like a computer programmer so that you can tell that PLC exactly how to do what 2 or 3 human beings previously had to do by hand.

Even better, once you use a computer to do those things, you can also take instant measurements, conduct tests and collect data so that information becomes immediately available to you in a database or on a web-based display.

Have you ever had a chance to interact with automated PLC-controlled systems? Are you a PLC programmer? Share your thoughts and experiences about this technology in the comments section below.

Image credit: Sistemart, Elmschrat, Nuno Nogueira

  1. saddam hafeez rana
    January 15, 2016 at 5:09 am

    i am very intresting in PLC and i learn more about PLC

  2. Joseph Henry
    July 3, 2015 at 11:46 pm

    Ryan: If you have not seen it yet, you may be interested in the PLC programming best practices and advice at http://plc-training.org For each of the 10 sections, there is a yellow "Best Practices" button at the bottom of each page. Hope you and your readers pick up something new here. I have been working with PLCs for 20+ years, still picking up new tips and tricks. And I thank everyone who contributed.

  3. Mccormick
    September 26, 2011 at 12:57 pm

    Ive been doing it for over 13 years. I havent ever worked in a facility where anyne but me remotely understands what I do. We are typically called Controls Engineers, and it a great job that is a hybrid of screen time and hands-on. I could never sit behind the screen my whole life like most software developers have to.

    • praveen anand
      June 12, 2015 at 5:56 pm

      Wow Mccormick, I am truly amazed by your words " it a great job that is a hybrid of screen time and hands-on". You described what I feel it everyday when I program a PLC. Good job.

    • yemi
      August 24, 2016 at 4:28 pm

      I like your description of this job a lot. I currentlly work as a web developer but looking to gon into the automtion/control engineering field. which courses do i need to take? - oteyowo77 atte yarhue dorte corme

      • Ryan Dube
        August 26, 2016 at 1:24 am

        Typically folks who get into automation and controls engineering come from Electrical Engineering degrees.

  4. Ryan Dube
    September 18, 2011 at 2:12 pm

    For anyone that's interested, the most commonly used modules in the industry are analog i/o, digital i/o, motion control, and temperature sensing (T/C) modules. While there are many unique modules out there for a variety of purposes, most control systems - at least in manufacturing - can be built using those four core types of modules. There are other areas like automotive controls or flight controls where that's not always the case and systems become a whole lot more complicated (and interesting!)

  5. Albyxx
    September 18, 2011 at 2:04 pm

    Referring to your PLC rack photo the left most module is actually the power supply. The PLC is the second module from the left.

    • Ryan Dube
      September 18, 2011 at 2:06 pm

      It is an open source photo from wikipedia (see photo credits). The left most module is the PLC. The Power supply mounted on the left isn't a module, it's a power supply.

      • Albyxx
        September 18, 2011 at 2:39 pm

        No worries, Ryan.

        It's just that when I read your very clear laymans terms article I got the impression that the PLC was being described as the power supply.

        I've been programming PLC for almost 30 years now and no-one outside industry and automation understands what I do, including my family. Now I have this article to point them to.Thanks.

        • Ryan Dube
          September 18, 2011 at 3:05 pm

          Thanks - it's great to meet a veteran! I've been in the field for about 14 years now and have had the same problem...thanks to Aibek and Mark for letting me cover this topic. I did hope that it would help people realize that the "computers" that run manufacturing are quite a bit different than your everyday computer - and hopefully it will entice students to explore what the field has to offer. Thanks for your comments!

  6. Ryan Dube
    September 17, 2011 at 1:34 am

    Michael - the security all depends on how you arrange the architecture. From what I understand, in the stuxnet case it was actual contractors hired to work on the machines, or at least on the PLC software, that introduced the worm.  Any automation engineer worth his salt will isolate PLC's running important production machines from the larger general network, and nowhere near the Internet.

    Of course, these days with web-based HMI packages connecting directly to factory-floor PLC's in order to deliver data directly to Internet-based customers, clients and managers - that security is quickly disappearing. It's a challenge these days, but that's what routers and strong firewalls are for.

    Anyway - there aren't a whole lot of hackers writing PLC viruses out there...yet, anyway. I suspect in the future there will be many more.

  7. rob
    September 15, 2011 at 2:04 pm

    There are some open source platforms available for anyone interested in getting started with PLC programming.  Just google, 'Anduino'.  There was a few really neat articles in 'Make' magazine a month or two ago about  it.

    • muotechguy
      September 15, 2011 at 3:30 pm

      Good tip Rob, my arduino arrived today and you can expect to see lots of arduino beginner articles in the coming months! ;)

    • Ryan Dube
      September 21, 2011 at 1:17 am

      Anduino is a good way to learn microprocessor programming - sort of how EE's are often introduced to assembly-level programming in college. It isn't the same as ladder-logic, since ladder logic includes many more components for reading input and controlling output in the "outside world" - meant for high-speed machine control, and it's less like the sort scripting when dealing with microprocessors on the Anduino scale. Not that Anduino isn't cool - but I wouldn't point folks in that direction if they're interested in learning PLC programming. 

      To learn PLC programming, it's important to get accustomed to dealing with the rapid scan-time of ladder, and dealing with so many things happening at once and out of sequence.The only way to learn is to practice dealing with i/o through PLC trainers: http://www.ind-concepts.com/Allen_Bradley_PLC_Trainers.htm

  8. Anonymous
    September 15, 2011 at 5:22 am

    I was not able to read it lol... I'm a mechanical engineer I just couldnt take it hahaha

  9. Mike
    September 15, 2011 at 12:23 am

    Outside the computer world the only programming I ever did was CNC programming and EIB. Not sure if logic gates count - they are probably more "electrical" interesting than programming wise.

    • Ryan Dube
      September 15, 2011 at 2:08 am

      I would say logic gates count - you are essentially programming with them...it just takes a bit of creativity to do what you want to do!

  10. Novamansa
    September 14, 2011 at 10:32 pm

    PLCs, just like computers have evolved over time. Originally many PLCs were simple replacements for relay panels that included some wired OR and AND logic. They would also include simple timer functions. Nowadays the PLC computing power includes data manipulation, proportioning math functions for servo control and much more. Ladder programs can now be very long and delay real outputs by hundreds of milliseconds. So not only does the programmer have to evaluate the logic of a manufacturing process but also consider the order in which some processes are evaluated. Because the PLC interfaces connect to real world moving devices (hydraulic rams, pneumatics, motors etc) the safety of operators is very high priority. Having programmed such PLCs a lot of thought has to be given to what will happen if an operator, for example, presses the "wrong" button in the middle of a program. This real world programming imposes a discipline on programming that sometimes seems lacking in the closed environment of a computer. 

    • Ryan Dube
      September 15, 2011 at 2:07 am

      I agree - it's really amazing how far the automation industry has come. The newest processors from Allen-Bradley feature modules for scripting, so you could write routines in C, VB, etc... PID loops are getting more intelligent all the time. It is a very cool field to be a part of.

Leave a Reply

Your email address will not be published. Required fields are marked *