Dspic-Servo Project using PIC30F4012 microcontroller

Project Description

This project was developed as an inexpensive way to drive small dc brushed motors as positioning servos for use on a desktop sized CNC machine. The board is interfaced to the PC through 2 pins of a parallel port. The drive signal on these pins is known as quadrature drive.

Dspic-Servo

The power stage consists of a power op amp driven in constant current mode. The internal PIC processor ( a 30f4012 from Microchip ) is programmed in C through the C30 compiler and the Microchip IDE. The servo loop parameters are programmed through a serial port connection and are saved in the dspic eeprom. Once set for a particular drive, they should not need to be changed.
A YouTube video by Ted Maczulat.

The serial programming interface is used to tune the PID and other servo loop parameters to optimize the performance in a particular application. The serial port runs at a fixed baud rate of 9600N81. Any terminal program such as minicom, gtkterm, or hyperterminal may be used to talk to the dspic-servo. On powerup you will see the following:

Powerup...i/o...uart...timer...pwm...pid...encoder...capture...done

dspic-servo by L. Glaister
(c)25-Sept-2006 by VE7IT

using setup from eeprom.. ? for help

Current Settings:
servo enabled = 1
(p) = 0.020000
(i) = 0.000000
(d) = 0.000050
FF(0) = 0.000000
FF(1) = 0.000000
dead(b)and = 1.000000
(m)ax output = 2.500000
(f)ault error = 1024.000000
(x)pc cmd multiplier = 3
(t)icks per servo cycle= 10

To change a value, type the cmd letter/number and then a value for example:

p0.03

The current values will be redisplayed with the new value set. The p,i,d, ff0 and ff1 values are standard loop gain parameters. You can reference the source code for a better explanation. The deadband parameter is the number of encoder counts the servo can be out of position without the servo loop taking any corrective action. The max output is the maximum current output allowed in amps and should be set for the particular motor you are using. This number can be up to 7 amps. The fault error parameter is used to set the number of counts the servo can be out of position before the drive gives up and indicates a drive fault. This is used to detect crashes and jammed axis or input command conditions beyound the capabilities of the motor. The pc command multiplier is useful for cases where you have a high resolution encoder on the motor and a PC that is limited in the number of pulses/second it can output. For most operation this number will be set to 1, but if you have trouble reaching the top speed you need from the drive, it may be helpful to set this number to a higher value. The internal servo loop works by keeping 2 counters. The first is the commanded position from the PC, the second is the actual position from the encoder. The servo loop of the drive attempts to keep these 2 numbers as close as possible to each other.

 

For more detail: Dspic-Servo Project using PIC30F4012 microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.