Help - Phototransistor

I'm a complete newbie to Arduino.

I have a couple of phototransitors (sku: SEN-00246 from SparkFun) and I would like to an LED's blink rate to vary according to the sensor's readings.

I do not know how to connect the phototransitor to the board. Can someone explain how to read the datasheet?

By the way, here's the datasheet:

This a crude diagram I knocked together for another thread. What you have is 2 devices in one package, an Infra red LED and a photo transistor. The diagram above should suffice, The LED half is pins 3&4 which is the left hand side of my diagram. The photo transistor is Pins 1&2 and is the Right side of my diagram. The resistor values are ball park. The three connections to the arduino are Gnd, 5V and either an analogue input or a digital input to the 'test point' on the diagram. Leave the switch out. If you connect it up to an analogue pin for starters and experiment a little with the 2 resistor values to get voltages you can work with. Kind of depends on the reflective object you're trying to sense.........

Hi pluggy,

Thanks for the diagram. I'm not sure what you mean when you reference pins 3 & 4 (for LED) and 1 & 2 (for photo transistor). Are those pins on the Arduino?

Based on the rest of your post, it seems like I only need to connect to 3 points on the Arduino: Gnd, 5V, and an analogue or digital input. So, I am a bit lost.

Also, I know you said the resistor values are ball park. How did you compute ball park values?


Pins 1,2,3 and 4 are marked on the datasheet ypu posted. Pins 3 & 4 provide current to the IR LED, pins 1 & 2 are connected to the phototransistor. I've adjusted the diagram to include the Pinouts of your SEN-00246 device. Theres a schematic in the datasheet on page 1. As as been said elsewhere (Grumpy Mike in another thread) these things are all pretty much alike. The resistor values are ballpark because they aren't crucial, you will get some kind of output if you choose resistors somewhere in the values on the diagram. You suck it and see on your particular setup, you can't give exact figures because the milage will vary depending on the optical arrangement of your set up (The distance of the sensor to the reflective object and just how reflective your reflective object is being two variables). I have a similar device watching my electric meter aluminium disk rotate. I have a 300 ohm resistor on the LED and 860 kiloohms on the phototransistor. Similar values will probably give you some kind of output on your setup. You do only need 3 connections to the arduino, Ground, 5 volts and either an analogue or digital pin at the test point. If you can get a clean enough output from the sensor, digital pin 2 or 3 on the arduino and using interrupts in the code is nice. My electric meter setup doesn't give me a clean signal (imperfections on the aluminium disk) so I use an analogue pin and make sure its reading it on a regular basis. You needn't use the arduino whilst you're experimenting, a digital voltmeter between ground and the test point will give you some idea of what your setup will produce output wise.

The specifics of my setup with pictures are at:

(No pretty flashing LEDS and not a servo to be seen....... :wink: )

Hey all

I'm currently working on something where I want to detect messages sent from a projector to light sensors. Ideally I want to do this 60 times a second (wont mention fps :wink: ).

anyway, currently i'm using LDR's but they're not very fast. I want to use a phototransistor instead. The type i'm looking at is this guy

it's got 3 pins (base, collector, emitter). which makes it seem like a basic npn transistor. I haven't used transistors very much at all, but it looks like I should be ignoring the base, and just hook up the collector and emitter as with your diagrams. is that right?


sorry to u guys know know how to write program for the infrared transmitter/receiver to read value when it is block and without..?

Just connect it to an analogue input port and read the value. It will be big when light is blocked and small when light is not blocked.
The actual values depend on you set up so write a sketch that reads the sensor and prints it out to get a feel for what numbers you are getting from your kit.