RPisPLC Rapsberry Pi a simple PLC

Raspberry Pi (Model B + V1.2) simple PLC usable for home automation

An attempt to implement a simple PLC into a Raspberry Pi single-board computer.

Ladder Diagram running light example: ldr.hlp.running.light.mp4
RPIPLC HW running light example: rpi.running.light.mp4
View Raspberry Pi PLC in action:


PLCs were developed in the 1960s to replace the complex electrical relay circuits widely used for machine control in industrial automation. Users program PLCs to define a series of actions that a machine will perform. The PLC works by reading input signals from devices such as sensors or switches and, depending on the value(s), turning outputs on or off.

PLC Siemens S7

In its simplest form, a PLC replaces relay logic. Instead of mechanical devices like interconnected relays or timers providing the logic for a machine or other device, the PLC is a single boxed device performing the same function. Because it is programmable and in essence a computer, it is more flexible, easier to change than physical relay wiring and a great deal smaller than the relay equivalent. It can also perform arithmetic and other functions, such as servo control and analog measurement.

Traditional PLC programming resembles a relay diagram, and for simple diagrams it has the same meaning. PLCs are usually programmed off-line, using tools running Linux or Windows. The text-based programs or ladder diagrams are compiled to an intermediate language that is downloaded to the PLC and interpreted. The PLµX project is an interesting study as an embedded controller. Like the PLCs it will replace, it is much more general than most embedded projects.

RPI PLC view complete

With a  Raspberry Pi board and the aid of eight GNUBLIN Module-Port-expanders the state of 64 inputs can be monitored and 64 outputs can be driven. The project provides also to add 4 GNUBLIN ADC-Modules ( 4 x 8 analog inputs).
This ADC module is used to measure voltages. The modules can be easily connected via a ribbon cable to the Gnublin Board or the Gnublin Module-Bridge.

A ladder diagram editor is also included. This Ladder Diagram Editor is designed to allow you to easily prepare a PLC program by simply placing blocks.
Ladder diagrams, which are in many ways similar to relay logic diagrams, are frequently used to graphically generate programs. When the instructions in the program are executed, the states of the inputs are monitored, depending on these states, various outputs are set either High or Low.

All functionality of the ladder diagram editor is available only under ubuntu. Other Linux distributions have not been tested.

With the Windows operating system, it is not possible to benefit from the on line features. Windows users can use a popular program named PuTTY to interact with the Raspberry Pi PLC.

Hardware configuration

The most important components.

Picture PLC complete

  1. Raspberry Pi model B +.
  2. GNUBLIN Module-Bridge .
  3. GNUBLIN Module-ADC .
  4. Digital 24V IO-interface .
  5. Empty.
  6. Empty.
  7. GNUBLIN Module-Portexpander .
  8. Test board for Module-Portexpander.
  9. 8 switches connected to 8 digital inputs.
  10. 8 lamps (24 V, 2 W) connected to 8 digital ouputs.

How to start=>.



Is it possible to run rpisplc real time

Rpisplc is not real time. In the future there are plans to implement a real-time OS. Some interesting sites: https://www.socallinuxexpo.org/sites/default/files/presentations/Steven_Doran_SCALE_13x.pdf https://www.raspberrypi.org/forums/viewtopic.php?f=56&t=49373

I read , it 's not possible ,at this time use real time clock . Does it explain ,there is no backup time ,no timestamp possibility . If Rpiplc come power off, we need to reprogram the time manualy or with an external terminal ?

Where does the Raspberry Pi get the time from? Raspbian gets the time from an NTP Server (a "time server"). See article: http://raspberrypi.stackexchange.com/questions/4370/where-does-the-raspberry-pi-get-the-time-from

It's an PLC, so this is an autonomous system . I see in autonomous ,unconnected from external environnement like a network. I just ask, if in this unconnected network condition, unpowered, if it is necessary of reload the time or no. In a outside configuration ,in exemple, without network .

Plug in an Ethernet cable into the Ethernet port so that the Raspberry Pi board is connected to the Internet. Connect the micro-USB power cord, which will automatically turn the Raspberry Pi on. Use the Ladder Diagram Editor (RPILDE) to download a program to the Raspberry Pi board. Start the RPIPLC program on the Raspberry Pi board with the RPILDE software. Disconnect the Ethernet connection from the Raspberry Pi board. The RPIPLC software now runs independently on the Raspberry Pi board!

Add new comment