PDA

View Full Version : Servo Alzheimer's



vocalico
11-15-2006, 05:20 AM
Help, my servo has alzheimer's! I have a very simple project with a continuous rotation servo and four LEDs which blink on and off while the servo turns. After a period of a few weeks I went to activate my piece and DRAT--the servo would not turn and yet the LEDs were still working. After re-uploading my program everything worked fine . . . until a few weeks ago when the servo "forgot" the program again and would not turn.

Any idea why the servo would "forget" the program? I am running a BS2 on a Super Carrier Board with a 9V wall adapter.

Thanks!

allanlane5
11-15-2006, 06:00 AM
The 'servo' has no memory, it only does what the BS2 tells it to do.

You're not running "Vin" to the Servo by any chance, are you? You did move the jumper to "Vdd", right? Because 9 volts will kill a servo's electronics. Especially the 11 unregulated volts of a non-regulated 9-volt wall-wart.

Fixing by re-uploading your program to the BS2 should not be necessary, and shouldn't do anything -- it's kind of difficult to 'erase' the program in a BS2 -- unless, that is, your program is using the eeprom of the BS2 for some purpose. The BS2 actually will allow 'self-modifying code' -- but the results are usually not functional.

Chris Savage
11-15-2006, 06:42 AM
Hello,
·
··· What happens if you simply press the RESET button or switch the power off then on instead of re-downloading the program?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

vocalico
11-15-2006, 06:54 AM
The 'servo' is connected to P15,Vss,Vdd. I'm not using the BOE and unless I'm wrong, there is no corresponding jumper switch on the Super Carrier Board. Re-downloading the program seems to be the only way to restore 'servo' motion. When I press the RESET switch or power off/on the 'servo' jumps briefly and then won't move. OR sometimes the servo lets out a loud "BUZZ" sound and won't move at all until I repress the RESET button.

Chris Savage
11-15-2006, 07:25 AM
Hello,
·
··· Can you post the code?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

vocalico
11-15-2006, 07:55 AM
Here's the code. Ideally the 'servo' should be continuously rotating at a very slow speed.

Chris Savage
11-15-2006, 08:19 AM
Okay,
·
·· That’s what I suspected…You are over-driving the servo.· The servo wants to see a pulse every 20 – 50 mS, but you are sending it as fast as possible.· I don’t know why it works at all.· This should make the servo twitch erratically all the time.· I would recommend putting a PAUSE 20 in all loops.· In fact, you can simplify the code greatly since you’re doing some things in the loop that don’t need to happen more than once.· For example, in your loop you’re making a pin high or low all through the loop, but that only needs to happen before entering that loop.· It would be easier to set the pins in a pattern and call a subroutine to handle the servo refresh.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

vocalico
11-15-2006, 08:40 AM
Awesome, thanks! The servo is running smooth like butter--and no more BUZZ. I thought I needed to eliminate the PAUSE for smooth rotation.

I'm not sure I completely understand how to create the subroutine for the refresh as you recommended. Can you provide more info or direct me to a place where I can learn more?

Chris Savage
11-15-2006, 11:34 AM
Hello,
·
·· I would recommend reading our “What’s A Microcontroller?” manual.· This tutorial can be downloaded in PDF format free from our website.· It might help you out with some of this.· Take care.

http://www.parallax.com/detail.asp?product_id=28152


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

allanlane5
11-15-2006, 11:40 PM
Something like:

Main:
'
'
'
GOSUB ServoRefresh
'
'
GOTO MAIN:

ServoRefresh:
PULSOUT Servo, ServoPulseTime
PAUSE 20
RETURN

vocalico
01-20-2007, 03:26 AM
Hello,

Help--my problem has returned! I thought I had resolved the issue of servo malfunction by adding the 20 mS PAUSE to prevent over-driving. However, I just plugged in my project and found that once again the servo is no longer rotating. The LEDs work in sequence fine, but no servo motion.

I determined that by going back and changing the PULSOUT from 759 to 758 I was able to get the servo functioning again at the desired·SLOW continuous rotation speed. My question is why would this happen when the initial·PULSOUT 15, 759 worked perfectly? What would cause the change? Is there some way in which the 9V wall-wart is to blame? Would a separate power supply for the servo prevent this problem from reoccurring or have I made an error either in the code or the wiring?

I am attaching the code and a pic of the board configuration.

Any help is greatly appreciated . . . thanks.

allanlane5
01-20-2007, 03:52 AM
AHA! I'm theorizing that your adjustable resistor inside the servo is either aging, rusting, or moving slightly due to vibration. That "758" or "759" value means you're controlling your servo VERY close to the middle "don't move" value. The actual value is set with a variable resistor inside the servo itself.

When your servo was "modified" so it would rotate continuously, this variable resistor was disconnected from the rotating gears, and set to its mid-point. Now, you want to rotate "very slowly", so you have to select a value close to that midpoint. But if you're TOO close to the midpoint, the servo won't move at all. A related issue is the servo does have some "hysteresis" built into it so it won't over-shoot when moving. That means when moving very slowly, it doesn't use a lot of torque.

I'm assuming when you 'reload' the BS2, you're taking something apart to get to it? This might "free up" the movement enough that the low-torque you're getting from the servo is enough. BUT, if you leave the thing stationary for a week, that low torque is now not enough.

So try 758 or even 757 to give yourself some lee-way.

Edit: It's also possible that when you first turn on your project after a week that the servo requires some additional torque to turn it the first few times.· If you're on the hairy edge of the current your·wall-wart can supply, this might brown-out the BS2.· At least until the movement warms up a bit.

I'd recommend a slight bit of lithium grease on the moving parts -- whatever it is you're moving with the servo -- might help.

Post Edited (allanlane5) : 1/19/2007 7:56:56 PM GMT

vocalico
01-20-2007, 04:30 AM
Makes sense--though it's disappointing the servo cannot reliably rotate at a slower speed than "758" in my case.

Anyone have a suggestion of how else to achieve slow and consistent rotation (close to 1 rpm) other than a servo?

allanlane5
01-20-2007, 05:26 AM
Sure -- a servo with reduction gearing. Might be a little noisy, though.

You don't need this thing to go backwards, right? So you could simply use an electric motor with enough torque, a transistor to provide the current, and again put in place some reduction gearing to get the speed you want. On the good side, as speed slows down through gearing the torque goes up.

Edit:· There is a website that has instructions on widening the hysteresis loop to give you much better low speed torque and control:

http://www.seattlerobotics.org/encoder/200009/S3003C.html

I don't know if this applies to your servo, but it's a possibility.

Ah -- and here's a software solution.· Instead of always sending the '758 value, alternate with a '750 value.· Thus you'll be sending a "MOVE -- WAIT -- MOVE -- WAIT" sequence, instead of a "MOVE -- MOVE -- MOVE -- MOVE" sequence.· That could slow down the rotation.

Post Edited (allanlane5) : 1/19/2007 9:46:02 PM GMT