Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

  1. Talking Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Yes we like servo mods!



    As promished this is the third servo hack. This builts upon the second hack - 'add 10-bit abolute/incremental feedback encoder to
    your hobby servo' . Source code is open and links provided at the end of the post. Eagle schematics are also provided.
    In terms of the board files... well dont be lazy! After all all three boards are two-sided and fairly easy to design once you have a look at the schematics. Here I explain more or less how you would make it yourself, the components needed, some well-thought tips and how to install it inside your servo.

    So lets make a start, shall we?

    To do this you need 3 basic components:

    1. Magnetic encoder IC and a circumferential field distribution magnet. The AS5040 gives you 10-bit resolution, the AS5145 12-bit resolution (4096 positions / 360 degrees) and an SPI interface which always comes handy. The two ICs are pin-to-pin compatible. Get these directly from Austrian Microsystems - ask for a sample, they normally ship the next day.
    2. An ATMega 328P (MFL package) an on-board regulator and a 20MHz crystal (to get the control loop closing at 1KHz)
    3. A Freescale motor driver IC (MC33887) which can deliver up to 5 Amps continuous. If you need something smaller try the MCP17511 (1 Amp cont.)

    Each of these should go into a separate board and all three should stack together using low profile pin headers/sockets. The target board outline is 15.5x15.5mm - a good design exercise This will make it fit inside any standard size servo. If you cannot get it that small try the 1/4 scale instead. The target board outline for this is 25x32mm with plenty of height space.

    When designing the magnetic encoder board bear in mind that the centre of the servo's output shaft for standard servos should be located 10mm from servo casing (15mm for 1/4-scale servos). The magnetic encoder ICs have an allignment tolerance of +/- 0.5 mm so they are pretty forgiving in terms of misallignment.

    The ATMega328P board should stack directly under the magnetic encoder. It is the same processor Arduino uses. Remember to keep the programming pins near the board edge for easy access. The pins needed to get feedback from the encoder and control the motor driver should come out on the sides of the board such that all three boards can be stacked together. The remaining pins should be exposed using pads so you can solder wires and use them if your application needs them. You should have 4 digital IOs and 4 analog inputs available for other stuff. Basically you get full Arduino functionality but 4MHz faster clock and half the footprint of Arduino nano )

    The motor driver board should be on the bottom of the board assembly. Keep the bottom layer free of components with a large copper plane and use thermal vias to direct heat away from the board. Keep it free of components so you can add heatsinking if so
    required. Normally you should ok without, but if you go for high-performance coreless servos heatsinking becomes a must.





    When everything is ready (.....) you can install the boards inside your servo. To do that first you have to connect the magnet to the servo's output shaft. I will repeat the necessary part of the procedure of my previous post just to avoid any confusion.

    - Start by accessing the servo’s bottom compartment and by removing the control / power electronics from the servo. Unsolder the motor’s leads and proceed by removing the feedback potentiometer.

    - If continuous rotation is required, access the servo’s top compartment where the gearbox is located and remove the mechanical stop from the output gear. Take extra care not to damage the gear’s teeth as well as, keeping any foreign particles from entering the gearbox assembly. Particles residing on any of the gears’ teeth will cause undesirable noise during operation and may also affect the performance of your servo.





    - Next disassemble the potentiometer keeping the rotation shaft. Remove the potentiometer slider from the shaft. What remains is going to be used as a support shaft for the encoder’s disk magnet. The magnet is going to be glued onto it.

    - Carefully flatten the potentiometer’s base using sandpaper or an abrasive disk.

    - Roughen the side of the disk magnet to be glued onto the potentiometer’s shaft by using sandpaper. This step is essential and will ensure a strong assembly.

    - Take a small piece of wood, 10mm thick and drill a blind 3.5mm diameter hole approximately 5mm deep. This is going to hold the
    potentiometer’s shaft and the disk magnet vertically while the epoxy settles.

    - Prepare a small epoxy mix, insert the pot’s shaft to the hole and place the disk magnet on the pot’s shaft with a small drop of epoxy between them. Remove any excess epoxy. Ideally you should aim to leave a small ring of epoxy around the circumference of your magnet for lateral support. Remember that your servo has an output speed of about 60 rpm but the system that the servo is going to be installed will most likely be subjected to other sources of vibration. Accurately centre the magnet on the shaft and leave to settle for at least 6 hours (for a 5min epoxy). We know you cannot wait to start using the Supermodified™ on your project but you must show patience if you do not want to repeat this step in the near future.

    - Insert the pot’s shaft back into the servo’s output gear. Make sure the flatten area of the shaft goes fully into the corresponding ‘pocket’ of the servo’s output gear like it did before the modification.





    Next you need to flash the Atmel. Check Google Code page(s) below for the source code and programming guide for AVRStudio, MS Visual Studio Xpress and Eclipse. The AVR library page is a must. Currently supporting only ATMega MCUs but soon to be expanded.

    http://code.google.com/p/zoavrlib/

    http://code.google.com/p/zosupermodified/

    Following the procedure above you need to make a hard decision: I2C, RS232 or RS485?? With I2C and RS485 you can daisy chain many controllers together. Solder the appropriate cables in place together with the motor-leads' cables and the power-cables.

    At this point you should be able to drop the boards assembly inside, locate it in place using heat-glue or thermal foam and start playing )

    Schematics (Eagle & pdf):

    http://www.01mech.com/supermodified scroll down the page & right click > Save as...

    I am still waiting on my boards to arrive. Will update the post accordingly then.
    Last edited by Antonb; 04-01-2010 at 10:28 AM.

  2. #2
    zoomkat Guest

    Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Just as a readibility suggestion, you might go back and put a carrage return between each photo such that they are aligned vertically instead of horozontally. On my laptop having the pix horozontally aligned makes me have to endlessly scroll back and forth to try to read the text (or copy and paste in note pad). Looks like an interesting article so far.

  3. #3
    Join Date
    May 2008
    Location
    TN
    Posts
    853
    Images
    99
    Rep Power
    71

    Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Nice! I do have a question though. What is the advantage of this over an off the shelf networked servo such as the AX-12. By the time you take a decent servo like the 645 and do this then the 645 may very well be more expensive than the AX-12.
    "If A is a success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut."
    -
    Einstein

    Don't be a HelpVampire

  4. Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Quote Originally Posted by jes1510 View Post
    Nice! I do have a question though. What is the advantage of this over an off the shelf networked servo such as the AX-12. By the time you take a decent servo like the 645 and do this then the 645 may very well be more expensive than the AX-12.
    That must be the the perfect question
    The AX-12 is a very capable servo. However there are some things it could do better like:
    -Its motion resolution is four times less (0.35 degrees for the AX-12 against 0.087 degrees for the controller above).
    -It does not support continuous rotation. Its range is limited to 300 degrees. the controller above is made for continuous rotation
    -It does not support I2C comms.
    -The controller above has 4 analog and 4 digital IOs available for other stuff and is also re-programmable (and totally Arduino compatible)
    -The current delivery capability of the controller above exceeds 5Amps (with proper heatsinking) and therefore could easily be used to drive even medium size DC motors replacing ridiculously expensive DC motor controllers.
    -The AX-12 does not support motion profiling which, the contoller above (it is called Supermodified) does.
    -You can adjust the PID parameters on the Supermodified.
    -The Supermodified comes with really nice support libraries for one of the most popular MCUs ever the ATMega328P for which there is a ton of stuff around from the community.

    I guess the controller above might end up being a little bit more expensive in that instance but it offers so much more. Whats more is that if you start looking at higher torque servos like the HS 805BB, and fitting one of those controllers in there then, given all these capabilities that you get it actually becomes a bargain
    Last edited by Antonb; 04-02-2010 at 06:12 AM.

  5. #5

    Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Nice work Antonb...

    Clarifications:
    The AX-12 has a 0.29 degree step size and the it does support continuous rotation mode.

    Do you feel that I2C is a better communication protocol than the AX-12's 1/2 duplex serial? I've been look at open servo and they use I2C too. It seems to me that the asynchronous nature of the AX-12 bus would be a more efficient protocol. Your thoughts?

    Again nice work.

  6. Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Quote Originally Posted by MikeG View Post
    Nice work Antonb...

    Clarifications:
    The AX-12 has a 0.29 degree step size and the it does support continuous rotation mode.

    Do you feel that I2C is a better communication protocol than the AX-12's 1/2 duplex serial? I've been look at open servo and they use I2C too. It seems to me that the asynchronous nature of the AX-12 bus would be a more efficient protocol. Your thoughts?

    Again nice work.
    You are absolutely right. I2C comes handy though for a microcontroller that does not support UART comms, or if one wants to avoid an RS 485 transceiver and still have the ability to control many devices with a single bus. Its nice to have the option..

  7. #7
    Join Date
    Feb 2010
    Location
    Silicon Valley, CA
    Posts
    321
    Images
    1
    Rep Power
    39

    Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    > Whats more is that if you start looking at higher torque servos like the HS 805BB,
    > and fitting one of those controllers in there then, given all these capabilities that you
    > get it actually becomes a bargain

    I think this is the biggest attraction in making your own servo.
    Yes, AX-12 are very reasonably priced for what they do (robotis probably doesn't make much money on it),
    but once you want more torque, you are immediately paying at least 4 times more if you want Dynamixel,
    which is a lot of money for us hobbyists.

    Anton, what other motors have you actually _used_ Supermodified with?

  8. #8
    Join Date
    Aug 2008
    Location
    Iowa City, IA
    Posts
    390
    Rep Power
    44

    Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Antonb. Do you happen to know what sort of numbers the 805bb get with your driver?

  9. Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Quote Originally Posted by RobotNV View Post
    > Whats more is that if you start looking at higher torque servos like the HS 805BB,
    > and fitting one of those controllers in there then, given all these capabilities that you
    > get it actually becomes a bargain

    I think this is the biggest attraction in making your own servo.
    Yes, AX-12 are very reasonably priced for what they do (robotis probably doesn't make much money on it),
    but once you want more torque, you are immediately paying at least 4 times more if you want Dynamixel,
    which is a lot of money for us hobbyists.

    Anton, what other motors have you actually _used_ Supermodified with?
    Thats exactly my point. The bigger Dynamixel models are very nice but totally expensive. Furthermore they might support continuous rotation but from my understanding - after reading a bit on the datasheets - they have an 'Operating range' of 280 to 300 degrees. This means Dynamixel servos have a dead-band of 60 to 80 degrees, coming most likely from the feedback potentiometer they use - not particularly good for robotics applications requiring uniform, continuous actuator control capability over the full 360.

    I have now used the controller with many standard servos and also the Hitec 1/4 scale HS805 BB. The driver could be used to control any dc servo requiring up to 5 Amps continuous (7.8 Amps bursts). The magnetic encoder could be attached separately

  10. Re: Hack servo v3.00 - Get full PID position and speed control from your hobby servo

    Quote Originally Posted by billyzelsnack View Post
    Antonb. Do you happen to know what sort of numbers the 805bb get with your driver?
    Im not sure if I understand what you mean. The HS-805BB is a large-scale servo from hitec which is fairly cheap and gives you up to 26kg.cm of torque. It has flanges to protect it against spraying water (not immersion) and a dual ball bearings. One Supermodified controller could drive two (maybe even three) of those simultaneously
    Last edited by Antonb; 04-03-2010 at 05:02 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Kondo web page translated.
    By Droid Works in forum Humanoids, Walkers & Crawlers
    Replies: 4
    Last Post: 10-06-2007, 05:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •