Need help with IR proximity sensor

Ok here's the deal - I have an IR proximity sensor (2 actually) connected to a Mega Sensor Shield 2.0 on an Arduino Mega (pin D21). When connected by USB to my netbook the sensor works fine but when I unhook and flip the switch on my 4x1.5 AA battery box the sensor stays triggered.

What am I missing here? Why would it be any different? The sensor is the round type 3-wire like this http://www.dfrobot.com/index.php?route=product/product&product_id=114#.UiPBaH8glRE. I sent the netbook on a ride with the robot and it worked fine so my code is good. I just got back to working on this one and it's holding up progress.

 

The sensor shield is a

The sensor shield is a SainSmart and I was going to run external power to see if that helps but the jumper sits on top of the Arduino USB port shorting it so removing the jumper won’t do anything. Can’t seem to win on this one.

Ok success, the 6v 4.5ah

Ok success, the 6v 4.5ah battery did the job. Looks like I’ll have to tap the motor battery to supply everything which is what I should be doing anyhow. I’m just surprised the extra prox sensor was too much for the battery pack. Would be fine if I could use the external power connector on the SainSmart sensor shield. What a crappy design, I’ll get some new pics and video up at this stage before I progress to the next level of the project…

 

 

I dknt know how true this

I dknt know how true this is, but I read online that powering electric motors with a 9 volt battery isnt best because 9 volt batteries drain pretty quick when they drive moters.  Might want to look into it   :). Confirmation on this would be awesome.

I’ve never tried it but

I’ve never tried it but really wouldn’t consider it unless it was a really small motor. Motors draw a lot which is why I always run them from a different supply than the electronics. In this case I think I went just beyond what the AA battery pack could handle. I understand the USB port doesn’t supply a whole lot but it was just enough to squeek by. It threw me off because I uploaded code and adjusted the prox sensors and tested them and all was fine. Then when I switched to the onboard supply they crapped out.

**You realize those sensors are manually adjustable **

but still digital output. If they are like the ones another member attempted to use, you can set them to trigger at a given distance, but, that is all they will do. You can’t determine anything more than, “yes, there is something between me and the distance the sensor is set to turn on at.”

Yes I do - notice I

Yes I do - notice I mentioned that “I uploaded code and adjusted the prox sensors and tested them” in another comment. I prefer contact-less bump switches on my designs. These are perfect for bump switches and they fit inside 1/2" pvc “T” connector.