Hi, I'm making an IR photodetector circuit, using the omron ee-sx3070:

The IR light diode is on the left, and photodetector diode with the internal amplifier on the right.
Since the photodetector works on min 4.5V, I've connected the V port to usb 5V, and G to ground. I've found somewhere that the O port needs a pullup resistor, so I've put a 10K Ohm between O and V. Since I need a <= 3.3V signal to the teensy, I've used another 10K to ground so I get a voltage divider, like so:
Does this look OK? I've tested it and it works, but I'm not sure it is the best solution for long-time use. I've read that there are already pullup and pulldown resistors on the teensy, but I'm not sure what that means.
This photodetector is normally ON, and when the light is interrupted, it goes OFF.
Minimal working code is:

The IR light diode is on the left, and photodetector diode with the internal amplifier on the right.
Since the photodetector works on min 4.5V, I've connected the V port to usb 5V, and G to ground. I've found somewhere that the O port needs a pullup resistor, so I've put a 10K Ohm between O and V. Since I need a <= 3.3V signal to the teensy, I've used another 10K to ground so I get a voltage divider, like so:
Code:
5V
V ------------+
[10K]
O ------------+------> to teensy pin 15
[10K]
G ------------+
GND
Does this look OK? I've tested it and it works, but I'm not sure it is the best solution for long-time use. I've read that there are already pullup and pulldown resistors on the teensy, but I'm not sure what that means.
This photodetector is normally ON, and when the light is interrupted, it goes OFF.
Minimal working code is:
Code:
void setup() {
pinMode(15, INPUT);
attachInterrupt(15, func, CHANGE);
}
void func() {
Serial.print("IR CHANGE to ");
Serial.print(digitalRead(15));
Serial.println();
}
void loop () {}