Step 4 - Light Sensor

Assembly Instructions - Step 4 - Light Sensor pack (& how to add tactile feelers)

    • Light Sensor x 2

    • Resistor 470K x 2

This next step is optional and depends on your project.

The light sensors connect to two separate (AN0 and AN1) internal 10-bit analogue to digital converters (A2D) within the PIC microcontroller, which measures the voltage levels based on light levels and converts these to a digital reading. Read the PIC datasheet for further details of how this works.

The hight sensors are place on the top left and right side of the PCB we it is marked S_L (= Sensor Left) and S_R (= Sensor Right).

Command 50 is used to probe the A2D circuit and the measurements from the left and right light sensor. The measure details are sent as two separate words to the RS232 serial port for your microcontroller or robot controller to interpret. See command 050 for further details on how to trigger this command.

Showing pads for Light Sensor 1 on the left hand side of the PCB. The Sensor 2

could be used for a left feeler. the same circuit is provided for the right hand side

Additional connecting pads have also been provided on the PCB, so it possible to attach additional sensor or feelers to the board. These are parallel connection and need to work with together with sensor 1. This is explained in more detail in the next section below.

If you want to use the A2D for other projects, then it may be best to fit a pin header to the PCB instead of soldering the light sensors directly into the PCB. This makes it easier to exchange the light sensor with other sensor types. Or perhaps you may wish to add longer leads or cables to the light sensor, so these can be used for line following games or perhaps even attach a completely different sensing device; such as a temperature sensor.

Depending on the sensor that you wish to install, certain resistors will most likely need to be installed to to bias the voltage through the sensor and A2D circuit. The supplied resistor are intended for the light sensor included.

To connect the light sensors, bend the long leg (the emitter) and the short leg (the collector) of the phototransistor in such a way that you can insert them into the PCB (or pin header). Pin headers for the light sensors are not provided in this kit.

For the LEFT sensor, place the collector (short leg) to the LEFT pad on the PCB

For the RIGHT sensor, place the collector to the RIGHT pad on the PCB. These pads are connected to ground and be tested with a multimeter.

The light sensor is a phototransistor in which the conducted current is a function of the amount of light reaching the sensor. The phototransistor looks similar to a LED, but has a different working. To limit the current through the transistor, you always have to use it in combination with a resistor that is large enough, typically in the order of kOhm. The kit provides a 470 KOhm resistor, but other values would also work if you need different sensitivity or other sensors fitted.

Here is a simplified diagram of the A2D circuit, created with the A2D converter connected to Vout:

Connection of Feelers

This is an optional step and not included in a kit, but the functionality is already provided on the PCB. It can also be done later whenever required.

    • Cut a short length of 0.5mm diameter piano wire and bend into the required shape (piano wire not provided in the kit)

    • Solder pin headers to the provided sensor_1 locations (these pin headers are not provided in the kits)

    • Place one end of the piano wire into the pin hole, as shown in the diagram below. Ensure the wire runs between the pins of the pin header as shown

    • Fit a small rubber band to keep the feelers pulling together, so the piano wire is touching the ground pin of the pin header and not touching the pin marked A2D in picture below

double click for zoom

Picture of feelers and light sensors.

Programming for feelers

    • During power-up routine the IRCF360 will probe the A2D. If the the pins of the A2D are shorted together during power-up, the IRCF360 will go into DEMO mode, which means that the command 30 (IRPD) will automtically be triggered. This functionality has been provided so the sensor be operated in standalone mode without any additional microcontroller being connected.

    • The feelers can be used in conjunction with the lights sensor. When the feeler are triggered the A2D is shorted to ground and the readings from the A2D will give a full scale reading of 255. This is easily recognisable compared to a normal light sensor reading and can therefore be filtered in the robot controller code The trigger to read the feelers is done in the same way has for triggering light sensor readings using command 050.