Shop OBEX P1 Docs P2 Docs Learn Events
P.I.D — Parallax Forums

P.I.D

DileepDileep Posts: 4
edited 2006-09-27 19:33 in Learn with BlocklyProp
Hiii all,
Iam a beginner in control systems and recently started working in Basic stamps....I need to control ball and beam experiment with BS2 using P.I.D technique...Could any one please help me out with source code in BS2 for PID implementation of controlling DC motor or stepper motor. My objective is to control the beam (coupled with DC motor) angle so that ball should always maintains in centre position on the beam. Waiting in anticipation...

Thanks,
Dilip Kumar
Masters Student,
Mechanical Engineering
University of Kansas.

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2006-09-25 16:44
    Dileep, I dont know if this is what your looking for or if you have read it already but I found it to be a really useful article by Andy Lindsay @ http://forums.parallax.com/showthread.php?p=529609

    Jeff T.
  • DileepDileep Posts: 4
    edited 2006-09-27 15:24
    Hi jeff,

    I have read it as it is very informative. Thanks for it. but my query is how to interface stepper motor with this PID control method. what kind of sensors have to be used....like IR sensors?? I request you to please give me any code for runnning stepper motor( along with feedback sesnors) with basic stamp using PID control method.

    with Thanks,
    Dileep,
    Research Assistant
    University of Kansas
    http:///g.1asphost.com/dilk05
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-09-27 19:33
    Hi Dileep,
    I have had my students do similar, using as a framework code from my "Process Control" text from Parallax.

    What works out better than stepper motors or DC motors is using a servo. What we did was a leveling program to try and keep the ball on a slightly curved rail. The memsic accelerometer was used to detect the degree of tilt and the servo was positioned using PID to try to keep it level and the ball on there.

    The servo is nice because the pulsout variable is 500 to 1000 and give a nice span for control action over 180 degrees. A stepper you'd be dealing with how many steps and how fast to clock it.

    As mentioned, we simply measured the tilt and adjusted based on that. It was interesting to watch the response as we rocked it.

    For detecting the actual ball position, it becomes a little more complex. One possible way to to use conductive rails for a metalic ball, so the further the ball is, the higher the resistance. Or you could use an ultasonic sensor (PING) on one end to measure the distance to the ball, though system response will be limited by how fast you can ping.

    Hope this helps some?
    -Martin Hebel

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
Sign In or Register to comment.