Digital input doesn't work with sensor

Hello,

I bought a 5V digital ir sensor and connected it to my arduino uno without resistors or any other pieces. This worked perfectly, i got a clear on/off signal to my computer.
But when i power the sensor with 4 1,2V AA batteries (the arduino is still powered by usb), and put the signal wire into the digital port, the output on my screen is messed up. As if i put a loose wire into the digital port.

Does anyone knows what i'm doing wrong?

This is the sensor i'm using: http://iprototype.nl/products/components/sensors/infrared-distance-switch

(the digital port works fine when i power de sensor by the arduino, so i don't suppose the port is broken)

I hope someone can help me with this, it's bugging me for quite some time now..

Thanks!
Jeroen

Thank you KE7GKP, I connected the grounds and it works!

For others whose curiosity was tweaked...

An English page about this device...

Cost $7.50

Seems to be an IR emitter/ detector pair in a housing, both facing the same way. Distances to suitably reflective object of 3-80 cm can be detected. The description speaks of that as being "adjustable", so I infer that the device generates a digital output saying "closer than/ farther than what I'm set to."

I'm not sure why in an Arduino application, unless you have used up all your analog inputs, or want really rapid processing of "anthing closer than...." this is better than the sort of sensor it is based on, e.g...

... and similar (search for "proximity") which return an analog reading of distance in various ranges.. one is 15cm-150cm, for instance.

Oh. device cited by OP: $7.50. "Fancier" one: $15. But it gives you so much more!!!

Have a read of some of the comments on the product pages... useful.