Shop OBEX P1 Docs P2 Docs Learn Events
servo motor control by using potentiometer — Parallax Forums

servo motor control by using potentiometer

mongkioskmongkiosk Posts: 4
edited 2010-06-09 05:12 in Robotics
hello guys
i am going to do my final year project regarding the servo control
because i am going to construct a robotic arm
basically,i need some guides to do it
i need some guidance how the potentiometer can control the servo rotation respectively by rotating the potentiometer probe
i've been watching some videos on youtube where got some people already succesfully do it
so I really appreciate if someone can help me in this
roughly,i am going to do it using 8051 as the brain and for sure i need adc to convert the continuous signal from the potentiometer to digital signal
thats the only basic thing i know
really need some guidance from some experts herecry.gif
thank you very much~

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-02 14:34
    This is a support forum for Parallax products, so we can't help you with the 8051 hardware or the coding, but the general principle is that you use some kind of ADC to determine the potentiometer position. Another technique you can use is to use the potentiometer as the "R" portion of an "RC" circuit where the capacitor is charged through the potentiometer and the 8051 times this to determine the resistance. There are examples of this in the "BASIC Stamp Syntax and Reference Manual" under the RCTIME statement.

    The "Robotics with the BoeBot" tutorial describes how servo motors work and shows how to control their movement. The same process would be used with the 8051. The Stamp's PULSOUT and PAUSE statements are used to generate the control pulses for the servo and you'd have to do the equivalent with the 8051.

    You can find the Stamp documentation and tutorials here: www.parallax.com/tabid/477/Default.aspx
  • ercoerco Posts: 20,256
    edited 2010-06-02 15:49
    See Gramps' fabulous Shadow Arm at http://forums.parallax.com/showthread.php?p=906827

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Jessica UelmenJessica Uelmen Posts: 490
    edited 2010-06-03 21:03
    Hi mongkiosk,

    Also check out Chapter 5, Activity #4 in What's a Microcontroller. You'll have to modify the code for your 8051, but the basic concept it there.

    Let us know how it goes!

    -- Jessica

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jessica Uelmen
    Education Department
    Parallax Inc.
  • mongkioskmongkiosk Posts: 4
    edited 2010-06-08 07:32
    thank you guys.some infos are really helpful and related to my project
    basically,the BASIC STAMP is a microcontroller right so it means i do not need the 8051 anymore?
    in the example, it shows only one pot and one servos
    is it applicable for more pot n servos pairs?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-08 14:32
    The Basic Stamp is a microcontroller, yes.

    A two pot/ two servo program is only a little more complicated than a one pot/ one servo program. You just have to be careful to keep to a 20ms cycle because that's the way servos work. You could probably handle 3, but there just isn't enough time in a 20ms cycle to handle much more than that.
  • mongkioskmongkiosk Posts: 4
    edited 2010-06-09 03:02
    thank you mike
    yesterday, i did some study on the basic stamp and if I'm not mistaken, it is much more easier for me right to use the basic stamp microcontroller instead of 8051?
    there is also some tutorials on how to control the servo also
    so i just want to know,is it good for me to get the board of education by parallax
    and i just want to make sure,how many pairs of pot n servos the the board of education can handle at one time?
    because my project need to use 6pot n 6servos
    is the board of education can handle all this?
    thank you
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-09 03:31
    The Board of Education cannot handle 6 pots with 6 servos without external hardware. You would be better off using something like the Propeller which can easily handle 6 to 14 servos with pots.


    After thinking about this a little more ... I think a Basic Stamp could handle 6 pots with 6 servos, but the response time to changes in the pot positions would be slowed down. A servo control pulse is, at most, 2.5ms in width. 6 of these would take 6 x 2.5ms = 15ms. That leaves only about 5ms in the 20ms allowed before the next servo pulse would have to be sent. It might be possible to read the value of one pot in that time using an RCTIME statement as shown in the Stamp Manual. By reading one pot each cycle, you could read all the pots in 6 x 20ms = 120ms. That's about 8 readings a second. That may be fast enough for you. You wouldn't get a high resolution of the pot setting. You'd do better using an external Analog to Digital Converter, one with 8 channels (for the 6 pots). That could certainly work for what you want.

    Here's one example of an 8 channel ADC:
    www.parallax.com/Store/Components/IntegratedCircuits/InterfacingChips/tabid/613/CategoryID/78/List/0/SortField/0/Level/a/ProductID/573/Default.aspx

    Post Edited (Mike Green) : 6/9/2010 3:46:00 AM GMT
  • mongkioskmongkiosk Posts: 4
    edited 2010-06-09 04:56
    so u means,by using the board of education,i can control 6 pair of pots and servos but I need to add ADC?
    i already watch video on how servo are controlled by propeller but based on what I see,all the servos are automatically and simultaneously rotate
    can the propeller do as I expected which is each pot control their respective servo,without interrupt other servo movement?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-09 05:12
    The Propeller is very fast and it has 8 essentially identical processors (cogs). There is a servo control library routine that can handle up to 32 servos using a single cog with some fancy programming that you don't have to deal with. Your program simply calls the library routine with a new position for any servo and the control cog takes care of the rest. There are lots of ways to read the position of a pot. Which way is "better" depends on how precisely you want to read it and how quickly you want to do it. You could assign a separate cog to read each pot and have a "main" cog simply copy those values to the servo library routine repeatedly.
Sign In or Register to comment.