5V photodetector to Teensy 3.1 interrupt

amatic

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

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 () {}
 
The Teensy 3.1 (T3.1) is 5V tolerant so you could just have a Resistor between O and V and take the O output into the T3.1.
Alternatively, if you do wish to limit the Teensy input to 3.3V, simply have a Resistor between O and the 3.3V.
 
Ok, thanks! So, the output is pulled up to 3.3V, cool! Now it looks like this, and seems to be working great:
Code:
       5V    3V3
V -----+      | 
             [10K]
O ------------+------> to teensy pin 15
            
G ----- GND
 
Back
Top