Summary of PLC (Programmable Logic Controller) with Microchip Pic Microcontroller
One year ago I built a 16-input, 16-output PLC using a PIC16F877A, programmed with ladder logic via LDMicro. Inputs are opto-isolated; outputs use 16 relays driven by ULN2803. The core board runs at 20 MHz, powered from +12 V with an LM7805 for +5 V. A built-in PICkit 2 ICSP programmer (with DIP switches) programs the PIC. A separate status LCD board (89C51) uses four 74LS574 latches and a 40×4 LCD to display I/O states. Project code and PCB designs were created and shared.Parts used in the PLC project:
- PIC16F877A microcontroller
- 20 MHz crystal
- Optocouplers (for 16 inputs)
- Diodes for input reverse polarity protection
- Pull-up resistors for input pins
- 16 relays (12 V rated)
- ULN2803 Darlington driver IC
- LM7805 voltage regulator
- +12 V DC power supply
- PICkit 2 programmer (on-board, ICSP interface)
- DIP switches (to connect/disconnect PICkit 2 to PIC)
- 89C51 microcontroller (status LCD board)
- Four 74LS574 8-bit latches
- 40×4 character LCD
- PCB (core PLC board and status board)
Core PLC (Programmable Logic Controller) board
For programming the board/microcontroller/pic16f877A pickit 2 programmer is made on the board. Pickit 2 is a programmer by microchip used to program its pic microcontrollers. Pickit 2 uses icsp interface to program the target microcontroller. Icsp interface of pickit 2 programmer is connected with the pic16f877a microcontroller using DIP switches. When ever a new logic is desired to be downloaded in the processor, switch on the dip switches. Dip switches are installed to prevent the controller pins from interference by the pickit 2 programmer circuit. I have a separate tutorial on pickit 2 programmer made at home. Visit the link for more information
Microchip Pickit 2 Programmer made at home – Diy Project
The Resistors on the front side of the pcb that are not aligned are added after the pcb printing. These resistors are added as pull-ups to the input pins. While testing the circuit i found that the input pins of pic16f877 floats so i added the pull-up resistors. On pcb back i added some extra tin/lead on the traces to remove any resistance created in them during the etching process.
Circuit/Block diagram and Pcb of Core PLC board.
PLC status board
Some tutorials that will help you in understanding the interfaces and working of the status board.
- 74ls574 data/address Latches with 89c51 microcontroller.
- Character Lcd in 8-bit mode with microcontroller
- Displaying custom character on lcd using 89c51 microcontroller
Plc Status board Circuit

Ladder logic design and processor selection

Quick Solutions to Questions related to PLC project:
- What microcontroller was used in the core PLC board?
The core PLC uses a PIC16F877A microcontroller. - How many digital inputs and outputs does the PLC have?
The PLC has 16 digital inputs and 16 digital outputs. - How are the PLC inputs protected?
Inputs are opto-isolated and diodes are used for reverse polarity protection. - What drives the relay coils on the output side?
The relay coils are driven by a ULN2803 driver IC and are 12 V relays. - How is the PIC microcontroller powered?
The board is powered from +12 V DC and an LM7805 regulator provides +5 V to the microcontroller and other components. - Which software is used to design ladder logic for the PLC?
Ladder logic is designed using the open source LDMicro compiler by Jonathan Westhues. - How is the PIC programmed on the board?
The PIC is programmed using an on-board PICkit 2 via the ICSP interface connected through DIP switches. - What displays the PLC input/output status?
A status board with an 89C51 microcontroller, four 74LS574 latches, and a 40×4 character LCD displays I/O status. - Why were pull-up resistors added to input pins?
Pull-up resistors were added because during testing the PIC16F877A input pins were floating. - At what clock frequency does the PLC microcontroller run?
The PIC16F877A runs with an external 20 MHz crystal.
Related projects
PIC16F877 Driving LCD in 4-Bit Mode using PIC16F877 with Proteus Simulation
Introduction This microcontroller project shows how a PIC16F877 can drive an LCD display using 4-bit mode inside a Proteus simulation.The project demonstrates...
Programmers & ICSP · PIC16F877AEPE PIC/LCD Demo using PIC16F877 with Proteus Simulation
IntroductionThe EPE PIC/LCD Demo is a classic microcontroller project that demonstrates how a PIC16F877 can fully control a PG12864F graphical LCD.Designed as...
Motors & Robotics · PIC16F877AEfficient Sun-Following Robot: A Solar Tracker with Microcontroller Control
Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....
Programmers & ICSPCalculator Test using PIC24FJ64GA006 with Proteus Simulation
Introduction The Calculator Test using EASYHDL is a practical microcontroller project built on the PIC24FJ64GA006 and simulated in Proteus. This project demonstrates...
Programmers & ICSPPID Controlled Oven using TMS320F28027PT with Proteus Simulation
IntroductionThis project demonstrates a PID controlled oven implemented using a PICCOLO TMS320F28027PT microcontroller and verified through Proteus simulation.It is a practical microcontroller...
Programmers & ICSPPICCOLO Motor Controller Sample Design using TMS320F28023PT with Proteus Simulation
IntroductionThis project demonstrates a PICCOLO motor controller sample design implemented using the TMS320F28023PT Piccolo microcontroller and tested through Proteus simulation. It focuses...


