You have the pin labels correct.You only need resistors to limit the current to the led's, i use pots instead to adjust them.The phototransistor produce a changeing current but your adc port needs a changing voltage. To get the voltage change to represent the current change, you will have to use to resistors to produce a voltage dividing circuit for each one (see the photoresistors in the $50 robot tutorial and how the outputs go from there it is the same principle).

I have also taken to adding a capacitor to the inputs of the phototransistors when i use multiple of them (sometimes the changeing value of 1 can alter the values of the others otherwise). And also I found that a small signal diode straight after the phototransistor output (before the voltage divider) helps to keep a nice smooth signal ...

You have the pin labels correct.You only need resistors to limit the current to the led's, i use pots instead to adjust them.The phototransistor produce a changeing current but your adc port needs a changing voltage. To get the voltage change to represent the current change, you will have to use to resistors to produce a voltage dividing circuit for each one (see the photoresistors in the $50 robot tutorial and how the outputs go from there it is the same principle).

I have also taken to adding a capacitor to the inputs of the phototransistors when i use multiple of them (sometimes the changeing value of 1 can alter the values of the others otherwise). And also I found that a small signal diode straight after the phototransistor output (before the voltage divider) helps to keep a nice smooth signal ...

I chose the values for my voltage dividers by using pots as the dividing resistors and using a multimeter to assess the output. (why do all of the maths if you can do it visually).

Something else that you should think about is connecting the LED's to digital output ports through a mosfet. This way you can turn them on and off using the microcontrollers output which will allow you to cancel the background light, do modulation etc... (I make all of the LED's common to 1 mosfet and give them all common cathodes/annodes so they all switch on/off at the same time using only 1 i/o pin) Your robot can also switch them off when they arent needed and save power this way too.

Also their effective range is only supposed to be around 1 - 3 cm but ive managed to get them detecting things at 30cm (I think they can be pushed further than that too. especially if you just pulse the led's it will stop them from burning out so easily)

Because the LED's dont use much current, its not important to drive the gate above the input voltage (if you use mosfets for anything that requires a lot of power make sure to drive the gate voltage higher than the switch through). So because the led's are low powered we can connect the mosfet straight to an output pin. Yes you can also use this type of system to drive the phototransistors. If you have enough pins, there is no reason why you cant control power to all peripherals and sensors like this. As i mentioned in the brackets, something likely to draw a lot of current will need some kind of voltage booster between the mcu pin and the gate of the mosfet. Anthing likely to draw an above normal amount will require a power transistor with a heat sink.

The mosfet that you looked at will work but its very much an overkill for powering the ir LED's. You can tell by looking at the prices. The ones I used were like £0.14 / $0.07 and the ones you chose were like $1.50. Also there is a big difference in their sizes and their pcb footprints. (Also because your mosfets is meant for higher current applications it will also consume more power itself to operate).

my advice is to order a bunch of mosfets (general purpose types) so you have many going spare. They come in useful for loads of things, Just building them into your circuits can allow power control to nearly every application through the microcontroller. Im sure you can understand the power saving advantages offered. (I try to bulk purchase a lot of components so that i dont end up having to wait or even compromise on a design - bulk purchasing the mosfets that I used as a quantity of 50 mosfets only cost me $3.50 equivalent for the lot)

Because the LED's dont use much current, its not important to drive the gate above the input voltage (if you use mosfets for anything that requires a lot of power make sure to drive the gate voltage higher than the switch through). So because the led's are low powered we can connect the mosfet straight to an output pin. Yes you can also use this type of system to drive the phototransistors. If you have enough pins, there is no reason why you cant control power to all peripherals and sensors like this. As i mentioned in the brackets, something likely to draw a lot of current will need some kind of voltage booster between the mcu pin and the gate of the mosfet. Anthing likely to draw an above normal amount will require a power transistor with a heat sink.

The mosfet that you looked at will work but its very much an overkill for powering the ir LED's. You can tell by looking at the prices. The ones I used were like £0.14 / $0.07 and the ones you chose were like $1.50. Also there is a big difference in their sizes and their pcb footprints. (Also because your mosfets is meant for higher current applications it will also consume more power itself to operate).

my advice is to order a bunch of mosfets (general purpose types) so you have many going spare. They come in useful for loads of things, Just building them into your circuits can allow power control to nearly every application through the microcontroller. Im sure you can understand the power saving advantages offered. (I try to bulk purchase a lot of components so that i dont end up having to wait or even compromise on a design - bulk purchasing the mosfets that I used as a quantity of 50 mosfets only cost me $3.50 equivalent for the lot)

I used to have a ton of these low-power transistors in undergraduate school as an EE major. There all missing now. The NPN transistor emitter is connected to the led or phototransistor, the collector is connected to Vcc (5v) and the base is connected to a digital output which controls the toggle of the power essentially?

Is mosfet another word for NPN transistor? I forget much from undergrad school. sorry!

Sorry they are transistors, I was just using them as a mosfet (They are basically similar in principle except that a mosfet is used for switching straight on/off and a transistor is regarded as always on (meaning that its output varies with its input)).

For this application the transistor can easily be used since all it needs is a voltage from the mcu to allow the current to flow from the power to the led's

Quote

The NPN transistor emitter is connected to the led or phototransistor, the collector is connected to Vcc (5v) and the base is connected to a digital output which controls the toggle of the power essentially?

Exactly, Its a way of letting your mcu control power without having to source/sink it. The power comes straight from the 5v bus, its the signal from the mcu that lets it flow. Doing things like this can also let you build your circuits as smaller component circuits making them easier to understand and debug.