Basic BOE Shield Robot issues with servos and power drain
drosenbauer
Posts: 4
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.
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
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.
ArduinoBoeBotRobot.zip
I also replaced the batteries, and now it's working 90% of the time instead of failing 90% of the time.