Arduino Uno randomly stops running programm

Hi there
I am building my first project with arduino uno, it is supposed to become an object avoiding robot using an ultrasonic sensor. We are supposed to write our code ourselves (it is a school project) so we are, step by step. Our first step was to get the motors running, and let the robot make turns. This worked when we wrote it, but now something strange happens:
When we upload the code it shows no signs of any error, and the code has to be wright because it worked before, but it doesn't. When we disconnect the robot from the computer and insert the batteries sometimes it works for a brief moment but then shows problems and stops. (This takes about a second). We have already checked our output and if all the wires are connected properly, the code has no errors, and there is no problem uploading it. We suspect one of our parts might be broken: but how can you know which one is? For control of the motors we use a motorboard, we use four motors and an arduino uno, all our parts were purchased in a package : everything is installed according to the installation guide. Multifunction bluetooth Controlled Robot Smart Car Kits For Sale - Banggood USA-arrival notice-arrival notice

First of all, making code that compiles and upload but does absolutely nothing isn't that hard...

rosaliekievits:
and the code has to be wright because it worked before

Is it exactly the same code? You're re-uploading is so I guess you made some changes...

But to trouble shout, try to upload the blink program, does it work? If so, go back to the most basic program you made to move the motor etc etc. Go step by step.

And maybe a stupid question, are the batteries full? Try NEW batteries.

How's it wired?

septillion:
are the batteries full? Try NEW batteries.

Power issues are a very common problem with robots.

I second septillion's suggestion to make sure you have good batteries.

I looks like the robot takes two Li-Ion cells. If these batteries are charged and working correctly they should provide enough power for your robot.

Another common troubleshooting technique is to add a bunch of serial statements to the code to let you know where the code has problems.

Make sure you have some way of indicating when the program has started. It's very common to have the Arduino reset when there are power issues. It would be very helpful to know if your program is resetting.

It is possible to have a partially damaged Arduino. I inadvertently put about 8 v. on a pin once, and the chip still uploaded/downloaded, and carried out all CPU functions as far as I could tell. But more than one of the I/O pins had died. You might want to try another Arduino, if available.

jrdoner:
It is possible to have a partially damaged Arduino. I inadvertently put about 8 v. on a pin once, and the chip still uploaded/downloaded, and carried out all CPU functions as far as I could tell. But more than one of the I/O pins had died. You might want to try another Arduino, if available.

Most Arduinos are pretty resilient and I think more so an "original" non clone version.

That said I just toasted a leonardo original today with a similar trick to you.
I never like the Leonardo's anyway LOL
In my case it was 12 volts directly from a fully charged marine lead acid battery.

Similar thing in that it appeared to upload but failed to send anything on the digital lines but still appeared to read an analog signal but with odd readings.

Suggest that If you have another you can beg, borrow, etc. try swap the board out.

We also tried to upload the original code, but that didn't work either. The batteries are full and we're sure that it's not about the energy because all the lights respond when we connect the robot to energy, the wheels just don't move. We've checked whether the wheels are connected correctly and we didn't discover any mistakes there either.
The program does get uploaded to the robot and the code is correct and sometimes the robot does respond for a second, so the wheels turn around for about three seconds, but then stops. Sometimes it doesn't respond at all.
It could be possible that one of the pins is damaged, but that doesn't explain why none of the wheels are moving.
We are not able to borrow another arduino board..

Can you tell if the Arduino is resetting?

DuaneDegn:
Can you tell if the Arduino is resetting?

This is the most important thing for you to determine. Do it.

Hi,

Do you have this problem if you keep the wheels off the surface so they freewheel?

Instructions

[Dropbox - Error - Simplify your life](http://"Dropbox - Error - Simplify your life Smart Car Manual.doc")

Tom.... :slight_smile: