porno filmek ingyen magyarul

porno filmek ingyen magyarulIt should be no surprise to many that one can use a Raspbery Pi SBC as an industrial controller, but is it any good at that? That was the question which [Dough Reneker] and [William Shaffer]?built a test rig to see how a Raspberry Pi performs in head to head tests. They compared a Python-based control loop on a Raspberry Pi 3B against an C0-12DD1E-2-D AutomationDirect CLICK Programmable Logic Controller (PLC) using a simple water heating example.

porno filmek ingyen magyarulA major snag with using the Raspberry Pi as a PLC is the lack of industrial I/O capacity. This requires additional hardware, in this case adding a four-channel ADC board as well as a custom board to condition the signals. The Raspberry Pi looks for 0-3 V inputs where industrial control applications are usually in the -10 to 10 V range and often use a 4-20 mA current loop.

Using a PLC leverages so-called ladder logic, where each action depends on conditions. With each update scan, the PLC ensures that all input conditions are translated into the appropriate output conditions in real-time. It’s only job is to monitor the process at hand and it does this very well.

Here the flexibility and generic nature of the Raspberry Pi running Linux was a disadvantage. Unlike the PLC, the lack of a hard real-time OS means you can’t guarantee the Pi will be as responsive to changing inputs.

The behavior of the two systems showed that while both did the task they were programmed for, the Raspberry Pi was decidedly more erratic. Although one could program around a lot of these issues (presumably using Linux in stripped-down, soft real-time configuration with interrupt-driven native code), the effort needed to make a Raspberry Pi system suitable for an industrial environment shows why single-board computers haven’t seen adoption as replacements for PLCs.

82 thoughts on “Evaluating Raspberry Pi As A Programmable Logic Controller

  1. This is where the beaglebone would have an advanage due to the programmable realtime units. but the pi’s price is awesome, perhaps arduino or teensy as the controller, programmed thru wireless pi zero running a plc web based interface to update the arduino? price could still be pretty low, getting the 4-20 currrent loops is a bit of an issue tho. I like the industrual application.. you could buy a lot of these for the price of an allenbradley plc… and the ab software for programming is horrible, looks the same as it might have been in 1990.real bad hmi software….

    1. Say you are setting up a factory line that is costing tens or hundreds of thousands of dollars, you most definately want a controller that is proven and *predictable*.

      As the author points out, a PLC is designed for industrial applications and reliability. A PC (raspberry or whatever) is made to a price point and there is usually no skin off someones nose if you have to reboot it a couple of times or the timing is off by a few milliseconds and a couple of frames are dropped.

      Hardware : support (available interfaces) without having to roll your own.
      Software : I *hate* ladder logic, but it has it’s place. Was that python 2 or pyton 3 that I need? And do I really need to talk about things breaking when a patch or update happens?

      Each has its’ place, and it will remain that way for the forseeable future.

  2. Python, for a PLC “emulator”, really?

    Why not use Java?

    Java would be at least 100X faster, and would get faster on each function iteration!

    It would get so fast, it would heat the water before the inputs registered!

    The Pi-4 would be great for java, but i’d recommend the 8GB model, since Java requires it, 16Gb would be even better.

    4 cores is the sweet spot for java, although 8 cores or 8C/16T would be even better.

    It would put sloooow python, and very slow C/C++ and even ASSembly to shame!

    1. Java?? write C++ app optimized to raspi , and go faster even access gpio and without issues .

      Raspi as plc will needs a fast boot option (until now i didnt know how to reset it in 1sec or 2sec max like a plc), probably with any kind of stripped operating system.

      But is like comparing apples with oranges, both are fruits but …

      1. Yes indeed the water heater requires sub nanosecond timing!We can’t be off by even a nanosecond in our timing or else the water will all boil away! Faster faster faster!Bust out the assembly language cuz heating water requires the utmost precision timing!

  3. PLC programming is its own can of worms, like trying to wrap your head around the idea that your program has to execute in the allotted cycle time (e.g. 40 ms) or it just gets rudely interrupted, OR, the I/O variables change while the program is executing and the program doesn’t know that just happened. Depends entirely on the system whether you’re even allowed to do a “main” loop that never exists.

    I once asked a PLC programmed what would happen if I made a loop that iterates a hundred times, the answer “It would use a lot of CPU”. Then I asked what would happen if I made it run a thousand times, “It would use a lot of CPU”, a million times? “A lot more CPU”. To this day I don’t know whether he meant it would need a faster CPU, or whether the PLC would somehow assign more resources to complete the code within the cycle time.

    1. It just runs the loop. If the whole program completes within the cycle time there is no problem, but the more times your loop runs the bigger part of the computations per cycle it will use. If you don’t meet the cycle time you need to increase it, get a better CPU or, if you fail only sporadically, increase the acceptable miss rate

      1. I mean, I get where the whole PLC logic is coming from. The Ladder Logic programming style replicates relay logic, which changes state ever 1/100th or 1/120th of a second when the AC voltage goes to zero and relays can switch without arcing their contacts, so all the logic has to find its state before the next zero-crossing comes.

        1. Plc’scan run a POU much faster than a hundred times a second. 1ms execution times are pretty easy and you can even do hard real-time control. Plc’s execute like you’re talking about not to replicate relay logic but for safety reasons. Though ladder logic does replicate relay logic in appearance though if you’re going to assume that normal schematics can be replicated in ladder logic you’re going to end up running into some problems.

          Check on the pie using code assess I can have programs that don’t exceed 3ms. The jitter isn’t super reliable regular unless I apply a real time patch though.

          There are also plenty of hats that do have standardized plc input and outputs.

          1. Of course the cycle time can be arbitrary now – I was just saying that’s where it comes from.

            All the thyristor/triac and relay controlled hardware had to switch with the AC power, so the control logic had to synchronize to a cycle time back in the day. Even earlier, when the control logic itself was also SCR/relay based, it could only change state once every zero crossing.

            So far I haven’t seen a PLC programmed in “hard real time”, meaning that it’s running asynchronously without a fixed cycle. In my book, “hard real time” means a hardware interrupt with a deterministic cycle time, and “soft real time” means relying on the code to set the pace.

  4. Probably the biggest problem with a Pi (or Beagle, or Arduino, the latter less so) is the unsuitability of the platform for life critical applications out of the box. Would you control an elevator hoist motor controllerand the elevator car brakes with a Pi?Even the cheap little PLCs are designed to fail in predictable ways, have extremely constrained programming (viz the ladder logic) so the effect of a failure of a sensor or output circuit is knowable. I don’t know that PLC ladder logic is “provably correct” in a formal sense, but certainly, one can pretty easily write out the ENTIRE fault tree, given the ladder logic. And it’s easy for the mfr of the PLC to write and test the software that runs the ladder to verify that it is correct.

    This is not true of someone writing Python, Java, C, or what have-you on a complex computer with a variety of i/o devices with non-deterministic behavior.Garbage collection and similar things are really a second order concern – there are much bigger ones.

    Look at the cases where the Nest thermostat accidentally turned off the heat in people’s houses leading to frozen pipes, etc.

    That said, things like the Beagle, Arduino, etc. do provide great value for a lot of applications, particularly for home hackery.

    1. It’s the difference between “simple programmers” aka “code monkeys” and real engineers.

      if the elevator controller fails, I’d hate to be the engineer on the project.

      If the java crapplet fails, and deletes the files on the users computer, boo hoo, sucks to be you.

      Remember, “NO WARRANTY”, or “FITNESS FOR PURPOSE” and “KNOWN DEFECTS”.

      Then again, remember in the good old USA, everyone is an engineer , the guy who changes the TP rolls is the building engineer.

      1. > Then again, remember in the good old USA, everyone is an engineer , the guy who changes the TP rolls is the building engineer.

        As is the random dude claiming to be a “Real Engineer” in the comments of a HaD post.

    2. It is not a problem, if you use the correct tool for the job. In a lot of machines the safety side is simple enough, that you can use e-stop buttons and safety relays to stop the machine and you don’t even need to incorporate it to the machines actual programmable functionality.

      Most of the industrial PLCs have no verified safety functionality at all.

      As for languages, wether you use the IEC languages (which ladder is one of), python, C, visual basic or some language of your own, might really be a problem to the people if at some point the machine has to be enhanced, or if it’s a badly made program and you need to dig in the code to see when a sensor fails then maintenance folks aswell. Otherwise, whatever suits the developer the best and whatever the client allows, use that.

      Safety languages are usually Ladder and FBD. To verify them at runtime, the safety program compiler makes a mirror program and compares that the result is the same in both programs plus there are other things the safety runtime monitors. Plus there are other concepts like multiple channels etc. that are used in safety.

      The Nest problem is not really a safety issue, it failed in the correct direction atleast. It’d be a bigger problem if it failed the other way and managed to get the house on fire, although i doubt it’s possible.

      As you said a bit differently, there are a lot of places where you can use small embedded systems and soft PLCs without having the industrial features. It really comes down to what kind of environment it is to be run in, if it really needs to be updateable/upgradable and what the developper is familiar with and what client wants. PLCs are used, because they are not only industrial grade hardware, but have a full development environment. They have quarantees and standardized interfaces etc.

      1. He’d have no problem – there’s no GOTOs to be considered harmful.;)
        In fact, it’s fascinating – ladder logic is essentially simultaneous execution of all statements in the “program”. (and yes, most PLCs actually implement a variety of “sequencing functions” and it’s shoehorning that kind of thing into a relay logic system that makes is hard to work with)

          1. The rung execution sequence may be ordered as implemented by various controllers.But the ladder diagram by itself has no ordering – all rungs are theoretically executed simultaneously. It’s much like languages like Prolog, with rules that fire when the conditions are met.Designing so there are no race conditions or dependency loops is important but difficult for non-trivial systems.
            (Hence, mfrs specifying a particular run ordering, so it’s more like a sequence of rules, always executed in the same order, in a cyclical fashion – heck, that’s also easier for the mfr to code the microcontroller too)

            If you implement logic that is “rung ordering dependent” then, you’re making assumptions about the execution platform. And that’s why it gets complex in real life.

          2. To Jim:
            Ok, so with “sequencing functions” you meant “run order rules”.

            So if you made the same circuitry electrically, yes the run would be “simultaneous”, but in a PLCs there’s a run order (i mean practically, could be even IEC rule, i guess it could be like Labview, not familiar with Prolog).

            I’m still unsure of the “complex”-thing? Are you saying that the difference in electrical and “PLC order rules” makes it hard?

    3. Real PLC’s can be programmed in Python or something called structured text. Ladder logic is becoming less and less common.Check out Codesys if you don’t believe me.

      1. No argument there.. I would assume, though, that “real PLCs” intended for industrial applications have a “safe” version of Python with limited libraries, etc. – Sort of like “safe RTOS”es for the same applications that have limited file systems, well defined error handling, etc.

  5. The one thing comes to my mind when I hear PLC is “always fail safe”. That when there is a breakdown or a fault, that no one is injured, looses a limb or dies.

    A RPi in an industrial setting, I do not know. Like for example after a number of writes the SD cards will fail read only, if this happened at a critical time, will it fail safe ? You could spent a lot of time trying to shoehorn it to mostly fail safe, but getting it to “always fail safe” I do not know.

    1. Thats not really what PLC means. Even though the PLC manufacturers have a real knowledge of the hardware (unlike people using RPis) and have tried to make them functional and trustable (within the limits of economy), regular PLCs can fail “unsafely” and usually it’s the I/O electronics that fail and it is not uncommon for them to fail “unsafe”. Unsafe in quotes, because regular stuff is not meant to be used in safety functions.

      Obviously it’s wise to try to make system as failsafe as possible even if it doesn’t have a safety requirement in itself. A machine failing too often or destroying itself within a safe environment really eats the trust in you anyway.

      That’s why there are safety PLCs and other safety components, which are use for the safety parts of the machine.

      1. lol.. like fail open or fail close alldepends on how you have the water heater relay setup… the plc doesnt care…you can only determine that if the plc has bad input or crashes what signal shall be sent out. last resort safety, thats what thermal relays, fuses, circuitbreakers, non integrated e-stops relays, overloads and torque limiting clutches/couplings are for.

  6. I can respect a company for doing a writeup about how industrial PLC are better suited for their specific app than a pi. My industrial plant running friends talk to me regularly about how horrible it is to wait for industrial control parts to come while their plant is functionally impaired and they ask about using a Pi on a regular basis. The writeup is absolutely correct that the purpose built PLC is better suited. The biggest issue is cost. Right up front, It seems like the industry supporting industrial automation was built on the assumption that downtime is so expensive they can justify any cost. They are not wrong, but it burns every time they order a replacement thingy. I like that he makes this video we could take as a sales pitch for how to disrupt the PLC industry.

    1. RTOS – don’t bother getting all fancy until you stop interrupting me
    2. Native voltages – -10 +10 and industrial power is really dirty, handle it.
    3. Form factor – Din rails, cabinet mounting
    4. Load up on high quality ADCs
    5. Modularize – Brilliant people run these systems, but save their brain space for the hard stuff, make this easy.
    6. UI – GnuRadio seems like it would work. Interface with 50/60hz um… radio signal coming down the mains.

    I think an esp32 may have been a better camparison.

    When the part costs 800 dollars you don’t necessarily have live spares onsite. When the part costs a buck as a chip and 10-20 as a module, you would have a dozen just in case. Make it so it works with the industrial components, as far as WIPO/DMCAwill allow and see if kickstarter isn’t fully funded right off the bat.

    Same thing with hot tub controllers. Massive racket, shouldn’t be a pi, but shouldnt be 800 a board for measurements and relays with safety checks.

    1. I did pool filter and heating control with Pi+Arduino compatible (All the really important stuff like not running pumps dry was handled on the Arduino side) for years, till covid shut down the place I installed it.

      I suspect a Pi hat with an Atmega328 on it (Yeah, ARM is better, but the 328 is almost *the* standard cheap 8 bit everyone understands) along with input protection and Phoenix connectors (Please can we all just agree not to use any more non pluggable screw terminals??) would be fine for most everything that isn’t safety of life or otherwise crazy expensive if it fails.

      1. Verex (a corpo-grade pyhsical security system) uses an Atmega328 in the door controllers…does it stop the supplier from asking$350+ for one? Hell no!
        I’d be seriously surprised if the BOM is more then $35 to make said door controller board.

  7. I guess this is sort of the point of the video, but a RPi seems like a particularly weird thing to even consider as a PLC replacement.

    Obviously a stock kernel is partly to blame for the erratic behavior they got. A realtime linux kernel and some other tweaks might make the solution at least kinda sorta work. But the bottom line is that a full-fledged Linux-based RPi is really just the wrong fit. You’re churning along at a gigahertz or more to unreliably fiddle a couple of pins and interrupts. Something the lowliest 5 cent Chinese micro could just about do in it’s sleep.

    An apt comparison, really, since AFAIK, the core of most PLCs are themselves fairly simple 16 or 32 bit microcontrollers. The units cost an arm and a leg, sure, but what you’re paying for isn’t CPU horsepower or advanced hardware. The price-premium is for the overall industrial bulletproofness, plus ultra long term product line support (the ability to buy a replacement part or compatible module to plug into your 30 year old potato chip production line or whatever).

    If you just want to add some automation to your basement IPA home brewing operation, a DIY approach is totally feasible, but I would think the place to start is probably just a simple Arduino, Cortex, ESP32, etc. You can get dev boards or shields with ethernet, if that’s your wont, and you can probably even find off-the-shelf add-on boards for whatever input level translation or relay driving you need to do.

    You can probably even do ladder logic programming. The google suggests there’re already at least a few projects out there that can compile ladder logic diagrams straight into AVR or PIC code.

      1. At least in the US, I think any place that’s stocking RPi’s is probably stocking at least a few flavors of Arduino as well. Maybe some other stuff. (This is true of e.g., Microcenter, and probably your local computer or electronics hobbyist shop, for those lucky enough to have one with RS gone.)

        Of course if the goal is to actually do something useful, automation wise, having the base RPi or a Arduino board is only half the battle anyway. You’re almost certainly going to need some extra components to do voltage level translation, high power outputs, etc. Even if you can get the basic board locally, the interface stuff is bound to be mail order — maybe even custom boards. You might as well just order it all together (and get a few extras in case you fry something — which is the real advantage of using a cheap board vs. pro-level PLCs).

    1. If you’re brewing IPAs at home, I doubt you need hard real-time performance, but you probably do want logging and a nice UI.

      At the very least,a pi for the central server makes sense, but if the setup is small enough to not need a distributed design, might as well just let the pi handle stuff.

      1. >> I doubt you need hard real-time performance.

        I mean, it depends, doesn’t it? Arguably it’s not necessary for a relatively slow-cycling thermostat loop on a wort boiler or something. But an automated bottle filler might need to be pretty spry — if your Raspbian install decides to spend a half million cycles syncing the disk cache, compiling a GPU shader or checking for a web browser upgrade just as the bottle’s reaching 98%, you’re going to have pale ale in places you probably didn’t want it.

        And even stuff that seems pretty leisurely at a high level might still need to be more or less real time on the wire. Like if some of your equipment is controlled through triacs that need zero-cross switching, as in the video. Or if you’re doing, say, bit-banging to read a quadrature encoded position sensor at speed, or interact with some even weirder protocol on a downstream controller or sensor. Or doing manual pwm to precisely control steppers, pumps, fans, etc.

        Don’t get me wrong. I’m sure you *can* do all of that with an RPi and a python interpreter, at least with enough tuning and twiddling. Maybe even all at once. It just doesn’t mean you should. Especially when someone else has probably already written the Arduino sketch(es) that does what you need, modulo cobbling them together and changing a couple of pin assignments.

        And that’s just the programming side. I expect boot time, power consumption, always on reliability, etc. also all tend to come out better for micros.

        RPis have a place running a fancy (high level) GUI, logging servers, etc. — if you needany of that — but I suspect anything but but the most trivial control stuff is best left to, well, controllers.

  8. The task chosen for the comparison is a joke and the implementation on the RPi was made by someone who had no clue how to do it properly.

    The task is to sample inputs once per second and to update outputs 60 times per second. Basically they are implementing a PWM in software. They could have used the I2S interface to queue the output values for a whole second in advance.
    They also say that the 1 Hz input acquisition is not synchronized to the 60 Hz output generation. Why didn’t they use only a 60 Hz timer that fetches inputs every 60th time?

  9. Good point as it would be easy connect an Arduino to the rPi over hard wired Aux(Tx/Rx) ports and have it handling 5V signaling with both digital and analog IO and some simple development GUI like Scratch creating the configuration and notifications.But I think the author had a motive to show a less than optimal solution so the PLC market keeps spending big bucks for simple micro-controller type functionality.What’s also missing is how the rPi can provide both local and remote UI capabilities where as the PLC setup requires more $$ for monitoring and remote control capabilities.

  10. The main problem with the RPi in a PLC role is that the components are not industrial temperature related.This role really calls for an industrial rated SOM (Variscite, etc.)The other challenge would be supply chain – aka EOL management.

    There are also some Arduino solutions out there such as Rugged Circuits https://www.rugged-circuits.com/which also has an industrial rated ecosystem as well (i/o boards).

    (I’ve no fiduciary interested in them, just a happy customer)

  11. One thing that I hardly ever see anyone talk about when it comes to RPI for industrial applications.
    This is temp. RPI does NOT have the temp range for industrial applications. PERIOD!
    The second major hurdle is that they dont even sell them with locking uSD card holders anymore. I don’t know about you, but I am not going to have my company run from a device thatcould have its main storage media be able to fall out due to vibration, or fail with extreme temps.No thanks.

    1. Beagle Boards have soldered on eMMC, no SD card required.Your comments about temperatures are well taken – and as someone else pointed out, the DC power is pretty ratty in industrial applications. So now you need a suitable DC power supply for your Pi, and then you need appropriate peripherals to give opto-isolated in/out or relays.Pretty soon, you’ve got a $30 Pi, plus $50 in other stuff (a box to hold it all) – The $90 industrial “smart relay” looks pretty attractive in that context.

      1. Yeah if it’s something simple it absolutely should be a smart relay. But if you’re doing anything even slightly advanced or if it requires a UI it’s so much easier to use a PLC. The Beagle bone has 2 industrial extended temperature range models, the beagle bone industrial and the newer beagle bone enhanced.

  12. As neat as a raspberry Pi is, there is no way it is a suitable replacement for a PLC. PLCs are meant to be highly reliable, that is not something that can be said about a consumer device like a Raspberry Pi.

    Rebooting your home made media centre or garden sprinkler that is controlled by a Pi is no big deal. Something crashing that is controlling heavy machinery is a whole different kettle of fish.

    This is a classic case of person with hammer, sees every problem as a nail.

  13. I shouldn’t be surprised that this point hasn’t been raised.
    One key feature of industrial PLC’s is the ability to change programs on the fly, while the process is running. Try telling a manufacturer to completely stop their line for a few minutes so you can download a minor program change.
    In my experience, speed is rarely an issue with PLC’s.

    Much of the cost in in the physical wiring to external devices, which would be much harder and less reliable with a raspi or similar. DIN rail mounting, input and output protection circuitry, reverse voltage protection, robust terminals, stable programming environment – these are what is important for a industrial control systems. None of which are natively present in a pi.

      1. Not being an enterprise software/server operator, does that mean an upgrade can be installed and the application flicked over to the new version without having to perform a reboot?

    1. We(Not industrial) went with a custom visual scripting language on the Pi for that exact reason. Python is great, but visually creating if-then rules lets you really constrain things to avoid anything that might not work well with hot code changes.

  14. Most of the comments are directed to the software aspect, but how do you get around the pi potentially (generally) leaving the file system in a state which needs repairing after a power loss?

  15. I would not condiser a raspi for any even vaguely industrial type of application.
    It’s made at the lowest price possible that gives it a chance of staying in one piece through the mail and nowhere near reliability or industrial temperature range to be condisered for such applications.

    On top of that, add swapping uSD cards each year or so to keep them from wearing out.

    But apart from that, the video is such a blatant advertisement for the other product, that there will be no doubt they’ve found some reasons why “their” product is “better”.

  16. My spousal unit is a big fan of PLC’s andimplemented them in many industrial situations and in everyone of them, safety was the primary concern.As noted earlier, eStops are separate from controller, but some devices need to be shut down in a specified order so that they don’t cause further damage.This means the ladder had an eStop input.

    I, on the other hand, am a big fan of SBCs, primarily because it is easy to create a rational user interface.Yet we are happily married.

    PLCs and SBCs can be married, too.PLCs in charge of the time sensitive functions and the SBCs doing the dishes.(user I/o, logging, etc.

    In other words, instead of an “apples and oranges” discussion, we should be talking about fruit salad.

  17. RaspberryPi compared to a PLC is like comparing a nice RV to a semi truck. Just because they are both big vehicles doesn’t mean they are comparable. The rPi is a whole ass credit card sized computer; we’ve had industrial PCs before there’s a reason they don’t run the entire operation.

    I would much rather see a comparison to Arduino, which is much closer to what a PLC is.

  18. The comparison would be fairer if it was done with a modern PLC.
    For example, the PLCnext Control family from Phoenix Contact runs a Linux OS with the PREEMPT-RT patch, giving the real-time behaviour that the Pi is missing. And it can be programmed in IEC 61131 languages, if you want, like the toy PLC in this article.
    There are similar modern PLCs from other vendors … it’s strange that this article chose an “old fashioned” PLC for this comparison.

  19. It’s all fun and games till it turns off the vacuum grippers and starts dropping things.
    Joking aside, i quite like using bare c/cpp on single boards like the rpi in industrial control, but the one thing i hate about it is the reliability(or lack of) the SD cards…as for I/O, everything is Ethernet/IP, profinet, etc. these days so the PI is just a process controller and leaves the I/O to modules like wago blocks, turck, etc.

  20. I think this article really shows the stark difference between a process automation controller (PAC) and a programmable logic controller (PLC).

    A RaspberryPi looks like a great system for automation control (like a CNC) or, maybe, as supervisory control over a SCADA system; where several programmable controllers control a process line and need information pass off via SQL or something like that. It might be good for imagingsystems too. Something that needs that kind of processing power, but does not control the immediate needs of the machine. I’m not sure it would be right for a safety application though, due to the speed needed for such applications.

  21. This has its place in the world but you will be hard pressed to find something like this in any serious industrial operation. PLC gear is expensive for the hobbyist, but as a percentage of the cost of an entire factory its not that significant, especially when you consider what every hour of downtime is going to cost you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.