Arduino bugging out

Good day,

I have been having a problem and i cannot fogure out what it is. and its drivign me mad now.

I have build a small robot that i control via a c sharp program , i send the arduino controls via the serial port (its is currently a wire)

But the problem i am having (and its not consistent, some time sit works perfectly for an hour and then some times it buggs out every 30 seconds or so.) some time the robot just hits full power and the the software ont eh computer says the com port is lost, but it seems like all the pins on the arduino are put to HIGH, as my robot goes full power backwards, and in order for it to go backwards it has to power on the two direction pins.

So i 1st thought that the arduino was freezing or some thing, but i then made a status led on pin 13 blink every 500ms and now i checked when the robot buggs out, the led still flashes, indicating that the arduino is not frozen.

I thought another possibility was maybe the common ground wire (from the arduino to my circuitry) was coming loose. Could this be it?

I have also read about the arduino resetting if the serial connection is lost, which i though could be a possible problem, but if i manualy reset the robot, it stands still like it should. i coded all the pins to be set to LOW in the start up.

To me it defiantly seems related to the serial connection, and another thing is that, after it buggs out. i have to remove the usb cable from the computer and plug it back in before i can upload anything to the arduino from the ide or if i want to connect to the board via serial.

What other problems could this be? Please could some one help me out here, i am running out of things to try..

Post both lots of code the c# and the c/c++.

Mark

haha, i am abit embarrassed to pst the c# code. it was VERY quick and temporary, half iof it is mine and half is a friends, ( i will blmae the bad parts on him ;))

I will do so later this evening... Thanks for the reply

Is this a UNO with the newer Microcontroller USB interface??

It sounds like the USB interface is what is crashing. Maybe.

terryking228:
Is this a UNO with the newer Microcontroller USB interface??

It sounds like the USB interface is what is crashing. Maybe.

uno r3 with the big usb. also sounds like the usb is crashing to me. or the serial drivers, cause once it bugs out it always has com port problems. i have to change the comport which the arduino operates on under advanced settings in device manage…

holmes4:
Post both lots of code the c# and the c/c++.

Mark

i have attached my arduino code (robot.ino) and the c# application(app folder) and then just the c# file (Form1.cs) in the error.zip below

Please excuse the code as i have been messing around trying to get this to work. The app just takes wasd keys and then controls the bot forward back etc.

{edit}
I was playing around some more this morning… And it is weird, it doesn’t bugg out when i use it to control leds on and off. Only when i put the load of the motor on.
The motor circuit is simple though, {ardruino - 1.5k resister - npn transistor - motor} and then the direction pin { arduino - 1.5k resister - npn transistor - dptp relay - motor}
{/edit}

Thanks

error.zip (78.9 KB)