Reading panasonic Photoelectric Sensor

I have problem reading the Photoelectric Sensor data, i have this sensor with pnp or npn setup, the data sheet claim that one of the output should be high when the light is cover, but when i read the output as analog i get between 850 to 950, digital reading is always on.
With multimeter i get few milivolts.

From the datasheet: (pics)

Please help me realise what to do...

How do you have it connected. Can you provide a schematic? Please look at guideline for posting pictures in how to use forum post.

Show us a good schematic & image of ‘your’ circuit wiring.
Posting images:
http://forum.arduino.cc/index.php?topic=519037.0

“850 to 950”
Units.

Which do you have, PNP or NPN? post the part number. The output is not analog, but digital, either HIGH or LOW, read it with a digital pin. What supply voltage are you using?

No need for schematics, just connected the arduino 5v as supply, also gnd, and the white cable (of the sensor) as a input to arduino pin 8.
I used the pnp version, (PM-U25-P - part number).

About 850 to 950 i just assign a variable as integer. But the main issue is why i get always 1 for digital reading? I suspect i didn't connected according to pnp setup...

You do have the blue wire connected to Arduino GND and NOT using pinMode(INPUT_PULLUP), right? Please post your program.
EDIT: You may need a pulldown resistor (4.7k ~ 10k) from pin 8 to GND.

outsider:
You do have the blue wire connected to Arduino GND and NOT using pinMode(INPUT_PULLUP), right? Please post your program.
EDIT: You may need a pulldown resistor (4.7k ~ 10k) from pin 8 to GND.

I do use INPUT_PULLUP and connected the blue wire to arduino GND (ofcourse:)).
I will try pulldown resistor and if it won't work i will post the code (so simple) later, thank you

INPUT_PULLUP is wrong, this is a PNP open-collector output, so you need a physical pull-down resistor,
say 1k, between the pin and ground and to use INPUT

NPN open collector only pulls down, so the resistor needs to pull up
PNP open collector only pulls up, so the resistor needs to pull down...

MarkT:
INPUT_PULLUP is wrong, this is a PNP open-collector output, so you need a physical pull-down resistor,
say 1k, between the pin and ground and to use INPUT

NPN open collector only pulls down, so the resistor needs to pull up
PNP open collector only pulls up, so the resistor needs to pull down...

Thank you!

I used pull down resistor 10k and it work :slight_smile:

Way to go! A karma point for persistence. :slight_smile: