PLC (Programmable Logic Controller) with Microchip Pic Microcontroller




An year ago i made a plc (programmable logic controller) using microchip pic microcontroller. Its a 16 bit digital input and output programmable logic controller. Plc programming is done using a standard ladder logic language. The software that is used for plc programming and ladder logic design is an open source compiler written by Jonathan Westhues called LDMicro. Microchip pic microcontroller that i used in the project is an 8-bit pic16f877a.

Core PLC (Programmable Logic Controller) board

Core plc board is comprised of 16 digital inputs and 16 digital outputs. Inputs are opto isolated. Optocouplers are used to protect the circuit/processor from heavy loads damage. Diodes are used at inputs from reverse polarity protection. At output side i used 16 relays for switching heavy loads. Relays are rated as +12v. They are derived from Uln2803 Ic.Uln2803 is an 8-channel darling-ton array high output current ic.
Uln2803 can sink 500mA of current from a 50V power supply. It has built in fly-back diodes for driving coils and prevents from back efm damage. Relay coils are directly connected to the uln2803 output and does not need the fly back diodes, since they are build inside ic. Core plc board processor is pic16f877a working at 20MHz. Whole board is powered using a +12v dc supply. LM7805 regulator is used to convert the +12v to +5v for power supply to microcontroller, opto couplers and uln2803 relay driver.

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.

img-20170214-125943_orig
eagle-pcb-of-circuit_orig

PLC status board

Status lcd board purpose is to show the status of the plc inputs and outputs. Four 74ls574 8-bit latches on status board are used to store the input and output status of plc. Two latches store input status and the remaining two store the output status. A 40×4 character lcd on status board is used to show the plc status visually. Active pin is shown as up arrow and the non active pin is shown as down arrow. Status lcd core processor is 89c51 microcontroller. Port-0 of 89c51 has a common 8-bit bus, shared with all the latches. Latches are activated sequentially to obtain the stored result and prevent from data collusion. Latches data is processed and then displayed on the 40×4 character lcd. Lcd is connected to port-1 of 89c51 microcontroller. Lcd is interfaced with 89c51 in 8-bit mode. Status board works on +12v dc.
for more detail: PLC (Programmable Logic Controller) with Microchip Pic Microcontroller




Leave a Comment

*
= 5 + 7

Read previous post:
Lowest-IQ ‘fuel gauge’ monitors batteries in wearable & portables

Maxim Integrated has posted details of a battery charge monitor IC for which it claims the lowest quiescent current available,...

Close
Scroll to top