Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Application: Proportional feedback from a Standard Hobby Servo (Upda — Parallax Forums

Propeller Application: Proportional feedback from a Standard Hobby Servo (Upda

Beau SchwabeBeau Schwabe Posts: 6,545
edited 2017-09-10 14:59 in Propeller 1
Here is an interesting application that allows you to accurately sense the position of a standard Hobby Servo without modifying the servo.
Note: This could also be accomplished with a BS1,BS2, SX, etc.

attachment.php?attachmentid=41311

With a simple modification to the schematic... using PNP transistor acting as a switch across the 470 Ohm resistor, you can also "drive"
the servo you are sensing.

One application might be for a robot to "learn" or record a sequence of movements simply by positioning the servo where you want it to be,
so at a later time your robot would replay the "learned" motion.

Have fun!

«1

Comments

  • PLJackPLJack Posts: 398
    edited 2006-04-22 01:21
    How cool is that?!
    Very nice Beau.
    Somebody said...
    One application might be for a robot to "learn" or record a sequence of movements simply by positioning the servo where you want it to be,
    so at a later time your robot would replay the "learned" motion

    The first thing that came to my mind is controlling a device inside a sealed container, or what not. You get the idea.

    Great stuff.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - PLJack - - -



    Perfection in design is not achieved when there is nothing left to add.
    It is achieved when there is nothing left to take away.
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2006-04-22 02:58
    Thanks PLJack !

    I don't know why I haven't seen this sort of thing before, the idea came to me a few nights ago and I thought I would try something out.... and it worked!!
    The scanning algorithm needs a little improvement (I'll try to work on that), but it does get the idea across.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • cgraceycgracey Posts: 14,133
    edited 2006-04-22 07:47
    Beau,

    That video says it all. Good job!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • parskoparsko Posts: 501
    edited 2006-04-22 09:39
    Wow, I never thought that was possible. Beau, if you were to spin that thing 360deg, would the slave also spin the same amount? Is there a lag? There appears to be one in the video, but it's too hard to tell.

    Really cool!!!

    -Parsko
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-04-22 10:45
    I think we all assumed that servos could only be input devices, not provide useful position data.

    It opens a whole new area to exploiting servos as sensors.
    I am sure the Japanese folks that have been selling Parallax servos are happy.
    They can tweak their product line to enhance this function.

    BTW, is this only a limited to a Standard Servo?

    What happens with the full rotation Servos [noparse][[/noparse]I do realize that you don't have the same kind of feedback]?
    Are they usefull in a similar fashion [noparse][[/noparse]as a sensor]?

    I also see where you could make a steering wheel for a BOEbot with it. Lots of ideas.
    I guess that is why Parallax is special - innovation is just everywhere.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2006-04-22 15:34
    Chip.
    Thank you!


    Parsko and Kramer,

    The idea was for a standard servo, a 360 or continuous rotation servo would work I guess.

    And yes, there is a bit of lag... mostly because of the scanning, but with a better "algorithm"
    this can be improved upon. What it boils down to right now, is that you can't move the sense
    servo very fast and expect the following servo to keep up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • CJCJ Posts: 470
    edited 2006-04-22 15:40
    I don't see how a continuous rotation servo could work as a sense servo, its feedback pot is in one position and doesn't change when you move the horn, so you would get just the "center" value for the servo everytime

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-04-22 16:34
    CJ
    I think you are probably right, but you could drive a continuous serve with it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • LawsonLawson Posts: 870
    edited 2007-09-27 22:32
    I'm using this basic concept to make a servo-controller to replace solenoids and other simple two position actuators while providing for useful remote diagnostics.

    The first picture I've attached shows the drive circuit I'm using. Vservo is the power input, GND is the ground. Signal is where the servo signal is provided, and Mode controls how much power the servo is supplied with and senses the voltage of the servo.

    The spin file attached is some crude code for the primitive functions needed to move a servo and find where it currently is.

    I've built up a first prototype on a Propeller proto board with 5x copies of this circuit and a MAX3232. I've also got a PCB layout for this in case we ever need a second one.

    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?

    Post Edited (Lawson) : 9/27/2007 10:38:27 PM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2007-09-27 23:04
    Lawson,

    Excellent!· I'm glad that this is working for you.· Can you post pictures or video of your application in action?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • ClemensClemens Posts: 236
    edited 2007-09-27 23:40
    So how could I make sure a continuous rotation servo has reached the desired destination?
    Would I need an encoder of some kind? Are there any motors with encoders sold for hobby applications?
    - I havn't found any, but maybe I'm not searching right, so I would appreciate any suggestions.
    The background is, that I would like to build a panorama camera with the propeller.
    I have already built one with Lego-Mindstorms:
    http://www.secondpage.de/tutorials/mindstorms/vr1_en.html
    (works nice but I'd like to build something smaller and less fragile to carry around in the mountains...)
    - the mindstorms servos actually do have an encoder inside, I am hoping there is something similar to attach to the propeller.
    Thank You,

    Clemens
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2007-09-28 00:22
    Clemens,
    ·
    This application was never really meant for a continuous rotation servo.
    To determine the position of a continuous rotation servo would require an·encoder of some sort.
    ·
    Now, with that just said,·some would argue that·a standard servo·would also require an encoder to
    determine position.· However, the application at hand, sort of proves this theory wrong.
    ·





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • CapdiamontCapdiamont Posts: 218
    edited 2007-09-28 05:46
    How durable would servos be in this application? What kind of damage?
  • RaymanRayman Posts: 13,800
    edited 2007-09-28 10:47
    I'm impressed by all the cool stuff in this forum. This is an especially interesting trick here! I wish I could download the entire forum, so I could search it myself... I don't think I'd ever known about this if Lawson didn't reply...
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2007-09-28 14:19
    Capdiamont,
    ·
    The only real possibility of damage would be from stripping out the servo gears.
    Moving them slowly is fine but quick abrupt movements can easily strip out the nylon servo gears.
    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • rjo_rjo_ Posts: 1,825
    edited 2007-09-28 14:42
    Rayman,

    It would be nice if we could order entire forum...with regular updates for offline work. The issue of searching has also been discussed in depth... but finding the discussions is another matter.

    if you go here, there is a more flexible search engine, which you can bookmark.

    http://search.parallax.com/search?ie=&amp;q="Parallax+Forums+>+Public+Forums+>+Propeller+chip+>"+&amp;site=parallax&amp;filter=p&amp;output=xml_no_dtd&amp;client=parallax&amp;btnG=Google+Search&amp;access=p&amp;lr=&amp;ip=212.87.43.129&amp;proxystylesheet=parallax&amp;oe=&amp;proxycustom=<ADVANCED/>

    Every once in a while there is a slight lull in the forum activity. That is a good opportunity to review what has happened in the past.

    What you will find is that most of your questions have been asked before... many times by one of the forum's current experts.

    To get a handle on it all, set your browser to show 100 topics per page... then go to one of the last pages listed by the "forum page listing" . Then just work your way backwards by selecting progressively lower numbered pages.

    Reading the Forum backwards is even more fun than reading it forwards.

    Rich
  • LawsonLawson Posts: 870
    edited 2007-09-28 18:21
    As requested here are some pictures of my prototype controller and the first part it's running. The servo is used in this case to move a calibration filter into and out of an optical beam line. This is for where I work at college. lidar.ssec.wisc.edu/

    If you look at the driver circuits on the Prototype it's pretty easy to see the three revisions of my "sculptural" circuit layout.

    @Beau: In this case I'm not too worried about breaking plastic gears. Anyway the standard size servos have a really tough plastic gears. Smaller mini and micro servos can have problems with gear breakage though.
    In this case I'm more worried about fatigue with a plastic output shaft. Because of this, I am using a metal gear servo, a Futaba s3305. It's a convenient compromise of cost, power, and weight.

    Later,
    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?
  • rjo_rjo_ Posts: 1,825
    edited 2007-09-29 13:27
    Beau,

    I have modified a servo for continuous rotation for use in the "Worlds Slowest Coil Winder." What is the simplest way to add an encoder... using Parallax parts?

    Rich
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2007-09-29 18:36
    rjo_,

    How about this...
    http://www.parallax.com/detail.asp?product_id=721-00001-721-00002
    ...with this?...
    http://www.parallax.com/detail.asp?product_id=28107

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-09-29 19:04
    Rich, you could also use a little reed switch (available from hardware stores) and a small magnet. For coil winding you just need an index not really an encoder.

    Graham
  • rjo_rjo_ Posts: 1,825
    edited 2007-10-01 01:19
    Beau and Graham,

    Many thanks...
    I feel like a kid in a candy store[noparse]:)[/noparse]

    Rich
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2007-10-01 02:37
    rjo_,

    Your welcome!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-10-01 03:29
    I think it's about time we get a Prop Bot, with all these gizmos doc'ed in spin instead of BSomething or other. (two cents, freely offered)
  • LawsonLawson Posts: 870
    edited 2008-10-24 21:42
    A few more updates on my board.

    The prototype board has been running in the system for several months now. It picked up an extra function along the way. It now also times the delay from when the Q-switch on the laser triggers to when a laser pulse leaves the laser, and generates a logic signal for the data system. Short delays indicate that the laser's pulse was good, while long delays indicate that the pulse was bad. This extra function was tacked on with a daughter board that's only supported by it's connector. Not something likely to survive long when this system starts flying. So I went ahead and revised my PCB and built up two final controllers.

    Attached is a picture of the final product. A co-worker has some pictures of it in the system. I'll post those pictures when I get copies.

    I learned two things from this whole project. First, always check the hole size of component footprints from the component library. Second, I really should have used resistor and transistor packs for this thing irrespective of the massive mess it would've made of the layout.

    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?

    Post Edited (Lawson) : 10/24/2008 9:48:28 PM GMT
    1791 x 1272 - 518K
    1004 x 1339 - 202K
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2008-10-24 21:58
    Lawson,

    That's great! I'm glad to see your project coming together.

    I would love to see some video of the servo's "learning"·their position in a real application.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-10-24 22:22
    Cool idea! I love those.
    Any chance it could fry the motor driver in the servo circuit?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A wise man told me; "All electronics are made to work by magic smoke.

    Don't ever let it out as it's·very difficult·to get it back in."
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2008-10-25 02:17
    CannibalRobotics,

    I don't think so, since you are essentially lessening the current to the Servo from what it was originally designed to handle… it would be the equivalent of connecting a weak battery to the servo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • LawsonLawson Posts: 870
    edited 2008-10-28 18:58
    Beau Schwabe (Parallax) said...
    Lawson,

    That's great! I'm glad to see your project coming together.

    I would love to see some video of the servo's "learning" their position in a real application.

    Not much to see really. The LED goes full on when the servo is moving, the LED is then totally dark when the controller is confirming the position and the servo hums slightly, Then I get a response packet and the LED resumes it's usual slight glow.

    Hopefully I'll get some pictures of it installed in the Lidar with the laser lighting up the optics [noparse]:)[/noparse] In the meantime I'll post a archive of my ugly code below. This is my first project that uses assembly, and my assembly routine talks directly to the serial port cog. The integration of the extra function was painless. (all the components worked the first time just as planned!) After having my first experience in assembly on the SX I rather like Propeller assembly.

    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?
  • LawsonLawson Posts: 870
    edited 2009-01-03 00:52
    roll.gif Well I finished tracking down the first bug in my code. It was due to the lack of consistent limit checking in the code. While I was digging in the code I decided to really test how precise my position finding code was... SEVEN DAYS LATER... I've totally revamped the position finding code. It's now more than 100 times faster AND 2-3 times more precise. (this happened just today after banging my head on a wall a lot, and a "WHY the #$&! didn't I think of that sooner!?" moment) In fact it's fast enough now that the servo's position could be checked while the servo is holding a load. (just takes one servo pulse) Checking the position while the servo is moving still fails. (the motor stores too much energy...)

    For anyone who's interested I've attached my updated code. "direct_servo" in the "probe_servo_02.spin" is the function that does all the magic

    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?

    Post Edited (Lawson) : 1/3/2009 12:58:45 AM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2009-01-03 04:28
    Lawson,

    Excellent work!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
Sign In or Register to comment.