Shop OBEX P1 Docs P2 Docs Learn Events
Basic BOE Shield Robot issues with servos and power drain — Parallax Forums

Basic BOE Shield Robot issues with servos and power drain

drosenbauerdrosenbauer Posts: 4
edited 2013-03-22 17:59 in Robotics
Hello all, As you can see, I'm new to the forum and I'm also new to robotics, so please go easy on me. :) I've followed the BOEShield tutorial through to the end, meaning that I was able to get my robot working with the IR headlights. I don't own a PING))) sensor, but I have a couple of other ultrasonic sensors (HC-SR04) from another project, so I decided to use those instead. I left the IR headlights online and also installed the HR-SR04 sensor separately. The biggest difference between the two is that the SR04 has four pins (it uses different pins for triggering and reading the echo pulse) compared with the PING)))'s three pins. Here's a datasheet for the one I'm using: www.micropik.com/PDF/HCSR04.pdf

When the robot senses an object within 15 cm using the SR04 sensor, it checks the IR sensors to see which way it ought to turn. If there's an object nearby to the right, it should turn left, etc.

The issue I'm having is that changes in motion of the servos are making them stutter and jerk, rather than moving in the required direction, about 90% of the time. Once they're moving, they continue moving fine (i.e. a clockwise-moving servo will keep going until I give it another command). The stutter looks an awful lot like what they were doing before I balanced them per the tutorial's instructions, but instead of sending them a "stop" signal, they're stuttering when I send them "full counterclockwise" or what have you.

What are the plausible explanations here? Could I have a bad servo drawing too much power? Could my batteries (generic brand alkaline AAs) be too weak for the transient load on the circuit? Is there any way to test this apart from hooking up the servos to an ammeter? I'm guessing the ammeter wouldn't be able to react to the current spike quickly enough to display it, if that's the issue.

Comments

  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-03-22 12:10
    First, Welcome to the Forums. Most replies are going to start off by asking if you are using fresh batteries? Servos will pull a lot of juice when starting and maneuvering. Second, it would be a good idea to post your code (make sure to use the code brackets) so anyone that might be able to help can see if it is maybe a code issue.
  • drosenbauerdrosenbauer Posts: 4
    edited 2013-03-22 17:34
    First, the batteries aren't 100% fresh, but they've run the servos for maybe 5 minutes, max, altogether. I will give it a shot with fresh batteries. On another forum, somebody suggested that I use LiPo batteries (maybe two 3.7V cells in series) instead, as they can pump out a lot more juice. I don't have any of those available at the moment, but I will try with fresh alkaline batteries.

    Second, I pulled the HC-SR04 sensor out of the breadboard (leaving everything else wired up the way it was), and without that power draw, the servos work fine. I've had similar issues with them in the past, but in that case, I also suspected a battery issue. This confirms that it's some issue with the sensor. Now I guess the question is whether something can be done about it. I already tried putting a capacitor across the sensor power to ground, so it had a nearby source of power when it needed extra. Either the capacitors I have aren't big enough, or they discharged too slowly to be useful, or something. (The biggest I have is 470 uF.)

    I'll post the code in a separate post.
  • drosenbauerdrosenbauer Posts: 4
    edited 2013-03-22 17:53
    Code is attached. It's basically copied and pasted (with a few smaller adjustments) from the BOE Shield bot tutorial.

    ArduinoBoeBotRobot.zip
  • drosenbauerdrosenbauer Posts: 4
    edited 2013-03-22 17:59
    Found a basic code mistake that was preventing it from turning when both IR sensors sensed something. Fixed that.

    I also replaced the batteries, and now it's working 90% of the time instead of failing 90% of the time.
Sign In or Register to comment.