OpenPLC, For Industrial Automation To Halloween Displays

Stepping out onto just about any factory floor you’ll find complex automatons building anything and everything imaginable. These machines need to be controlled somehow and before the age of computers these manufacturing robots were controlled with relays wired together to produce a multitude of actions. Relays, no matter how reliable and bulletproof the are, can’t be programmed without rewiring the entire machine. Now, factories have programmable logic controllers to take care of their automation tasks.

[Thiago] built his own programmable logic controller and released it as open hardware.Included in the OpenPLC are four 24V inputs, four 24V outputs (two with PWM), 0-10V analog inputs, and USB, SPI, and I2C for programming and expansion.

If you’re building anything from an industrial machine in your garage, or simply want really awesome Halloween (or Christmas) decorations, the OpenPLC can take care of driving all the solenoids, motors, and actuators needed. With the extendable I2C and SPI busses, it’s possible to add a plethora of sensors to bring a project to life.

The OpenPLC is based on an ATMega328 and is compatible with Arduino code. There are a few extension boards for digital and analog IO, as well as Ethernet.

27 thoughts on “OpenPLC, For Industrial Automation To Halloween Displays

  1. Design looks good. Here’s a comment on the low-power +12 generator (a 10K voltage divider) won’t hold that voltage when Q1 and Q2 are on. its going to drop to ~5.5V, shouldn’t be a problem. you might want relabel ‘+12 generator’ to something like ‘output transistor biasing’.

    In your output circuits 1 and 4, you could eliminate the inverters and Q1 and Q2 altogether (you’re doing double inversion). Having them in the circuit is a good thing so you can drive the opto coupler harder (required for fast PWM). If you have issues with PWM speed, increase the drive current, the opto-coupler current transfer gain is less than 1.

    Keep going.

    1. Not all PLC’s are (only) programmed in Ladder, most can also be programmed in their own language (that typically has more features, or at least allows you to do the same thing with less effort)

    1. If this had the same voltage protections and such but also integrated optical isolation and 10v to 5v scaling and 4 to 20 ma to 5v scaling on every pin, we would really have something.

      This is a good start but needs a lot more work to be truly useful.

    2. More than just over voltage tolerant.

      Power In

      The Ruggeduino is powered from one of three sources:

      USB port: 5V is provided directly from the USB port. A 500mA PTC (resettable fuse) protects the computer from overcurrent.
      DC power jack: a 2.1mm center-positive DC power adapter can supply 7V – 24V. This power input is also protected by a 500mA PTC (only on the Ruggeduino!)
      Vin: this connector pin can either source power to the Ruggeduino (7V-24V) or draw power from the DC power jack.

      When more than one power source is present, the automatic power switching circuit selects external power (DC power jack or Vin, whichever is higher) when available, otherwise USB power is used. This behavior is the same as the Arduino UNO.
      Power Out

      The Ruggeduino can supply power to shields or external circuits in three ways:

      +5V output: the +5V connector pin is the same voltage seen by the microcontroller. The current from this output is naturally limited by thermal protection on the on-board 5V regulator when externally powered, or limited to 500mA by a resettable fuse when USB-powered.

      This +5V output can typically source 500mA when the DC power jack voltage (Vext) is 9V or less, and less current as Vext increases due to thermal loading on the 5V regulator.

      On the Ruggeduino, the +5V output is protected against applied high voltage. If, for example, you apply 24V to this pin by mistake, the Ruggeduino will not be damaged. If you do the same thing on an Arduino UNO, you will destroy it!
      +3.3V output: the +3.3V connector pin sources 350 mA (Vext is 9V or less). Note that this is quite a bit more than the 50mA limit of the Arduino UNO.

      As with the +5V output, the +3.3V output is protected against applied high voltage; if you apply 24V to this pin by mistake, the Ruggeduino will not be damaged.
      Vin: the Vin connector pin can draw power from the DC power jack. This power output is limited to 500mA by a PTC (resettable) fuse. The 500mA PTC fuse protects this output against conditions like short circuits to GND (which would damage an Arduino UNO).

      1. Parameter

        Arduino UNO SMD

        Main microcontroller
        ATmega328P SMD
        ATmega328P SMD

        Main microcontroller frequency
        16 MHz (resonator)
        16 MHz (crystal: 0.005% accuracy)

        USB microcontroller

        USB microcontroller frequency
        16 MHz (crystal)
        16 MHz (crystal)

        Main microcontroller bootloader

        USB microcontroller bootloader
        LUFA DFU/serial
        LUFA DFU/serial

        Allowable external input voltage
        7V to 12V
        7V to 24V

        3.3V output current
        350 mA

        USB/Vext power switching

        I/O pin current protection
        30 mA resettable fuse on every I/O pin

        I/O pin voltage protection
        withstands 24V applied voltage

        Total microcontroller current protection
        protected to 150 mA

        5V output pin protection
        withstands 24V applied voltage

        3.3V output pin protection
        withstands 24V applied voltage

        USB current protection
        500mA resettable fuse
        500mA resettable fuse

        Vin reverse voltage protection
        protected up to 30V

        Vin current protection
        500mA resettable fuse

  2. Is it just me or can anyone find the firmware/software for this?
    There is a source svn link that just results in an empty folder…
    Maybe I won’t stop working on my PC based ladder logic software. (linux has a modbus library)

  3. Have been working with PLCs in industry automation applications since the late 80s so I have now about 25 years of experience.

    A few strange things that sticks out.

    1) Transistor outputs are normally source outputs (meaning they provide 24V to the load). Here we see sink outputs (meaning the pull the load down to 0V).

    2) Relay outputs. This is normally not used in PLCs because you want to be able to replace the relays when they break so you always put them outside the plc. So basically have source outputs in the PLC and let them drive 24V relays outside of the plc (in sockets).

    In the design the 10K resistor on the digital inputs is a bit too large. Select the resistor so that you have around 7mA of current @ 24V. That will give you better noise immunity on the input for instance when hooking up a push button.

    In general both the digital output and input circuitry needs some work. For instance the 74HC04 inverter can be left out or perhaps even replaced with a schmitt trigger inverter like the 74HC14 instead so you get a cleaner input signal.

  4. I can’t say much about the actual design here, but I really, really hope somebody comes up with a an honest-to-FSM Open Hardware PLC.

    That said, I don’t know why people are obsessed with ladder logic. I’ve only worked with one industrial PLC, but it certainly didn’t use LL.

    1. I know this is an old post- but I know I refer to these for info later, so here is a little info on PLCs. Ladder logic is not an “obsession” it is an automation industry standard that evolved from relay logic- back when relays, cam timers, and the like were the “program” hard wired into the circuit. “ladder” logic diagrams led to the ladder language that was familiar to controls engineers. It evolved out of the automation and manufacturing industries, in large part along with the automation of automobile production. Industrial PLCs now use a family of international standard languages referred to by IEC-61131-6. One of them is a structured text language with pascal roots, as well as ladder, function block, sequential function chart, statement list, and continuous function chart. If you used an industrial PLC it used one of those- or it was not likely a PLC but an industrial “PC” running some other hopefully real time operating system. PLCs are dedicated to automation tasks and must be deterministic- that is you can not wait around like you do with Windows for the OS to do something whenever it gets around to it. It must happen predictably in real time.

  5. Perhaps the ladder fanatics have seen only ladder logic plc boxen. As you step in controller performance different control languages replace ladder logic. Most of them are semigraphical descriptions of boolean logic or fuzzy logic with the occasional flowchart thrown in. Some are truly graphical and some have word languages.

    Ladder logic doesn’t go very far in high performance control situations and complex mathematical algorithms such as FFT are pretty hard to describe in ladder.

    1. Again- I know these are old, however PLCs are an important technology, and the comments here are obviously by people that know zero about them- or industrial automation in general. take a look a the IEC 61131-6 languages that include ladder among others. Any “high performance” control system must be deterministic and real time- most control applications do not involve FFT. Ladder is actually very good in the right applications, and you use another language or mix when it is not, If you are interested in automation, you had better actually learn about them.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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