1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Servo motor control...

Discussion in 'Microcontrollers' started by koolguy, Sep 26, 2013.

  1. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,324
    Likes:
    585
    Location:
    Peterhead, Scotland
    ONLINE
    OMG WTF!!
    What happens in that video is so wrong on so many levels.
    JimB
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,151
    Likes:
    907
    Location:
    Rochdale UK
    ONLINE
    You should know yourself whats happening here.... You need to learn how to control the servo... You are turning the servo completely on, but your arm is preventing it going the full movement, thus this is the result..

    If you monitored the current and then back off when the arm is in the correct place it will work okay...
     
  3. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    501
    Location:
    Cleveland, OH, USA
    ONLINE
    Thank you for the video. That was helpful.

    Some simple questions:
    1) I assume you are driving the servo at 50Hz refresh rate. Is that correct? (I have seen such oscillations when I tried higher refresh rates.)
    2) Are you running the servo at 4.8 volts (+/-) or 6 volts? (I assume 4.8V to 5V.)
    3) Can you set an electronic "stop." That is, set a minimum pulse width that is just a little past what is needed to close on the object. (I am assuming longer pulses give clockwise/right hand movement.)
    4) Put a small resistor (=<1 ohm) in the V+ line to the servo and monitor the current.
    5) Check what is happening to the supply voltage to your MCU when the servo stalls. Maybe this is just a simple matter of better decoupling the MCU supply from the servo or using separate supplies.

    Finally, after you get this problem solved, you might want to consider adding a current monitor to your program and keeping the small resistor so that the gripping servo is not constantly being run in a stalled condition. That is, when the current increases by a set amount, hold that pulse width or slightly more/less, as appropriate.

    John

    Sorry for duplications, I took a long time typing.
     
    • Like Like x 2
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND

    so my guess was correct!! way hay first for me lol. seriously tho if you look at the end of the video you can see where it drops whatever it is but still closes, so your asking the servo to move past the point it's actually gripped.
    me i would use ADC to monitor current and take readings when it grips to get a rough idea how much current is drawn with a good tight grip, then back it off slightly, probably best to take say 16 readings each time and average them when you use ADC. or use a comparator and set current draw that way so when the draw trips comparator output high have the chip stop the servo
     
    • Like Like x 1
  6. ghostman11

    ghostman11 Well-Known Member

    Joined:
    Nov 22, 2009
    Messages:
    1,192
    Likes:
    99
    Location:
    Scotland
    is this for a product to sell or just messing about and learning stuff? i find it hard to grasp that you couldn't see the problem, or more likely i think Ritesh you need to step back a little, it's almost like a habit for you now that when something dose not do as you expect then you post on here for help, instead i think on this occasion a little time examining your video and thinking about how your project works would have at least told you what was wrong. Then of course there is no harm coming here saying ok guys this is the problem i have any advice on how i could solve it, but the fact you didn't spend time to see what the problem was tells me your getting too reliant.
    as my son LG pointed out, if you watch your video right at the end you see the bottle slip from the grip and the jaws close fully. you don't need an education to understand that a motor/servo will be strained and complain in a situation like this. Seriously Ritesh think more before posting,i am starting to see why some are getting fed up

    regards
    Jason
     
    • Like Like x 3
  7. ghostman11

    ghostman11 Well-Known Member

    Joined:
    Nov 22, 2009
    Messages:
    1,192
    Likes:
    99
    Location:
    Scotland
    i dont like to be negative, so i thought i would try and add something constructive.
    what is the gripper for? by this i mean does it have a purpose? if so is it picking up one object of fixed size only,or is it for picking up objects of differing size?

    is that the final prototype of the gripper design? or just a test bed?
    I know little of engineering as such but i am a scientist by training and have many experiments under my belt, i mention this because there is often detail lacking in your posts. Detail is everything in experiments and prototypes, for example if your gripper is only picking up a fixed sized object then the solution to the problem is very simple.....you just adjust the angle that the servo needs to travel too. if its going to be picking up different sized objects then you need to use something like current sensing to stop once the grip is enough to hold but no more than that.
    Also it needs to operate a little slower in my opinion unless speed of grip matters alot. simply because it will grasp better if you slow down the speed of closure, at the moment it just grabs full speed and the object jumps a little, with a slower speed you can have more control with the current sensing.
    Slowing down the speed is easy you just move a fraction......small delay move a little more.....small delay and so on until you reach final position, we are not talking creeping kind of slow but more a steady controlled closure instead of a rapid grab.

    fix the gripper so it doesn't fall apart!! what exactly is it for picking up anyway? if it's tubs like on the video then in my opinion the gripper needs to be thicker at the ends and maybe have some kind of rubber lining to improve grip.
    you need to post much more detail rather than just ask for code, people are really trying to help you but you are not making it easy, mistakes in advice happen because you cant be bothered to outline properly the object you wish to achieve.
    the way it stands at the moment it's getting very close to a situation like the LED sign, where you are given a task i assume being paid for? then come here and get the solution and dev work done for free. that is a little unfair, asking for help is no problem, but you need to show you are the one doing the work.
    you are being given heaps of help but showing little progress in learning so time to ask yourself if this kind of work is for you. if its just fun projects for the sake of learning then read the replies more carefully and take time to understand what you are being told. and if its paid work your doing then give up until you at least have the minimum basic equipment to be able to develop the products you are asked too.
    just a few thoughts and ideas not having a go at you but i am concerned that your current attitude will affect others ability to get help in the future. please think about this.

    so lets see how much you read, please answer the questions i have asked and also list the equipment you have for development

    best regards
    Jason
     
    • Like Like x 1
  8. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    what attitude please tell....
     
  9. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    OK, this my last post on ETO.
    bye.
     
  10. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    501
    Location:
    Cleveland, OH, USA
    ONLINE
    I hope not.

    Can we get back to solving the gripper problem (post #103)? Have you tried any of those suggestions?

    John
     
  11. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,151
    Likes:
    907
    Location:
    Rochdale UK
    ONLINE
    I hope not either.... I enjoy helping you.... Sometimes gets me fired up but, I'm a man, I can take it..

    I have spent quite a few hours, neigh days, don't let it go to waste....
     
    • Like Like x 1
  12. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9

    Everything is fine i have no problem with any one.
     
  13. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    hows the servo going Ritesh?? not heard anything for a while??? or you found help elsewhere? was looking forward to an update
     
  14. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37
    all you need to do is turn off the PWM after arm has gripped,
     
  15. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,151
    Likes:
    907
    Location:
    Rochdale UK
    ONLINE
    Yes! This is exactly whats needed... A simple current detector on the motor supply, linked to the ADC and you can use feedback to position the arm....

    Or a tiny micro switch om the gripper to ascertain it's grip...
     
  16. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    501
    Location:
    Cleveland, OH, USA
    ONLINE
    I think the current sensor is the better way to go. The microswitch could be falsely triggered before a solid grip; current will indicate stalling. I have doubts about turning off the PWM vs. setting it to the proper grip value based on current. A small spring incorporated in the gripper might help keep tension. Commercially, they are called "servo savers."

    Going back to Ritesh's video, the first attempt at gripping is confounded by the instability of the gripper. In the second attempt, at about the 32 sec mark (+/- 1 sec), the gripper appears to release, I have never seen that behavior from a stalled servo. In theory, it might happen if the supply failed/glitched -- either with or without the MCU resetting. That is why I suggested Ritesh check the supply out. A simple test for resetting would be to use a separate supply for the MCU. Ritesh also has an oscilloscope that he could use to monitor the supply voltage.

    BTW: Is there a way to slow down or step through the frames of these videos? I am using Windows 7 Pro default install.

    John

    Edit: I wanted to confirm with an actual HS311 servo the behavior with power, but no pulse (i.e., signal floats or is grounded). It is "dead." That is, there is no holding power. So, I think the proper PWM needs to be applied to keep grip.
     
    Last edited: Oct 13, 2013
  17. tvtech

    tvtech Well-Known Member Most Helpful Member

    Joined:
    Mar 27, 2010
    Messages:
    3,166
    Likes:
    348
    Location:
    South Africa
    Stop punishing yourself Ritesh...

    You were here today online @12.53 SA time. Looking at user profiles.
    But you will not post...

    NOBODY here dislikes you. You must stand up and be a Man when people criticize...and find faults in stuff you do.

    Remember, if nobody cared, we would not try to correct you. And help you.

    I am have been criticized many times in my life. I have grown and learned from criticism.

    You should only worry when all loose interest in you and walk away. ETO have never lost interest in you or walked away....you decided to do that.

    And it's killing you. Otherwise you would not have been here looking @ 12.53 SA time at user profiles.

    Think about what I have said above.

    Regards,
    tvtech
     
  18. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Believe me every thing is fine...i was watching my first uc thread on assembly lang..
    actually i am trying to Learn from basic arch reading data sheet and Google.
     
    Last edited by a moderator: Oct 27, 2013
  19. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,888
    Likes:
    501
    Location:
    Cleveland, OH, USA
    ONLINE
    Hi Ritesh,
    It is good you are back. If you are interested in Assembly, I highly recommend Nigel Goodwin's tutorials. The link is in his signature.

    The other day, I was searching on something else and came across a pre-made gripper at Servo City. Shipping might be expensive, but the small unit is low priced: http://www.servocity.com/html/micro_gripper_kit.html

    If you search that site for "gripper' or "stacker" you will find larger units suitable for objects the size of beverage cans. Unfortunately, they are much more expensive.

    John
     
    • Like Like x 1
  20. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,151
    Likes:
    907
    Location:
    Rochdale UK
    ONLINE
    Good post John!!! Very helpful, I could do a bit of experimenting with those.
     
  21. remon7

    remon7 Active Member

    Joined:
    Aug 3, 2013
    Messages:
    122
    Likes:
    55
    Location:
    Malaysia
    hi
    RITESH KAKKAR,
    I’m highly interested about your project please upload a video about your project, I want to see your project.
     

Share This Page