Basic Line Following Sensor assembly

This is the full size line sensor circuit board top:

and bottom:


  1. Solder in emitter load resistors R3, R4, and R5 – all 68 Ὠ

    Then the detector load resistors R6, R7. R10 and R11.The value of these detector load resistors depends on the photo transistors being used as detectors. If using the BPW85C phototransistor then use four 4.7K Ὠ resistors for R6, R7, R10 and R11
  2. If emitters are to be pulsed solder in resistors R1 390 Ὠ and R2 10K Ὠ that provide the biasing for the pulse transistor. If the emitters are to be left on all the time, omit these two resistors but put in a wire link on the PCB where it says LNK1 BYPASS
  3. If you want to use the two indicator LEDs, solder in resistors R8 and R9. Before you confirm these values and solder them in, check that the resistance is suitable for the LEDs that you use for LED4 and LED5. Do this by putting one resistor in series with an LED with 5V across it to check that it lights up. If using a high efficiency LED you may be able to use a larger resister of up to 1KὨ
  4. Solder in Capacitor C1 100µF making sure that it is oriented correctly. The longer lead should be the positive side and the negative side should be marked on the body of the capacitor. The PCB shows a + next to the positive lead.
  5. Solder in the two indicator LEDs LED4 and LED5. Make sure these are correctly oriented. The long lead on the LED should go to the hole marked A (Anode) and the shorter lead (and the side with the flat on the LED) should go to the hole marked K (cathode). Make the LEDs stand a few mm above the board by slipping a thin piece of paper between the legs of the LED between the LED and the PCB.

  6. If emitters are to be pulsed, add in transistor Q1. Correct orientation is essential. The transistor has a flat side which should be placed where the word Q1 is printed on the PCB. This will ensue that the emitter, base and collector go correctly into the 3 holes marked e, b and c
  7. Next we need to add the sensor LEDs and phototransistors. These are all mounted on the other side of the PCB to the other components. There are 3 LEDs and 4 phototransistors.
    The values of these parts depend on whether you are using Infra-red invisible light or visible light. See Tools and Materials page for further details.

    The 3 LEDs are soldered in with their long leads (+ve) towards the front of the board marked A. Leave sufficient length on the leads so that the ones at the sides of the board can be bent out by 30 degrees to see the side markers. Once they are soldered in, put 5v and Gnd on the relevant connector pins and 5v on D12 to check that they all light up.

    Next put in the 4 phototransistors. If using the BPW85C these also go with their long leads towards the front of the board marked E (emitter). If using another phototransistor check from the datasheet which lead is the emitter and orient them accordingly. Make sure that there is enough length on the side ones to bend them out by 30 degrees to match the LEDs.

  8. Ten of the 11 holes of connector J1 on the sensor board now need to be attached to a 10 core multi-way wire or by 10 connector leads to the sensor socket on the main board. You do not use the 3.3v connection at the end marked J1. These will plug in via whatever connectors you use into the group of 10 adjacent pins marked from 5v through to A3 on the main PCB. The easiest solution is to use 5 Female to Female Dupont connector leads cut in half with the cut end soldered into the sensor board so that the 10 female ends plug into the Pin header on the board.
  9. The sensor board is fixed to the main PCB with two M3 screws with a 10mm spacer between the main PCB and the sensor board, with the nuts on top. These M3 screws go through the front set of two holes in the main PCB from the bottom.

Half Size Line Sensor assembly

These are the instructions for the UKMARS half size line follower board

The components are almost the same as for the full size line follower but we have excluded a couple of items to simplify things and save space on the board. The board is designed to plug directly onto the UKMARS main board. This is the top of the half size line sensor circuit board:

and here is the bottom of the board::

Start by adding resistors R1 390 ohms and R2 10K ohms to the top of the board these provide the bias for the base of transistor that switches the LEDs on and off

Next add resistors R3, R4 and R5 – all 68 ohms. These are the 3 current limit resistors for the 3 LEDs

Now add resistors R6, R7, R10 and R11 – all 2.2K ohms. These are the load resistors for the 4 phototransistors

Now add R8 and R9 – both 1K ohms. These are the current limiting resistors for the 2 indicator LEDs

Now put in the LED switching transistor Q1 ensuring that it has the flat side to the left as shown.

Next add the 2 indicator LEDs, LED4 and LED5. They can be any colour but it is best to have 2 of different colours, Almost any LED will work and they can be either 3 or 5mm. I have used one yellow and one green 5mm one here. Ensure that the long lead of the LED (the positive lead) goes into the side of the hole marked A (for anode). Note that LED4 has the +ve lead to the right and LED5 has the +ve lead to the left

The final item on this side of the board is the 100 microfarad capacitor C1. It stands upright and is polarised so must be put in the right way round with the positive lead going in next to the + sign.. The side of the capacitor will normally have a lighter band with one or more minus signs on one side, so the other side is the positive lead.

Now turn the board over and put in the three high brightness Truopto OSHR3131A-NO LEDs, LED1, LED2 and LED3. A small red spacer of about 5mm on the long lead is useful to help made the LEDs stand off a bit from the board and helps to make sure you put them in the right way round with the long red lead adjacent to the edge of the board in the A (for Anode) hole. You can make the spacer from a short piece of insulation stripped from a red piece of wire.

Now put in the four BPW85 phototransistors T1, T2, T3 and T4 next to the LEDs. Note that on this device the long lead is the emitter which is the negative lead. A small blue 5mm spacer on the long lead will help to ensure that you put these in the right way round with the long blue spacer lead in the E (for emitter) hole as shown here. Note that if you use a different phototransistor the emitter, and collector lead positions may be the other way round. Check the device datasheet and insert the Emitter lead in the hole marked E, and the Collector lead in the hole marked C.

Finally add the 10 way socket to the underside of the board, making sure that it is seated well down onto the board. Solder one end then the other end then check the seating before soldering the rest of the contacts.

Turn over the completed board. It is ready to plug in and should look like this:

Before you plug it in you should set up the input and output pins on the Arduino Nano as specified in the Developer Notes Pin Assignments page

The board should be plugged into the 10 pins of J1 on the main board closest to the motor driver board

When seen from below, the phototransistors and LEDs should just be visible beyond the front of the board

A 3mm bolt can be inserted through each of the 2 holes at the front of the main board and then through a 12mm spacer and then through the 2 holes in the line sensor board. A nut on the top of each bolt will hold everything securely in place. If you only have a shorter spacer you can add a nut or two below it to make up the correct distance as shown here:

Your sensor board is ready to test – please remember that the trigger on pin 12 needs to be set high to switch on the LEDs and that about 100 microseconds delay should be given after switching on the LEDs for them to get to full brightness before reading the input from the phototransistors. After taking the readings you can switch off the LEDs again to reduce the battery load

Using the half width line sensor with a 3.3 volt CPU

If you are using this sensor with a 3.3 volts CPU board. e.g. with a Cytron Maker Nano RP2040 or a Raspberry Pi Pico or an Arduino Nano 2040 it helps to adjust the values of many of the resistors; The following resisters should be changed:

R3, R4 and R5 Replace the 68 ohms resistors with 27 ohm ones. This will gives 48 mA through the line illumination LEDs

R6, R7, R10 and R11 Replace the 2.2K ohms resistors with 33K ohms ones for the phototransistor current limiters

R8, R9 Replace the 1K ohms resistors by 150 ohm ones. This will give about 8mA through the indicator LEDs

R1 and R2 do not need changing from their 390 ohm and 10K ohm existing values

Note that if using any of these boards you will need to disconnect or disable the 5v output from the CPU board and then connect the 3.3v and 5v lines together to feed the 3.3 volts into all of the robot circuitry. This is so that 5 volts is not fed back into any of the inputs on the CPU board as they are not able to handle inputs over 3.3 volts. Th simplest way to do this is to clip off the 5 volt pin from the CPU board so that it does not go into the CPU board socket.