V2,3 MotorShield Not Powering 3 Of 4 Attached Devices

I am building a robot vehicle that avoids objects. Two DC motors, attached to M1 & M2, drive tank like treads for mobility. An ultrasonic sensor mounted on a seervo “looks” around for obsticals to avoid. The ultrasonic sensor takes power from the 5v pin on the motor shield while trig and echo are attached to A4 and A5 respectivly. The Servo is attached to Servo 2.

I downloaded a sketch off the Internet that has nearly all the functions I need to at least get the robot up and running in a basic way. I had to make two very small changes to the code to get it to compile, but other than that the sketch is just as I obtained it with no alterations to how it functions.

The issue is that the only thing that is functioning on the vehicle is the servo. The two motors do not run, and print statements I inserted into the code for debugging showes that readPing() calls to the ultrasonic unit always returns zero even if an object is 10 or so inches in front of it.

I am wondering if the problem might be a bad motor shield, however it does run the servo correctly. I suppose, however, that its possible for some aspects of the shield work correctly, while others do not.

Some guidence on how to procede with troubleshooting would be greatly appreciated.

The code is too long to post here with out exceeding the max characters in a post, however the code is listed in an article about how to build a robot similar to mine. Scroll about half way down the page to find where the code begins. Click here to see the article

Cheers
Bill

Quick update!

The problem with the ultrasonic sensor has been solved!!! I found a broken wire going to vcc on the sensor board. So I repaired that and now the sensor works well.

The issue with the motors not working is not so simple I fear.

Cheers Bill

I may have solved the issue with the motors not running but I am not 100% sure just yet. I have an extra motor shield but it is an older v1 board. Anyway, I swapped it with the v2.3 board I have been using. Then, I wrote a test stub that just runs the two DC motors and uploaded that code to the UNO. The motors did not run, but I could hear them humming like they wanted to run. Then I gave the tank treads a bit of a push start, and they move forward just a little when I did that and the humming stops for a moment.

All that said, I now believe the 9v battery I am using supplies insufficient power to the system.

I need to boost the power, but I don't know how much to add, or how to add it.

Can anyone help me with power management issues? I need to figure out how much power the system requires first. Then I need to figure out how to supply it using batteries. Should I connect batteries in series or in parallel?

Thanks in advance for any help!

Cheers Bill

Keep going! You are doing just fine debugging your project. For battery power, keep the voltage at what is working, just increase the current capability. you can but identical batteries in parallel, you know. Muust be the same voltage. Check with a VOM.

Paul

Paul_KD7HB: Keep going! You are doing just fine debugging your project. For battery power, keep the voltage at what is working, just increase the current capability. you can but identical batteries in parallel, you know. Muust be the same voltage. Check with a VOM.

Paul

Thanks, Paul. I have made a little more progress by putting some slack in the tank tracks. They were very taunt which caused some friction in the wheels. Now they move more freely. So now, when I have the USB cable plugged in and a 9v battery, the tracks move quite fast!

For the last couple of hours, I have actually been working on the sketch I'm using. It came from a robot project that used wheels rather than tracks for mobility. That difference is enough to cause my robot to get stuck sometimes. I thought I would save a bunch of time re-using the code I found but in the long run, I may be better off just keeping the design structure ideas and then code the whole thing myself.

Thanks again for the encouragement and advice.

Bill