Powering the Arduino and other devices

Hello,

I am currently working with an Arduino and to keep it simple I am controlling a servo motor with a sensor as my analogRead to keep an object at a fixed distance. I want to keep it half the total distance so I've been comparing the analogRead to the integer 512. This all works when I have separate power sources however if I use the same source for everything (Arduino, sensor, H-bridge, Motor) the analogRead is always off by about 100 bits or 1 mm. I've connected the sensors ground to the arduino and tried to make all the grounds common in the circuit. I've connected a power generator to the Arduino's Vin and realized that as soon as I change the Voltage going in (sweeping it from 5.5 to 8V) the arduino reads the analog value differently and the motor starts moving. I found the optimal voltage from the power generator to be 6.07V. This does not make any sense, I thought the Arduino can accept a range of Voltage supplies. I think it could be broken. Ive done a power analysis and there is sufficient current for the whole circuit. Any help would be greatly appreciated.

Thanks,

Nick

The voltage on Vin should be at least 7V to allow the onboard regulator to work correctly.

Please provide details of the components (servo/motor, H-bridge etc) and a schematic showing how everything is connected or powered. A servo does not need an H-bridge so it's not clear what you are really using.

And please post your code.

Steve