Let's Make Robots!

Code works under usb power but not battery

Would there be a reason for code working differently by being powered with the Arduino FTDI cable and fresh batteries? I have checked and both supply the system with 5v. When it is powered with the cable, the program works as it should but under battery power, the program runs as if it is not reading the sensor. It is a PIR sensor and i checked that under both power situations, when it detects something, the signal pin is 3.5v. So the sensor seems to be working properly under both power supplies. The output is a servo which should move when something is detected, but it does not move when something gets in front of the PIR sensor. It works fine with power from the cable.