Go Down

Topic: Arduino UNO won't stay connected (Read 389 times) previous topic - next topic

Mattd76

Hello,

This is my first post on these forums. I am looking for a little help on a school project I am working on. I need to control a servo motor by using an IR proximity sensor. I have the base code written and it works, however when I upload the code and run it the board has trouble staying connected to the computer and it continuously resets itself and won't run smoothly. I originally thought it was an issue with the computer so I connected the board to an external power supply (9v battery) and the same problem occurs. The board resets itself all the time and won't run the program smoothly.

Any assistance in helping me solve this problem will be greatly appreciated.

jabbado

What happens when you try a different sketch?

Mattd76

I have had mixed results with different sketches. I loaded a sketch to just do a sweep of a servo not using any input and it ran fine one time, another time it would reset randomly and twitch and it didn't matter if it was connected to the computer or the battery. I was also able to run a sketch just to output the data from the sensor to the serial monitor , not run the servo at all, and it ran fine.

MichaelMeissner

It sounds like your servo is drawing more power than the Arduino can supply.  You probably need to wire the servo motor to a separate power supply, and just have the control come from the Arduino.  Be sure to connect the grounds of the two power supplies.  DuaneB wrote a tutorial on how to wire up servos: http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html.

Note, that you will not be able to use pins 9 and 10 for PWM functionality for other items on an UNO with a servo.  I ran into this when I tried to use an LCD shield (which wanted to use those pins) and a servo.

Mattd76

Thanks for the reply. I will try wiring another power supply for the servo today or over the weekend and see if that solves the problem.

retrolefty

Yes, powering even a single servo from either USB power or one of those wimply 9 volt batteries is asking for problems, so many before you have experienced the same problem symptoms. 9 volt batteries are for powering smoke alarms not arduino projects.

Lefty

Zack_Johnston

Try a different power supply, and make sure it is smooth. Maybe you should use a DC power supply and regulate the voltage.

Go Up