Depends on which sensor you have.
The NPN or the PNP version.
Connecting the NPN model should be easy.
Just connect the open collector output to a digital input with INPUT_PULLUP enabled, and read the pin.
Dont forget to share grounds if you have different supplies.
The PNP version needs a voltage divider to drop the sensor output voltage to <5volt.
Sensor supply can be 10-30volt. So it could also be powered from a 12volt supply.
200mA means that the sensor can switch upto 200mA.
The sensor itself only uses 15mA.
Leo..
Wawa:
Depends on which sensor you have.
The NPN or the PNP version.
Connecting the NPN model should be easy.
Just connect the open collector output to a digital input with INPUT_PULLUP enabled, and read the pin.
Dont forget to share grounds if you have different supplies.
The PNP version needs a voltage divider to drop the sensor output voltage to <5volt.
Sensor supply can be 10-30volt. So it could also be powered from a 12volt supply.
200mA means that the sensor can switch upto 200mA.
The sensor itself only uses 15mA.
Leo..
have you any schematic for this .
I have npn photocell I build web guide system if you know what is this .
Wawa:
Connecting the NPN model should be easy.
Just connect the open collector output to a digital input with INPUT_PULLUP enabled, and read the pin.
Leo..
I have npn photocell .
I have problem when signal is LOW why I cant one of digital output set as HIGH,but
When is signal HIGH i can it.
I need this for controling direction dc motor .
I switch on relays.
Wawa:
Reading a sensor and outputting the result to a motor or relay are two different things.
Read the sensor state, and make it turn the onboard pin13 LED on/off first.
Then worry about relays and motors.
If you already have written code, post it.
Leo..
void setup() {
// initialize digital pin 13 as an output.
pinMode(8, INPUT);
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
int state1=HIGH;
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
state1 = digitalRead(8);
if (state1 == LOW ){
digitalWrite(13,LOW);
}
}
this is code but this code didnt work do you know why ?
Hey this code really helped me with a project I'm working on with a Banner NPN Photoelectric sensor connecting to an Arduino.
It took me a while to find the right answer, but it saved me posting a new topic when the answer was there to find.