Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)
Target Amount: $2000
Amount Raised: $1061
Top Donor: C.C. $100
Created on: 18 April 2013
The OSPLC SMALL BRICK is an open-source PLC (programmable logic controller) that can be programmed using open source C language programming tools.
The PLC is a general-purpose controller with a wide variety of applications. It is useful to the engineer, technician, student and hobbyist.
All the source files for the small brick OSPLC are provided, including schematic diagrams so that you can build this project yourself or modify it.
Even if you do not wish to build the project, it serves as a useful reference design for anyone wanting to build a similar PLC project.
This video shows the Open Source PLC being demonstrated. One of three programs will run, depending on which input button is pressed. The fourth input button stops all programs from running. The other buttons are ignored by the program.
Can't see the video? View on YouTube →
Some applications that the OSPLC (Open Source PLC) can be used in:
The image below shows the small brick open source PLC (top right of cabinet) used to control a machine that automatically measures the density of rubber samples.
The PLC controls the pneumatic mechanisms for operating the machine, responds to button presses on the front panel, allows an operator to configure the machine using a keyboard and LCD, and prints test results to an RS-232 slip printer (bottom right).
The machine pictured above was fitted with new electronics and pneumatic parts. The restored machine resulted in a cost savings for the owner as it was much cheaper to restore the machine than buy a new one.
Features include digital I/O, analogue inputs, RS-232 port, RS-485 port, USB device port, JTAG debug port, real-time clock (RTC) with battery backup, Flash memory, SRAM and EEPROM.
Programming of the PLC can be done in C and C++. The internal microcontroller is directly accessible to the programmer.
Open-source software C programming tools are available for programming the PLC.
|Power Supply||24V DC – can be configured to operate from 12V to 24V|
|Digital Inputs||10 Inputs with LED indicators|
|Digital Outputs||8 NPN open-collector (current sinking) outputs rated at 200mA each|
|Analogue Inputs||4 analogue inputs rated at 0V to 10V, 10-bit resolution|
|Communications||1 × USB device port, 1 × RS-232 port (TX and RX only), 1 × RS-485 port, 1 × JTAG debug port|
|Real Time Clock||Seconds, minutes, hours, day, month, years, and century
Automatic leap year compensation
|Memory||256k bytes Flash memory for program and data storage
64k bytes SRAM for program and data storage
8k EEPROM for non-volatile storage, general-purpose use
|Microcontroller||AT91SAM7S256 32-bit ARM microcontroller from Atmel
Clock speed 48MHz
|Mounting||Uses standard DIN rail for mounting|
|Programming||Code is loaded via the USB or RS-232 ports using the on-chip boot loader or directly using the JTAG port|
GNU ARM tools are available for programming the open source PLC. The tools include compiler, linker, IDE and debugger.
The PLC can be programmed using the C and C++ programming languages.
A number of JTAG interface pods are available for single-step debugging, e.g. the SAM-ICE from Atmel.
Commercial software tools are also available.
The open source PLC was originally built in 2007 and was called "open source" because it could be programmed using open source C programming tools.
In April 2013, the OSPLC was made fully open source by publishing the source files for the hardware – as part of the project on these web pages.
Existing PLCs have restricted programming languages such as ladder logic. PLC software is proprietary and varies from manufacturer to manufacturer.
Embedded software engineers usually find PLC programming languages frustrating to use, but the advantage of a PLC is that it is an off-the-shelf general-purpose controller. There is no need to design new hardware when a controller is needed.
The Open Source PLC was designed to be an off-the-shelf C programmable general-purpose controller targeted to engineers and other embedded C programmers. The idea is to have an industrially packaged and designed C programmable microcontroller – packaged like and having an interface like a commercial PLC.
The example of the density measuring machine above shows how versatile the OSPLC is. It is interfaced to a PC keyboard and a RS-232 slip printer in addition to various input and output devices on the machine.
Because the PLC is programmed in C, it was easy to write the software for controlling the keyboard and printer. This would be difficult or impossible on a normal PLC.