Line Follower Module(5 channel)
Contents
Introduction
This 5-Channel Line Follower module is an infrared tracking sensor that uses 5 TRT5000 sensors. The blue LED of the TRT5000 is the emission tube and after electrified it emits infrared light invisible to human eye. The black part of the sensor is for receiving; the resistance of the resistor inside changes with the infrared light received.
The TCRT5000 infrared photoelectric switch adopts a high transmit power infrared photodiode and a highly sensitive phototransistor. It works by applying the principle of objects' reflecting IR light – the light is emitted, then reflected, and sensed by the synchronous circuit. Then it determines whether there exists an object or not by the light intensity. It can easily identify black and white lines.
In other words, the different conduction levels of the phototransistor when it passes over black and white lines can generate different output voltages. Therefore, all we need to do is to collect data by the AD converter on the Atmega328 and then send the data to the master control board via I2C communication.
This module is an infrared tracking sensor one that uses 5 TRT5000 sensors. The blue LED of TRT5000 is the emission tube and after electrified it emits infrared light invisible to human eye. The black part of the sensor is for receiving; the resistance of the resistor inside changes with the infrared light received.
Features
1) Uses the MCU STM8S105C4 as the controller, and the TCRT5000 infrared photoelectric sensor on each of the 8 line-follower modules.
2) Adopts I2C ports which only occupies 4 pins of the MCU.
3) The sensor TRT5000 is highly sensitive with reliable performance.
4) With a RESET button on the board for resetting, and positioning holes on the board for easy assembly.
5) Supply Voltage: 5V.
6) A potentiometer is added to adjust sensitivity if the signal of the black lines is too weak to detect.Normally you don't need to adjust.
How to Use on Raspberry Pi
Raspberry Pi | line-following module |
---|---|
GND | GND |
5V | VCC |
SDA(GPIO2) | SDA |
SCL(GPIO3) | SCL |
After the circuit is energized, the power indicator LED D0 will brighten.
How to Use on Arduino
Wiring
line-following module | SunFounder uno Board |
---|---|
GND | GND |
VCC | 5V |
SDA | A4 |
SCL | A5 |
After the circuit is energized, the power indicator LED D0 will brighten.
Code
#include <Wire.h> int count = 0; int raw_result[10]; int analog_result[5]; int high_byte; int low_byte; void setup() { Wire.begin(); // join i2c bus (address optional for master) Serial.begin(9600); // start serial for output Serial.println("Ready"); delay(1000); } void loop() { Wire.requestFrom(0x11, 10); // request 6 bytes from slave device #8 while (Wire.available()) { // slave may send less than requested int c = Wire.read(); // receive a byte as character Serial.print(c, HEX); // print the character Serial.print(" "); raw_result[count] = c; count += 1; } Serial.println(' '); count = 0; for (int i = 0; i < 5; i++) { high_byte = raw_result[i * 2] << 8; low_byte = raw_result[i * 2 + 1]; analog_result[i] = high_byte + low_byte; Serial.print(analog_result[i]); Serial.print(" "); } Serial.println(' '); delay(500); }