Hello.
I need to connected 24V laser proximity sensor to arduino. To keep power lines separately I used optocoupler(4N32). For the schematic, see the attached pic. I want to use only internal pull-up. But a problem came up.
I wrote this simple test code:
int S1= 2;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
Serial.print("started");
pinMode(S1,INPUT_PULLUP);
}
// the loop routine runs over and over again forever:
void loop() {
if(digitalRead(S1) == LOW){
Serial.println(millis());
Serial.println("pin LOW");
delay(500);
}
}
And as a result it allways prints to me "pin LOW". Voltage on that pin is 4,2V. Which should be "high". Why doesnt it work? Why it has a voltage drop, eventhough sensor output is 0V?
Grumpy_Mike:
I would suspect that it is not wired up like you think.
How about a photo correctly sized?
You mean that i wired it up wrongly? I dont think so. If i add external pull-up it works perfectly. Just cant figure out, why not with the internal pull-up.
What is the max pohoto size? :* I just used win snipping tool...sorry