Shop OBEX P1 Docs P2 Docs Learn Events
So a QuickStart, a Servo, and a Ping))) walk in to a bar — Parallax Forums

So a QuickStart, a Servo, and a Ping))) walk in to a bar

vthyngvthyng Posts: 3
edited 2012-11-27 23:15 in Propeller 1
I solved a problem that was driving me crazy and think other beginners might benefit from my tale. I would also like any confirmation/details from the experts on why this was happening.

I connected a QuickStart P8X32A, 2 servos, and a Ping sensor for a simple little robot on wheels. All of my testing has been utilizing power from my USB connection that I was also using to program and monitor the serial output. I can get both servos to run and the ping sensor, all at the same time. However, the QuickStart ends all execution, and acts as though it was reset when I stop both servos at the same time. I setup logic to run the servos until my hand got close to the ping sensor, and then stop both of them. This reliably ended all execution. Keeping 1 servo running when stopping the other would keep the propeller executing. Running only 1 servo worked as expected. I could start and stop the servo with a wave of my hand.

I tried 2 different libraries for both servos and ping sensors and hacked them down to the bare essentials to make sure it wasn't the library I was using. Finally I tried putting the servos on their own dedicated power supply, a 9 volt battery running through a 7805 regulator (and yes I tied the grounds together with the QuickStart thank you very much). And voila, problem solved.

I think the moral of the story is always power your motors from their own supply.

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2012-11-27 23:06
    Welcome to the forum!

    No more lessons learned? "driving me crazy" sounds like you spend quite a while with this problem. So, I see several other lessons you can learn from that:
    1. Don't hesitate to ask
    2. First blame your own code & hardware setup before blaming drivers from the object exchange

    About 1.
    This is a very friendly forum and you are welcome with easy as well as with really hard to find problems! So, you should not wait too long.

    About 2.
    The drivers in the object exchange in general have a good quality. If you download a driver with a high download counter there is only a very tiny chance to find a bug in it. And even then 1. helps a lot. You can ask here if there are any known problems with the driver.

    Why this happened when stopping the servos I don't know. I'd expect more problems when doing quick moves at the same time because quick means more power needed and spec of USB only requires 500mA.
  • User NameUser Name Posts: 1,451
    edited 2012-11-27 23:15
    The first time I encountered erratic behavior in a project the employed servos, I was sure there was a bug in my code. It took a while to verify that the code was perfect and that the momentary heavy loads imposed by the diminutive servos (and the inability of the 5V regulator and capacitors to address the demand) were at the heart of the problem. Servos make terrible neighbors.

    It is worth noting that many servo drivers that drive multiple servos specifically stagger the 50 Hz pulses so that the motors aren't all trying to spin up at the same moment.
Sign In or Register to comment.