View Single Post
  #2   Spotlight this post!  
Unread 13-06-2012, 09:35
efoote868 efoote868 is offline
foote stepped in
AKA: E. Foote
FRC #0868
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2005
Location: Noblesville, IN
Posts: 1,375
efoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond repute
Re: PID Control algorithm(to control PWM Duty Cycle based on Current)

The conversion units from amps to duty cycle is included in the constant values Kp and Ki.

e.g. (6A - 5A) * (Kp %/A) = Kp%

To get the duty cycle, add all components:

(error * Kp) + (integrated error * Ki) = duty cycle.

The constants Kp and Ki are usually determined experimentally, through trial and error. I would recommend tuning your motor at a constant voltage to determine Kp (start with Ki = 0), and then changing the voltage to determine Ki.
__________________
Be Healthy. Never Stop Learning. Say It Like It Is. Own It.

Like our values? Flexware Innovation is looking for Automation Engineers. Check us out!