Shopping Cart

You have no items in your shopping cart.


Line Following Sensor

Be the first to review this product

Availability: Out of stock


Line Following Sensor


This I2C Line Following sensor allows your robot to track a line on the floor using five sensors. The five onboard sensors see white or black, which allow you to track a white line against a black background, or a black line against a white background.

In addition to the five onboard sensors, we added two additional inputs to the sides of the board. This allows you to connect any kind of sensor that outputs 0-5V, and query them through the board. This allows you to connect additional Single Line Following Sensors, Bump Sensors, and/or Cliff detection sensors.

When queried, the onboard firmware returns a single byte representing the status of all five sensors and the two additional inputs, in a range from 0 to 127, where 0 means all sensors see 'white' and 127 means all sensors see 'black'.

The sensor board has four typical I2C inputs (Vcc, Sda, Scl, and Gnd), two GPIO inputs (Gnd, Vcc, Signal), and requires a Vcc of +5V.

The sensing distance is approximately 0.04 inches to 0.5 inches (1mm to 12mm).

Two holes on the board allow the Line Following sensor board to be rigidly mounted to your robot.

The Line Following sensor board has a bi-color (red/green) LED. The Red LED is used to indicate when power is applied to the sensor. The Green LED flashes to communicate the currently programmed I2C address upon power up. It is then used to indicate if any of the sensors see white or black. If the green LED is off, then all of the sensors see black, otherwise if any of the seven sensors see white, the green LED lights up.


You can read the I2C line sensor by issuing an I2C read of the programmed address.

A single byte representing the status of the seven sensors will be returned, ranging from 0 to 127, where 0 means all sensors see 'white' and 127 means all sensors see 'black'

The two blue colums on the right represent the two optional GPIO inputs on the side of the Line Follower. If nothing is connected, then their readings will be '0'.

S1 S2 S3 S4 S5 IO1 IO2 Reading
0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 1
0 1 0 0 0 0 0 2
1 1 0 0 0 0 0 3
... ... ... ... ... ... ... ...
1 1 1 1 1 0 1 125
1 1 1 1 1 1 0 126
1 1 1 1 1 1 1 127

I2C Reading and Addressing information:

The I2C Line Following sensor comes pre-programmed with a default address of 0x50, however, it can be reprogrammed with a new address, just in case your system requires multiple line following sensors.

To change the address of the Line Following Sensor, it must first be the only device connected to your I2C bus. Then, you can write the following 3 sequence commands 0xA0, 0xAA, 0xA5, in the correct order, followed by the new address. For example to change the Line Following Sensor address from 0x50 (default) to 0x58, issue the following byte sequence to address 0x50: 0xA0, 0xAA, 0xA5, 0x58.

NOTE: No other command may be issued in the middle of the sequence. The sequence consists of 4 separate write transactions on the I2C bus.

The table below shows the possible addressing values, and the corresponding number of LED flashes you'll see when the device powers up.

Decimal Hex LED Flashes
80 50 1
82 52 2
84 54 3
86 56 4
88 58 5
90 5A 6

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.

Memory usage: real: 33816576, emalloc: 30116108
Code ProfilerTimeCntEmallocRealMem