Connecting a light sensor to the BoeBot

Jump to: navigation, search

Understanding the Circuit

We are going to connect two phototransistors to the BoeBot, as two happens to be much more useful than one in terms of navigation, but we'll get to that later. In the meantime, we are going to connect the phototransistors to analog ports 0 and 1.

Schematic for the connection of two phototransistors

We have already explained how a phototransistor acts like a variable resistor. Since the resistance varies with the amount of light hitting the sensor, we can place it in a circuit that converts the changes in resistance to changes in voltage. The circuit used is called a voltage divider. It operates on the principals of Ohm's Law and Kirchhoff's circuit laws.

Generic voltage divider circuit.

Kirchoff's circuit laws dictate that for such a circuit, the total resistance (RT) of the circuit is the sum of the resistance of the individual components. As such, for voltage dividers RT=R1+R2. Thanks to Ohm's Law and Kirchoff's Current Law, we also know that each component has the same current flowing through it, and that it is the same as the total current. So IT=I1=I2. Then using Ohm's law we can find the voltage drop across each component. So Vn=In*Rn.

By combining all of the above equations we arrive at the voltage divider equation.


However, since we have a variable risistor in the place of R1, we need to expand the equation to make plugin in the value of the phototransistor easier.


So for this setup we find the equation is:


Making the Connections

The parts you will need are all included in the BoeBot kit. For this project, you will need 4 colored wires, two 2kΩ (red-black-red) resistors, and two phototransistors.

The parts you will need.
Virtual breadboard view.
You will need to bend the light sensors as seen in the image.