Junk bot power issue

I bought my son a junkbot for his Christmas http://robotbits.co.uk/robot-kits/junkbot-kit/prod_97.html Which he successfully built after we got a faulty I/O shield replaced. It runs fine with the test software and we can make small changes successfully. However when we make the programme more than a couple of lines longer it stops obeying the programme. It runs through the first few manoeuvres then appears to restart the program from the beginning. For a long time I've assumed this was a software issue (a bit embarrassing as I'm a software engineer) and I periodically take another look. However recently I accidentally connected it through the USB port while the batteries were still in it. Suddenly it ran beautifully, I could see the wheels obeying all the commands whenever I held my hand in front of the sensor. I put it on the floor and chased it round the room with the laptop and it still works great. Obviously I've done some more tests now, replaced the batteries with new ones etc. and the outcome is. Battery only: it does not complete the command sequence, but resets to the start USB only: as above. Battery+USB connected:It does exactly as designed.

I'm not sure which forum area this belongs in, but please can someone help.

Your problem is definitively power.How many servos are you running?When you use batteries (I belive you are using 9V bateries from the link) those 9V are converted to 5V in the onboard regulator and that diference (9-5= 4V) is converted in heat.Depending on the current demand it could heat to much or not. Since you are telling it wont run using bateries my gess is your servos are demanding to much current and the bateries are not enough to maintain the current needed.microcontroller then enter in Brown-out reset and restart. Try to use a better external power source like a DC transformer 9-12V with at least 2A. From my experience get a 9V if you could.Using a 12V still works but the onboard regulator will heat a little more

Hi HugoPT thanks for your comments. There are 2 servos connected and one infra-red sensor. The servos are SM-S4303R, I've not found any data as to how much current they draw. Did I understand that your suggesting I hook it up to the mains-power, through an adapter? If so, is this just as a test?

I agree that it is a power issue. If you are using non-rechargeable AA batteries, you might try 2500 mAh NiMH AA batteries instead. They are capable of supplying much more current and since the overall voltage is lower, less power would be wasted as heat in the on-board regulator (if that is indeed a problem).

Found these specs for those servos at "tinyosshop.com"(?)

Specification

Working Voltage: 4.8-7.2V Working current: 0.1-1.2 A Torque: 3.3kg-cm @ 4.8V ; 5.1kg-cm @6V ; Average speed: 54 rpm/6V Rotation range: 0- 360 Working Temperature: 0?~55? Size: 40.2mx 20.2 x 43.2mm Weight: 41g

But iteadstudio has the same one rated at 100mA. And USB port shouldn't allow more than 500mA anyway. Either way, 200+ mA is quite a bit of current.

Is your updated code driving the servos 'faster' than default code?

I can't quite see (from photos) how the motor driver board is getting it's power. Is it pulling from "Vin" pin? Or 5V pin?

Another way to go might be to get one of those rechargeable USB batteries and just plug it into Arduino USB port. That's how I drive most of my projects. And, they're available in many different mAh ratings.

Another thought I had....which may indeed be overkill & might still not solve the issue —

Looks like there are terminal blocks on motor board though....for external power? Perhaps try a separate power source for the motor board (making sure grounds are connected, of course!)? Or...upgrade the motor driver/shield? It should be a drop-in-replacement type of situation & maybe changing a few pins in your code.

Adafruit has one that is very capable. http://www.adafruit.com/products/1438

I guess they've sold some of these already, should be a proven product. Maybe there is an issue with the configuration of the "Mini I-O" card. Any info on that?

Seems to be an obvious design "gotcha". Sounds very much as if the device is supplied with the minimal software which they know works!

You should definitely not be running servos from a regulator. Run them directly from the correct battery pack, generally six volts, minimal four alkaline AAs or four NiMH.