PLC vs Arduino Show Down

Hackaday readers don’t need an introduction to the Arduino. But in industrial control applications, programmable logic controllers or PLCs are far more common. These are small rugged devices that can do simple things like monitor switches and control actuators. Being ruggedized, they are typically reasonably expensive, especially compared to an Arduino. [Doug Reneker] decided to evaluate an Arduino versus a PLC in a relatively simple industrial-style application.

The application is a simple closed-loop control of flow generated by a pump. A sensor measures flow for the Arduino, which adjusts a control valve actuator to maintain the specified setpoint. The software uses proportional and integral control (the PI part of a PID loop).

Although the Arduino has a good selection of I/O pins, it doesn’t have common I/O capabilities you’d expect in an industrial controller. For example, the flow meter used in the demo produces a current proportional to flow ranging from 4 mA to 20 mA. That’s a very common set up in an industrial device since current loops are able to handle long wire runs, along with other reasons. [Doug] found he had to create a converter to get the data to the Arduino. He also needed a way to convert the Arduino’s PWM output to a 4-20 mA output, which was even more complicated.

Of course, the PLC had all of these options already, along with a user interface suitable to the task. From that [Doug] drew the conclusion that while the basic hardware was cheaper, it was a wash by the time you added the ancillary components. He also felt that the engineering time to build the Arduino version of the project swamped all the costs of using the PLC.

In general, we don’t disagree. However, it depends on what you are trying to accomplish. While a hammer is good at driving nails, it isn’t good with screws. You need the right tool for the job. If you really had 4-20 mA gear and needed a PLC-like user interface, then, of course, the PLC is probably the right choice. However, if you had started with the Arduino, you could have selected better flow monitoring and actuator choices, provided better power, and used a user interface more suited for the Arduino and gotten a better result.

Don’t get us wrong. PLCs have a place. So do Arduinos. So do ARM chips, Raspberry PIs, and 555 timers. For [Doug’s] project a PLC was clearly the right answer. That doesn’t mean it is always the right answer. However, we did think seeing the comparison between the two might help PLC experts understand the Arduino better and vice versa.

Although most PLCs are proprietary, we’ve covered OpenPLC before. Maybe the best idea isn’t to pick one or the other, but use both and play to their strengths.

77 thoughts on “PLC vs Arduino Show Down

  1. there is a good 4-20mA loop to arduino conversion totorial(ish) video over at [AVE’s] youtube channel, seems not that big of an issue…. I believe [AVE] was looking into a pressure gauge for a project to measure torque wrenches.

      1. It certainly is not a step by step tutorial, but it should give people with some tinkering experience under their belts a few ideas and point them in the right direction. Realising you have the option to use proper industry sensors with a bit more resilience could be very useful.

    1. Arduino works without problem, if * and only if * you protect inputs , spend time design a good circuit and good DIN rail DC PSU, i had arduino running side by side with Siemens S7 and Allen Bradley PLCs for more than 3 years without problem, arduino are 1000% cheaper/flexible than those PLCs support modbus , basic S7 . Arduino controlling pumps, solenoids, Conveyor Belts and even commanding other remote PLCs works great.

  2. Note that also PLC’s are almost free from Ali.
    A good search term is “FX2N”
    These plc’s on Ali have a STM32F103xx which is reprogrammable with GCC.
    (You can read the typenumber in the foto’s below).
    And in contradiction to the arduino stuff these boards come with a SMPS which does not only give them a wider input voltage range, but also does some power supply filtering.

    Apparently they are also usable with some ancient and very limmited language called “ladder digargram/logic” but who’s interested in that?

    1. LAD is not ancient and is very common in industrial control systems like water treatment plants, power stations, factories, traffic lights. Automatics engineer with 5 years of PLC experience (in languages LAD, FBD, STL) earns about 3 as much as a Python, C++ or Java programmer (also with 5 years experience). There’s good money to be made where there’s life or heavy equipment on stake.

      1. I’ll go along with that. Ladder logic is still alive and well. I’ve been programming in ladder since the 80’s. Nothing beats the scan time in more modern plcs.

    2. Isn’t that the very same ST ARM microcontroller found on those “red pill” and “blue pill” boards?
      Because in that case, there’s unofficial support for the Arduino environment.

      1. Pills ???
        For those “pills” you want to search for “maple”, which is a discontinued product from “leaflabs” which was ported to the STM32F103C8T6 by “jasonclarkmelbourne” (Sorry, spelling error, can’t find the name).
        The foto in the board I showed uses the STM32F103VCT6 which is its bigger brother.
        Arduino sould be fairly easy to port, but if you have the knowledge to port this, then you probably don’t want to use the arduino stuff and go directly to a decent IDE.
        “pandafruits” has an really excellent tutorial on getting started bare-bones with STM32.

    3. Yeah it’s not designed for a hacker. Ladder logic is designed to be a state machine so a mechanical engineer with little background can make programs that are immune to timing, crashes, bad programming habits, etc.

      It’s limited in capability on purpose. If an error means killing someone or a $100000 robot, and you don’t need more capability why give them all the keys?

    4. The only thing I care about in PLCs is if they can be programmed in compliance with IEC 61131-3 ( Preferably SFC, ST or FBD. Ladder is also nice for quick ‘n dirty applications. It doesn’t seem these “domestic PLC boards” support the standard. To be honest I can’t even find HOW they are programmed.

      To be honest I’m surprised ladder and PLC in general get so little love from the hacker community. They are designed to be reliable, no nonsense, quick and easy to program.

    5. PLCs have a few BIG advantages over an Arduino.
      * You can watch all program steps and every variable while the program is running
      * you can change and extend the program while it is running
      * for control tasks I would choose ladder logic over cpp anytime
      * IO is very sturdy and hard to destroy
      * superb error handling that focuses on robustness

  3. The thing that is missing here is big, the use of a PLC is mostly because it’s easier to program, you need less qualified people and thus cheaper people to program them. And you don’t want to risk to implement such things in a microcontroller since you would have to blame yourself if an accident happens because of a bug

    1. Easier to program? Hell I would have picked the PLC as being easily interface to standard equipment, likely to be tolerant of wide powersupply conditions, likely to be in a form factor easily mounted and integrated with other equipment, built from something with a little more thought than slapping the cheapest AVR on a board, oh and conformally coating the board.

      Software would be way down on the list of why you would pick a PLC over an Arduino for anything other than a home hobby project.

    2. i disagree with you, are not easy to program, LADDER programming are far for complex as C++, qualified LAD programmer cost 5x as C++ programmer, risk only happens if bad programing was made and that could happen in LAD or in any language if dont know what are you doing

  4. Being a marine engineer we encounter plc’s everyday, they’re hardy and take up to a lot of abuse in harsh environments. high vibration cycles, high temperatures in excess of 70degC , shorting at the inputs(which happens quite often). and most of all inexperienced personnel poking the hell out of them. they’re also great at ESD, with long lines on deck , exposed to inert gas . I can enumerate a large number of advantages but they have a simple failing , each and every manufacturer has a specific set of protocols to control and program them. A lot of them the firmware is locked down. So it would be nice to have a plc with an Arduino as a brain. I’ve seen plc’s with atmega 328 and ones with a Xilinx fpga , also ones with a mediatek all depends on the complexity of the operation whether its a simple jacket water temp controller or a boiler safety and ignition controller or an main engine management and safety control. I feel it would be nice if the industry would design an open source plc with an Arduino heart and external controls and converters built in. I think ti makes chips which convert i2c to 4~20 ma loop control. and there are vice versa i to i2c converters which can source or sink current.

    1. Not sure if it fits your particular needs, but very interesting product nevertheless;

      In essence a RaspberryPi Compute Module 1 or 3, adapted and cased for industrial purposes.

      We have deployed already 3 of them, mostly as actuator spy and data interface with Siemens S7’s… but we plan to move forward to in-house automation projects based on them.

  5. Don’t forget two of the biggest reasons I’m always asked to do everything in PLCs for my job as a controls engineer: 1) Ladder Logic Readability and 2) Online Edits.

    -Ladder Logic is a graphical programming language that looks like an electrical wiring diagram with inputs on the left leading up to outputs on the right. When all of inputs are true (and light up green) then the outputs will fire. It looks archaic but is super easy to read and tell at a glance why an output or interlock is either true or false. Its much quicker to troubleshoot in a heavy Input/Output driven environment.

    -With most PLCs you can do online edits without having to download to the controller and stop the process execution. I can add, remove, or delete *most* code to add equipment and not interrupt the manufacturing process. Many manufacturing lines run 24/7 and downtime to add equipment or test out an optimization is hard to justify. I can do that with a PLC but an Arduino has to be stopped to download too.

    1. + 1

      “why did my process stop mid cycle?”
      “It’s waiting for switch #1”
      “oh It should be waiting for switch #2”
      *Corrects tag*
      *process continues*

      Verse looking at offline code and guessing where you are hung in the process, not being able to find it you add print instructions and download, wait for another hang to look at results and continue to guess…

      1. Or you hook up a JTAG/SWD/whatever debug dongle your system uses and actually look.

        That a typical Arduino doesn’t support live debugging doesn’t mean that nothing supports it. Heck, even the ATMega328 in that Arduino supports it, if you have the right tools.

        There are plenty of good reasons for using a PLC but this certainly wouldn’t be the reason why I would go with a PLC over a generic MCU.

    2. Sounds like it would be better suited for another type of chip. I’m thinking of the ESP32 running MicroPython but could be any number of recent chips. Can change on the fly and potentially could implement ladder logic. Pick an industrial temp chip, add the appropriate connectors and interfaces, encase it very ruggedly, and away it goes.

      1. Upon reading comments further down, it would seem PLCs are usually best left for professionals, and are worth paying Siemens extra for.

        I wonder though if there is a market for low-volume low-risk PLC emulators using cheaper chips, with a telephone-book-sized list of safety disclaimers of course. Good for startups making kites or something.

    3. all plcs inside are simple AVR/PIC with ESD protection that could be made in Arduino without problem, some arduino like Ruggeduino includes this ESD feature, inputs protection, and allow abuse them without risk of damage, programming online is a simple software trick that mostly all avr could do, i had arduino running side by side with Allen Bradley PLCs and Siemens S7 and our arduinos do same tricks as those PLCs, real difference between arduino and brand PLCs are support, pricing and in some cases ready to install sensors with their propietary protocols.

      1. Um, nope. I guess you haven’t seen a PLC disassembled. Most modern ones run actually 32bit chips, e.g. a MIPS or ARM with an RTOS on top that is then running the various jobs in a form of a virtual machine.

        There is a plenty more to a PLC than ESD protection as well.

  6. I have been in a similar situation last year and came to the same conclusion as the author of that article. The moment you have to deal with industrial hardware using 24V (switches, relays, indicator lamps, displays, etc.) and you need to go on a DIN rail because the entire mess is to be mounted in a standardized cabinet, Arduino is useless.

    By the time you add an extra 5V power supply + mandatory circuit breakers/fusing, the necessary modules for 24V I/O using either relays or transistors, figure out how to mount that Arduino on the rail, you are at the price of a cheap PLC already. And your cabinet looks like a gross hack and not a neatly setup and wired professional hardware the clients are accustomed to.

    And I am not even speaking about robustness, both electrical and mechanical (24V short of an output or 24V into an input is completely normal) and the necessary electrical safety certifications (nobody will let you install some home-made “bricolage” into a cabinet driving industrial gear – the potential liability should anything happen would be just enormous).

    Arduino is fine for prototypes or home stuff but when it comes to anything industrial, it just doesn’t make sense economically – it certainly could be made to work technically, but it would cost more than a PLC-based solution if you need to do things properly.

    1. What about a proper PLC style Arduino? Something that has a proper IDE, proper shielding, proper 24V support, proper input shorting resiliency, proper everything in terms of being well made hardware wise but also was Arduino or something else open and accessible and was otherwise well built? Proper screw terminals, modules to plug into it, libraries for common items.

      Bonus points for lots of I/O and it being easy to diagnose and work on as well as decent storage, interface options and bandwidth.

      One would think that such a thing would actually exist, let alone have demand. It need not be $5 obviously but it also can’t be $1000 either.

      The worst things about many PLCs has already been echoed but it forces you to only use that PLC software and hardware and that can be a problem if you need to standardize on hardware that is then EOL or otherwise doesn’t have the functionality you need built in.

      1. The atmega’s don’t have the horsepower to handle all of that at the required speed. Being able to observe the state of the code as it runs is vital when commissioning or troubleshooting an installation. That really isn’t feasible if the automation is a compiled program. A long time ago I wrote a script interpreter that would execute programs written to flash over the serial port. It was SLOOOW, maybe 700 instructions per second. For simple digital logic it was okay but outside of that, meh.

        You’ll probably like this though.. I know of one PLC that has a beagle bone derivative at its core. Well above the price range you are talking about though and has no on board IO.

        1. The atmegas can’t do it, but a Parallax Propeller could. I have put in several projects recently using custom Propeller boards where I was complimented on how much simpler and easier the end result was to use and configure than a PLC.

        1. Thats a very good start! however i have seen a loot of “duino” compatible PLC-like hardware with the same mistake: USB programming port mounted in an ankwared side, very hard to access once installed in an electrical cabinet!. Real PLCs have their programming ports in the front!

          1. i had arduino running on industrial enviroment, and programming isnt made throw USB, we use TFTP server for sending software update to multiple arduinos, talking modbus with other brands PLCs without problem for more than 3 years, my neighbours update their arduinos throw SD card, but i think network TFTP are easier because i didnt go there and not opening cabinets.

    2. True, and I can imagine for hobbyist use, the usual sources can provide a reasonably priced PLC even if it’s not the latest and greatest (which the real world usually doesn’t use anyway). Nice thing for now is that it’s easier to get into PLCs both hardware and software compared to when I was coming up and it was all expensive (even a programming cable was expensive), proprietary, and hard to get.

  7. When I was a fresh faced automation engineer just out of the classroom (in 2015 :p), I was rebuilding old machinery used in automotive safety systems manufacturing (seat belts and airbags). For most machines, you could easily accomplish whatever it’s intended task was with an AVR or some other cheap solution compared to the ~$1.5k AB or Siemens hardware the I would end up using. The two biggest reasons for this:
    1. My techs would see a micro-controller and freeze up in fear of a “black box”, whereas they can pick up ladder logic editing and troubleshooting techniques fairly easily.
    2. In an industry currently reeling from safety related recalls, I didn’t want to stake the reliability of our products’ manufacturing processes on a piece of in-house developed hardware thrown together with a few man-hours of testing compared to the Allen-Bradley/Siemens/GE/etc. level of development and testing that is somewhere in the ten thousands of man-hours. There are already enough issues that we try to catch beforehand that the addition of one more potential failure point wayyy outweighs any cost savings. Plus, can you imagine what an auditor would do if you casually mentioned “Oh yeah, I wanted to save some money so I built this controller over the weekend with some extra Sparkfun bits from my desk”

    1. I agree safety is the real difference. Arduinos, being a hobby product by definition, can’t come close to the safety standards in the auto industry. The MCUs designed for cars have lockstepping, logic error detection, safe modes, and a host of other features to prevent code bugs from killing you.

    2. The other thing you are paying for in a PLC is extended product design cycles, robust design and failsafe operation.

      I can buy an allen bradley SLC500 today, or one thats 10 years old. I can probably buy one 10 years from now when my old one dies.

      Try to find a 16 bit ISA bus computer to replace the one that died in your $300K dollar industrial machine. Or any computer that can run Windows NT 4.0. Arduinos et al are computer hobby devices that get hardware and software updates as frequently as toilet paper at McDonalds. Good luck trying to run legacy code on an un-supoorted device.

      PLCs are industrial hardware and software that is built to be tough, hardened, and will be available for you off the shelf in 10 years time.

      Need to build a home brew monitoring station? Get an Arduino. Need to control an industrial machine that you have to guarantee is Safe and meets OSHA standards? PLC

      1. or buy a PLC like Siemens Simatic IOT 2020 or newer, opening and look an arduino compatible header and programming with same Arduino IDE, Arduino is winning market on PLC and Siemens is doing those hibrids in order to sell their product, market after all makes their rules ….

        1. Are you trolling?

          Arduinos are junk for Industrial uses, Fine for hobbyists and low end stuff, You think a company is going to gamble their multimillion dollar machinery on a toy system put together by some guy in his garage?

          Oh and then force them to use that crippled version of C to program it?

          They’ll laugh at you.

          Same with guys peddling ARM or Prop based alternatives, most are put out by one man shops, they don’t conform to IEC standards,

          Ask the pimps of these chips if their boards are programmable in LL, ST or FB’s. You’ll either get silence or they admit they have to code in assembly or C. Which cuts off plant electricians from fine tuning the controller.

          And testing under harsh conditions? Not done.

          And the worst – it’s put together by some one man shop which may not be around in 5 years or a decade. I

          1. “Arduinos are junk for Industrial uses, Fine for hobbyists and low end stuff, You think a company is going to gamble their multimillion dollar machinery on a toy system put together by some guy in his garage?”

            Apple computers: the early years, but anyway the programming world is essentially that. Some small operation writes a package that gets used widely. Not that the big boys do much better (I’m looking at you MS).

      2. Except that the PLC manufacturers aren’t extending those product life cycles the way they used to. Plant engineers have complained to me bitterly about short design life for things that used to have decades long design lives. Plants don’t care if the design is obsolete if it is working, they don’t want to be forced to do a whole redesign just because of a random hardware failure. PLC manufacturers used to have a focus on that but they are rapidly losing it.

  8. Lots of talk about software. Very little talk about the only thing that matters: reliability. An Arduino could come preinstalled with the exact software perfect for your control application, it could be given to me for free, and it would still not be put in any “industrial” place other than the trash can.

    Typically it only takes one minor hiccup for a proper industrial PLC to pay for itself.

    Online code changes, realibility, conformal coatings, resistance to ESD, reliability, wide operating supply, easy to understand code, reliability, visualisation tools to view running code, easy to integrate with standard hardware, long product lifecycles, reliability, easily accessible spares and upgrade paths and … I’m sure I forgot a few more but I’ll just say reliability again.

    Most people don’t even know what the watchdog timer is let alone how to create a reliable control system.

  9. Don’t forget the other part about PLCs besides the above mentioned..

    When something packs in it, input/output card, cpu, powersupply, or some other piece, I can go to the shelf, get the piece I need, install it, and we are back running in minutes. The cost of lost production for an hour generally far exceeds the 10k for a new controllogix cpu.

    1. I’m sure PLCs could never be made from inexpensive components, and in-circuit-programming is impossible with today’s microcontrollers, so I only buy PLCs that cost the same as a new car. /s

      1. I tend to avoid even the cheap industrial PLCs (horner, redlion, automation direct for example). Partially because the software is pretty much universally terrible (but it’s free, so that makes it ok, according to them). But in my experience, I’ve had to change out 4 and 5 year old cheap PLCs. But I’ve been to site, and worked on a 30+ year old AB PLC 2, 20 year old PLC 5s, and GE series 6s.

        1. It’s cheap junk. You can’t even program it in LL, ST or FB.

          Recommend those in a industrial plant and they’ll laugh at you. For starters it’s so I/O constrained as to be useless outside of trivial applications.

          Security wise, I wouldn’t let that thing be interfaced to anything outside of a test bench.

        2. Seriously, all these comments on that Siemens one.
          Siemens PLCs are trash. How much are they paying you to pretend like you use it, like it, and know anything about it or PLCs in general?

  10. The article is CLICK BAIT (on both the Author’s part and HaD for even propagating it)! A PLC is BASED on a micro-controller – ANY micro-controller. The choice of the micro-controller used will vary depending on what the PLC is designed for. What makes the PLC different from a basic micro-controller are the libraries and user interface that turn the PLC into an easy to program near-real-time state machine that is (in the typical Human-time domain) a device that is cheap (at-least it should be) and simple to program – with as little as a three button interface and a two-line LCD for-example.

    1. Allen-Bradley actually designed custom silicon to handle extreme environments, PLC code interpreting workloads, online code edits, synchronous servo axis communication timing, etc. So while it is just a fancy CPU it is not an off-the-shelf part you can find anywhere. I don’t know the specifics of Siemens CPUs but I wouldn’t be surprised to find out they did something similar. Safety PLCs with dual error correcting CPUs get even funkier.

      The other factor is the millions of man hours that go in to quality control on their firmwares. In over a decade of working with AB PLCs I have yet to see one crash from a firmware bug. It has happened according to patch notes but its so rare I don’t have any colleagues who have seen it. I can not say the same for any Arduino libraries I have used. I’m constantly finding new conditions that they haven’t taken in to account that cause odd behavior. Odd firmware behavior in a PLC might mean someone loses a hand, an operator dies, or the cleaning agents don’t get fully rinsed out of the tank that makes your cereal and 100,000 end up in the hospital. You could do the QC testing with an Arduino sure, but no one is.

    2. I agree that this whole undertaking seems misguided. Just because you can make something that looks and acts like a PLC does NOT make it a PLC. The original author completely misunderstands the purpose of PLCs.

    3. I’m not sure it’s click-bait. He may have no idea about what PLC’s are for or what the industrial segment is. I can’t blame him- I was the same way. After 30 years of device drivers, I thought I knew enough. It’s only when you get elbows-deep into things that you see why “Arduinos vs. PLCs” is apples vs. oranges.

  11. I have 2 examples:(teardowns!)
    PLC # 1:
    Panasonic FPX series PLC:
    Those PLC arent as popular as AB nor Siemens. Their market is machine builders. It have an ASIC. As somebuddy said, i know them for at least 15 years and probably will stay for another 15 years.Very good support, software and documentation in their respective manufacturer home page (Panasonic Industrial Automation)

    PLC # 2
    Crompton Greaves Leganza series.
    They came from a company in India?. As a brain it have an 8051 compatible microcontroller. I have found zero documentation nor software in the manufacturer home page. A friend give it to me, he bought it in a garage sale

    8051 is a mature architecture and well suportedd in open source compillers, however (like the STM based PLC) have no enthusiast from control engineers to push this kind of “no brand” products in to the industry.

  12. When I started hacking in the HaD sense all my work was on PIC (16f84 then 16f886/7), but that was YEARS ago. Recently getting SDCC up on my laptop is the final nail in the coffin.

    Arduino nano clones that work are a couple of quid in modest quantities. Cheap enough that most of us can afford to throw one at just about any hobbyist project. Cheap enough that it doesn’t touch the margin on any hobbyist “commercial” venture.

    And now I find myself so de-skilled I doubt I wil be using a PIC anytime soon (12f508 gets a pass, I still use that occasionally).

  13. Every situation will be different, here’s mine.

    I have placed maybe 100 PLC’s in service over the past fifteen tears, support a whole bunch more. I did some projects with Arduino components a couple of years ago to evaluate. We were excited at the cheap and flexible hardware and the possibilities.Our applications are generally not hazardous or complex, nor do we need them to run for decades without failure. The current standard for us is Automation Direct. I used to be an Allen Bradley fan but their stuff is 2-3x more expensive than Auto Direct and (for our applications) doesn’t work any better.

    But back to the Arduino… we found by the time you harden the I/O to tolerate voltage transients, shorts, wiring glitches, etc, it ends up costing as almost much as the PLC and takes up almost as much cabinet space. If you have a simple application that you’re building more than a couple of, it might make sense. We made our own 3d printed enclosures and mounting hardware for our stuff and some of it came out pretty neat. But it was a lot of work to shrink a control enclosure by 30-40%.

    Someone else in this thread brought up the parts availability issue. In our case, we used a cool little touchscreen in the beginning that cost a fraction of the units we were used to. But when I went to buy spares, I couldn’t find them any more. Had to remove them from the system we used them on.

    The other drawback is the “black box” nature of it as far as troubleshooting is concerned. Ladder logic is a pretty universal thing, most maintenance techs are far more familiar with it than they are with Java. We still have a couple of Arduino controllers installed but I’m the only person in the plant who stands a chance of troubleshooting them, and I’m not too confident about that. They’re on my list of things to replace before they break.

    Summary, the cost/flexibility was initially a plus but is less of a differentiator than one thinks. Long term availability of hardware and troubleshooting are real drawbacks.

    Didn’t work for us.but it was fun trying.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s