PID MOTOR CONTROLLER
Cytron Technologies Sdn. Bhd.
Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No representation or warranty is given and no liability is assumedby Cytron Technologies Incorporated with respect to the accuracy or use of such information or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Cytron Technologies’s products as critical components in life support systems is not authorized except with express written approval by Cytron Technologies. No licenses are conveyed, implicitly orotherwise, under any intellectual property rights.
This document describes the development of Cytron Technologies DIY (Do It Yourself) Project PR24. This project describes the application of PID control technique in motor position control. Schematic and source code is provided. Please refer to Getting Start section on running the PR24 with sample program.
PIC16F876A - 8-bitmicrocontroller with 22 I/O - operate with 5V supply - operating speed 20MHz LCD (2X16 characters)
2X16 characters display
- Operate at 5V L293D Driver
600mA output current capability per channel High noise immunity 12V input voltage, 0.6W Rated speed of 130rpm and rated torque of 58.8mN.m 60g of weight
DC Gear Motor SPG20-50K Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved1
ROBOT . HEAD to TOE PR24 – PID Motor Controller
Set values of, P, I, D and ANGLE DC MOTOR
Multi-turn variable resistor Feedback GENERAL DESCRIPTION
PR24 is an open source microcontroller DIY kit. This PIC microcontroller based project was designed for user to understand the PID control technique. The project uses the PID controltechnique to control the motor position so that the motor can point to the angle desired by user in the most stable manner. User can physically indicate how the different values of P, I and D can affect on the speed, steady state error stability and overshoot during the transient response of the DC motor. It also provides LCD (2x16 characters) for user to indicate the values of P, I, D and angle whichselected by user.
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC® architecture into an 28-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. Feature of the device: • 256 bytes of EEPROM data memory • Self programming• ICD (In Circuit Debugging function) • 2 Comparators • 5 channels of 10-bit Analog-to-Digital (A/D) converter • 2 capture/compare/PWM functions • the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus • Universal Asynchronous Receiver Transmitter (USART) All of these features make it ideal for moreadvanced level A/D applications in automotive, industrial, appliances and consumer applications. Figure 3 shows the pin diagram for PIC16F876A. For more information about the PIC microcontroller, please refer to the datasheet. The datasheet can be found in microchip web site at: http://www.microchip.com
PID (proportional-integral-derivative) controller is a type of closed loopcontrol mechanism which widely used in industrial control system. Closed loop control is used to correct the error of the output. Besides, this technique can also improve both steady state errors, minimize the overshoot and improve the transient response.
Figure 1 Error = set value – output value Integral = Integral + error Derivative = error – previous error PWM = (P x error) + (I x Integral) + (D...