Shop OBEX P1 Docs P2 Docs Learn Events
Weird servo problem — Parallax Forums

Weird servo problem

jaegjaeg Posts: 156
edited 2012-03-05 13:41 in Propeller 1
I'm not sure if this is a problem with the Prop or the servo but here goes. I'm working with a Lynxmotion Brat and in the past I've controlled it with an Arduino no problem but at first I tried a GadgetGangster with a servo module and for some strange reason one of the servos has difficulty locking into a position. This is hard to describe but but if you tap on the limb in one direction the servo pans all the way to one side then tries to move back to it's original position. A lot of the times it fails to do this and pans all the way back again and tries again. However it doesn't do this if you tap the other direction on the limb. I've tried swapping which pin it is on be it doesn't seem to matter.


Any ideas?

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-05 06:37
    90% if not more, of the servo problems I've seen are caused by power supply / battery issues.

    You might want to take a look at this thread for some ideas.

    It might also help if you output an increasing number to a terminal window so you can see if the Prop is resetting or not.

    Your discription "A lot of the times it fails to do this and pans all the way back again and tries again" makes me think the Prop is resetting.
  • jaegjaeg Posts: 156
    edited 2012-03-05 10:36
    I just confirmed it's not resetting. I experimented with another servo header on the board where I don't have resistors and buffer caps on each pin and the servo worked correctly not only that but I realized that none of the servos are at their right positions either until I try them on those pins. Are resistors on the signal line of a servo necessary then?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-05 10:47
    So are you saying the servo worked with IO pins that didn't have a resistor but not on the IO pins (on the same board) with IO pins having resistors?

    I have had servos work with the Prop without series resistors that wouldn't work with series resistors. This might be the case with your servos.

    Servos would normally receive a signal line that pulses 5V. The Prop IO pins only output 3.3V. I think for some servos, an added resistor is enough to keep the servo from "seeing" the 3.3V signal.

    I often see advice (from people who know a lot more about this stuff than me) to use series resistors on the signal line. I personally have found series resistors can cause problems and I don't use them when I use a servo with a Propeller.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-03-05 10:48
    Resisters in series with the servo signal line are not necessary, but they often can help. The input signal line to the servo should be a pure input that treats any voltage on the order of 1.5V or more as a 1 and less than that as a 0. The Propeller will put out close to 3.0V for a 1 and around 0.3V for a 0, so that should be fine. Try a 1K resistor in series with the servo signal line. If there's some noise coupling between the signal line and the power lines or somehow internal to the servo, the 1K resistor will help damp that.
  • jaegjaeg Posts: 156
    edited 2012-03-05 10:51
    It would make sense with these servos then. They are Hitec 422 servos sold by Lynxmotion and have an operation voltage of 4.8 to 6. Also would explain why my micro servos work on it and not the bigger ones too...
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-05 10:55
    jaeg wrote: »
    It would make sense with these servos then. They are Hitec 422 servos sold by Lynxmotion and have an operation voltage of 4.8 to 6. Also would explain why my micro servos work on it and not the bigger ones too...

    Please don't assume your servos don't work with the Prop. I bet a dead Propeller chip they will.

    Please discribe what you are using to power the Propeller and servos. If possible use a separate power supply for the servos than the Prop. Make sure the grounds of the two power supplies share a common ground.

    I still think your problem falls within the 90%.

    I've had many "wall-wart" power supplies not work with servos controlled by a Prop. This has happened to me several times when I was sure the power supply wasn't the problem while people on the forum kept saying it was. It turned out they were right.

    A good battery pack can often be a better power supply than a transformer. A 9V battery is not a good battery pack. You want AA or larger cells of freshly charged NiMH batteries or something similar.

    Also make sure you are only testing one of your larger servos at a time (at least until you get the one working). Two servos will increase the chance of power supply trouble.

    Edit: Here are a few of my Propeller servo projects. 32 servos driven by QuickStart. Popsicle Stick Hexapod. QuickStart Servo Tester.
  • jaegjaeg Posts: 156
    edited 2012-03-05 11:42
    I wasn't assuming they wouldn't work I was assuming the resistors in series with the signal line was the problem and so far it's proving right. I went through and removed the resistors and replaced them with pieces of wire and now the servos are working wonderfully.

    My power supply is 5 recharable 2500mAh NiMh cells. They worked with the Arduino and the Propeller wasn't resetting. However I don't think it's getting the run time like it was with the Arduino which is strange. It could run the Arduino till it reset itself but with the Prop it seems the servos stop before the micro resets. I'm guessing it's because of the Props lower operating voltage? And what would cause the increase power drain? There are built in USB and SD card ports could the be contributing?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-05 12:11
    There are really only two reasons to place a resistor in series, to attenuate the electrical noise.

    Since not all servos are created equal... some can leak a lot of electrical noise from the motor back through the signal line. That would be one reason. Another reason would be for long runs (greater than a foot) from the micro controller. Long electrical runs can act like an antenna to the micro controller I/O pin and inject unwanted electrical noise.

    If your servos are electrically 'quiet' and are located a short distance from the micro controller then a resistor isn't necessary.

    Note: Another attenuation option is to use the resistor to Ground instead of in series with the Servo signal line.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-05 12:32
    jaeg wrote: »
    I wasn't assuming they wouldn't work I was assuming the resistors in series with the signal line was the problem and so far it's proving right.

    Very good. I was afraid you thought the Prop could only control the small servos.

    It also sounds like you've got the battery issure covered. I've just seen too many servo problems caused by trying to use a 9V battery to power the whole system (not that I wouldn't have tried it when I was new to this stuff).

    As you can see from my list of projects, I've been on a bit of a servo craze lately. They're a lot of fun and a great match for the Prop's parallel processing abilties (I don't know of many other uCs that can run 32 servos without some sort of external controller or ICs).
  • jaegjaeg Posts: 156
    edited 2012-03-05 12:40
    Any idea why I would be getting less run time with the Prop compared to the Arduino? The only difference in the setups are the two regulators, usb, and sd port on the Prop board.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-05 12:59
    jaeg wrote: »
    Any idea why I would be getting less run time with the Prop compared to the Arduino? The only difference in the setups are the two regulators, usb, and sd port on the Prop board.

    Short answer is no.

    But I do have some guesses. Analog servos only power their motors when refreshed. So if the Prop is refreshing the servos at the normal 50Hz it will use more power than a uC that refreshes the servos less frequently. Other uCs often have a lower refresh rate than 50Hz because they can only refresh the servo with each loop of the program. The main loop in a program can easily take longer than 20ms causing the delay in refresh pulse.

    If you're using digital servos, then I'm clueless as to why there is a run time difference.
  • jaegjaeg Posts: 156
    edited 2012-03-05 13:41
    Ok that makes sense. I'm looking at the servo driver right now to see if I can change anything to potentially lower the refresh rate. I tried messing with the Prop's frequency and that turned out to be a bad idea.

    This isn't me being anal or anything. I use to get 25 minutes run time and right now I'm getting 6.

    I changed the zone timing in the servo driver and drastically improved my running time. Thanks for everyone's help! :)
Sign In or Register to comment.