Shop OBEX P1 Docs P2 Docs Learn Events
LoboServo: More complicated than I thought... — Parallax Forums

LoboServo: More complicated than I thought...

RaymanRayman Posts: 14,327
edited 2012-02-04 12:31 in Robotics
So, I've had the idea for a while of ripping out the electronics inside a servo and controlling the motor directly with the Propeller.

Just tested it out in place of continuous rotation servos for a robot.
I'm using a motor controller that needs 2 Propeller I/O pins.
So, I need 2 pins instead of 1 like a continous rotation servo.
But, I have direct control over the motor.

LoboServo then has these benefits:
Idle is perfectly still. My BoeBot needs constant pot tweaking (or code adjusting) to hold perfectly still.
Idle is perfectly quiet. Maybe it's the same thing, but it uses absolutely no power when idle.
Engine braking. If you want you can use engine braking to keep the wheels from turning without using any power.
Free wheeling. If you want you can have the wheels freely rotate.
Easier modifying. It's not too hard to modify a servo for continous rotation, but this is even easier.

Complication:
Well, it turns out that the start-up current of these motors is a lot more than I anticipated...
One motor isn't too bad, but when you turn on two motors to full power from a stop, there is a severe current surge.
It even pulls down the voltage from a 4-AA battery pack enough to make my Propeller reset.
Worst case is going from full forward to full reverse.
Only way to keep the Prop from resetting is to add in a 500uF or bigger capacitor.
Well, maybe that's not too bad because I see that recommended for driving a lot of regular servos anyway.
Still, it's something I thought I wouldn't have to do because I have the motor controller powered right off the battery pack.

Possible Solutions:
I started looking into why I didn't need a big capacitor when driving two continuous rotation servos off the same board.
It appears that there is more magic in Beau's servo32 driver than I thought.
It seems he gradually moves from one setting to another and doesn't make sudden changes.
Also, I imagine that the servo also has something to respond to changes slowly and not all at once.
Anyway, it seems I'd need a much more complex driver code than I originally thought.
Or, I can bite the bullet and add in the big capacitor.
Probably should do both. Make a more complex driver that changes motor speed more slowly and add in a big capacitor...

Comments

  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-02-03 17:20
    Rayman wrote: »
    Idle is perfectly still. My BoeBot needs constant pot tweaking (or code adjusting) to hold perfectly still.
    Idle is perfectly quiet. Maybe it's the same thing, but it uses absolutely no power when idle.

    Just as a note, you also get this by stopping the pulses to a servo. No pulse, no power. (Applies to analog servos, but I don't think you're talking about gutting an expensive digital servo.)
    It even pulls down the voltage from a 4-AA battery pack enough to make my Propeller reset.
    ...
    Still, it's something I thought I wouldn't have to do because I have the motor controller powered right off the battery pack.

    If you have your Prop off a separate battery then the problem is noise, and a big cap will still absorb the spike. In any case, when you removed the guts from the servo you also took out the cap it uses for protecting against this very thing. In some analog servos, they use a polarized cap right across V+ and ground. That's why things go BOOM when you flip the polarity.
    Also, I imagine that the servo also has something to respond to changes slowly and not all at once.

    The PID algorithm on the original servo board has a ramping profile. Starts out slow, speeds up, goes slow again. It especially never goes immediately one direction then the other at full speed. You can replicate it in code.
    Or, I can bite the bullet and add in the big capacitor.
    Probably should do both. Make a more complex driver that changes motor speed more slowly and add in a big capacitor...

    Yes, both. Your motor controller board really should have these caps on it already. A 0.1uF and something larger, at least 220uF. I'd opt for 16V or better.

    -- Gordon
  • RaymanRayman Posts: 14,327
    edited 2012-02-04 05:30
    Gordon, thanks for the feedback. You didn't say this is a horrible idea, so that's good...

    I did gut some all-metal digital servos. They were only $6 each though. The all metal makes for a great drive train.
    There were complaints about electronics inside these servos, so I didn't feel all that bad about doing it.
    Not giving pulses to a regular servo to make it stop seems like a good idea...

    It's definitely not a spike and I have the Propeller well isolated. The problem is just that the battery voltage is pulled down too long.
    I didn't have this trouble driving the motors of the Magician chassis, so it caught me off guard...

    I think it's the big gear ratio that makes it draw more current...

    Yes, I think I'll have to add a capacitor and modify the code to make changes more slowly...

    Here's the photo of how it's wired. It only takes about 5 minutes to modify the servo this way:
    LoboServo.jpg


    Since I'm using these as drive motors for a robot, I think I've just figured out that I should have
    gotten servos with lower torque and higher speed. But, these ones aren't too bad...
    1024 x 768 - 64K
  • ercoerco Posts: 20,256
    edited 2012-02-04 09:13
    You are using a motor controller? Which one? Show us that, please.
  • RaymanRayman Posts: 14,327
    edited 2012-02-04 10:07
    It's a TB6552 chip driver on a PCB called Merlin that plugs into Quickstart:
    http://www.rayslogic.com/Propeller/Products/Merlin/Merlin.htm
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-02-04 10:51
    RE-260 motors of the type used in the servo vary greatly in quality, from okay to Smile. If these were $6 servos I'd suspect the latter. It's quite possible at startup the motor is drawing several amps. If you're using alkalines, especially, there can be a big enough sag to drop below the tolerance for the QuickStart. LiPoly's probably wouldn't exhibit this problem. Putting a large cap across the battery terminals would be quick and easy fix.

    I prefer to avoid this scenario altogether in the first place, and simply add a separate 9V battery for the controller. Connect the grounds, and you're good to go. This method is a bit more bulky, but it's very handy for designs you intend to be reproduced. It eliminates a major source of issues for users.

    Though it's hard to tell, there appears to be a very large cap (of some sort) on the board you removed from the servo, but I see no electrolytics on the Merlin. You also mention isolation for the Prop, but I couldn't see how that's done. If the motor and Prop share the same power source, any noise from those motors -- which can be copious at startup and when reversed (the EMF, oh the horrors!) -- will have an big impact if the voltage is near cutout. Most texts suggest soldering a small 0.1 cap directly across the terminals of the motor. And if that's not enough, from each terminal and the metal case of the motor. These motors may need it, whereas the ones with the Magician chassis did not.

    -- Gordon
  • RaymanRayman Posts: 14,327
    edited 2012-02-04 12:15
    A seperate power source would solve this issue. For example, when connected to USB power, it doesn't happen.
    The Prop is protected because there's a diode between the battery and the Quickstart's regulator.
    There is a 10uF cap there, but it's not enough.
    If I turn on all the blue LEDs, I can see them dim when the motors change direction...
    Merlin has several tantalum caps on the board. There is a place to install a large electolytic for the servos,
    but I didn't put a place in for one across the battery, because I didn't think I'd need it.
    The servos are hexTronik HX12K.
    There are 0.1uF capacitors with 10 Ohm resistors directly across both motor outputs.
  • LeonLeon Posts: 7,620
    edited 2012-02-04 12:20
    I was involved with a similar project about 25 years ago. We were using a Zilog Z8 controller, with a sort of H-bridge driving the motor and an ADC to get the position from the pot.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-02-04 12:26
    Rayman wrote: »
    There were complaints about electronics inside these servos,

    Rayman,

    Which servos are these? They look like they could be HobbyKing's HX12K.

    I have a bunch of HX12Ks myself (you can see 16 of them moving together in my 32 servo demo).

    I was just fiddling with one I've modified to CR. I thought it behaved pretty well. I can get a nice slow rotation with a 1514us pulse that has pretty good torque. The speed seems to max out at 1640us (in the cw direction), again with pretty good torque.

    Have you compared one of your LoboServos with one modified to CR the conventional way?

    Also, in case you missed it, I have code that lets you use a QuickStart board as a servo tester. I find it really useful to receive feedback of the pulse length in a terminal window when experimenting with servos.

    I plan to use six of these CR servos in one of my robots, I'd really like to know if the way you are modifying the servos gives better results than the usual way these are modified to CR.

    Edit: I missed your last post Rayman. I see you are using HX12K servos.
  • RaymanRayman Posts: 14,327
    edited 2012-02-04 12:31
    Duane, yes it is HX12K from HobbyKing. They are very easy to modify for CR (just pull out a little metal shaft and remove the POT).
    I haven't actually done it the regular way yet, but I'm sure it will be fine.
    I think the way I'm doing it can be superior, but it's going to take more code than I anticipated. I didn't realize the servo driver code had soft start and stop included...
    So, I think the regular way is about 1000 times simpler at this point because the code already exists...

    Leon, these servos are actually controlled by a little PIC microcontroller. I've played around with reprogramming that PIC, but that's a different project...
Sign In or Register to comment.