Programming pulsed Ir sensor

Ok guys, so im making a robot to play soccer, the ball uses pulsed infrared lights so that robots can find it. unfortunatly im the first person in the league to use arduino to play the game.

ive gone out and bought 3 which are 2 prong phototransistors.

after about an hour of going through google and trying different searches i havent come up with much that tells me how to program them or wire them up.

i was hoping that somebody on the forums would have the knowledge to explaine the programming and wiring up to me or be able to link me to a guide to do it.

Thanks for any help

Firstly you are going to have to do some experiments to find out the sensitivity relevant to your application.

The simplest way to connect the sensor is this: collector to +5V, emitter to analog pin and to a resistor. Other side of resistor to ground.

Start with a 1K resistor and experiment to see what analogRead() returns for various conditions - the output should be approximately proportional to light intensity. You want to increase or decrease the resistance until the range of useful values spans a wide range - 0 upto 750 or so of the analog range.

Don't use a resistor less than 220 ohms or so - that risks overloading the transistor. In fact one possibility is to wire a 220ohm resistor in series with a 50k logarithmic pot. You can then tune the resistance between 220 and 50k ohms without rewiring.

im tyring that now, is there a way to get it to read pulsed ir?

the ball uses pulsed infrared lights

Presumably, there is a specification for this. Care to share?

ok so the ball has multiple transmitters tha pulse at a 300 hz frequency. my teacher beleivs that i have to tell the arduino ir sensor to read at an equivelent frequency for it to have any range on the sensor.

Try this...

Since it is supposed to be NPN.... The collector would get tied to +Vcc. (Right? Maybe you would think?)

So... Tie the collector to an 6K to 8K resistor (or close) Then the resistor gets tied to +5V... The other lead (anode? emitter?) goes to Ground.

The junction of the resistor and collector -- tie it to an analog input....

Then see if you can measure a change or a pulsed change as you "illuminate" it with the ball "transmitters". When the diode is "illuminated" you should see the diode/transistor draw current -- or bring the voltage at the collector-resistor junction closer to ground.

See this for a similar diode used in a similar way....

Best I can do. It's too late to think this hard. :cold_sweat: