I am unable to run both the sensor and the two motors off the arduino power supply. When I do this is drastically slows down my sensor and the output becomes too jumpy.
I am currently running the two motors off a 9v batter and the sensor off the arduino power supply. This seems to have fixed the problem but I think I have too much power going to the motors because they are seizing up and not taking instructions.
I am not sure what to do about this. Any advice would be greatly appreciated. I am new to electronics.
You need to have a 4.8-6.0 volt (at least 360 milliamp) power supply for the motors. There is a long list of options available: reduce the 9V using a regulator or voltage divider, buy a wallwart that provides 5.0 volts @ 500ma, get a 4 cell battery cage and batteries.
If you're confident you're providing enough power in the correct voltage range then I can think of two possibilities...
The motors were damaged by the 9v
There's a bug in the application
I suggest carefully going through a "servomotor tutorial" to ensure each motor has not been damaged. If each motor works correctly then the problem is very likely a software bug.
I don't think it's a software bug. It works fine with one motor and both motors are sharing the same output pin.
I now have exactly 4.88v going to the motors. I am having the same problem. although when i unplug the motors I am getting a reading of 6v at the voltage regulator.
I am using a 5V regulator to reduce the voltage from the 9v battery. Shouldn't it be reading 5v? Could this be causing the problem but when I plug in the motors I get 4.8..... I apologize but I am new to all this so I would greatly appreciate your explanation.
I tested both motors using the sample sweep application both work so i know the servos are ok.
However, the servos only work when connected directly to the arduino power supply. If I use an external power supply they seize up. I know this is possible because I have done the same configuration in the past with the same code.
I have checked and it is wired correctly.
I also tried multiple voltage regulators so unless my entire order is defective it's not reducing down to 5v.
Then what you think you are checking is wrong or your regulator is broken.
Have you got capacitors on the input and output? If not it might be oscillating, you do need these as well as the regulator.
Are you measuring it on a meter or a scope?
Have you connected the ground to the arduino ground?