HW-006 Line Tracker Module Guide

Infrared line tracker modules hardly need an in-depth explanation as they’re very familiar to most electronics and robotics hobbyists. In this post I’ll discuss a popular and cheap infrared line tracker module – the HW-006 (v1.3).

These modules, typically seen in line following robots, are ideally suitable for white/black line detection. You can also see them in certain entry alarm systems.

HW-006 Module – A Brief Overview

The HW-006 (V1.3) line tracker sensor module based on TCRT5000 an infrared reflectance sensor. This is usually mounted at the bottom of a line following robot chassis. This compact tracking sensor module not only can detect transitions from light to dark lines/rails but also objects directly in front of it.

The recommended working voltage of the sensor module is 3.3V to 5V DC while its peak operating current is around 20mA to 30mA as found in a Chinese seller’s description. The module has a “digital” output (0/1 or L/H) and a peak object detection range of 10mm. Note that this module doesn’t have an onboard trimpot for detection sensitivity/threshold adjustment!

What you often see in a Chinese sensor module is the dual-comparator IC – LM393. In this module, the design focuses on a completely different IC – 74HC14, which is a hex inverter with Schmitt-trigger inputs!

The 74HC14 IC provides six independent Schmitt trigger input inverters with standard push-pull outputs. It’s designed for operation with a power supply range of 2.0V to 6.0V. The gates perform the Boolean function: Y = Ā.

The circuit of the module (HW-006 v1.3) is like the diagram below.

This is a schematic prepared with the help of my UNI-T UT116C SMD tester and USB microscope!

As you can see in the above schematic, the module’s circuitry only requires one of the six available inverters in the 74HC14D IC, and all its unused input pins are terminated at VCC. This is necessary because the undefined voltages at the outside connections result in undefined operational states. Although the Schmitt-trigger input architecture provides hysteresis which makes the chip extremely tolerant to slow or noisy inputs, it’s still a good idea to properly terminate unused inputs (unused outputs can be left floating).

The unused inputs of 74HC14D are tied to GND rail in some old versions of this HW-006 module.

HW-006 Module – An Agile Test

Testing this module is simple because it provides a logic-high level (1/H) output during proximity detection, and the output has a red LED to indicate the detection status. So, simply power up the module with a regulated 5VDC power supply and bring your hand closer to the module’s “eye”. You will see the status LED wakes up instantly when your hand is close to the infrared sensor part. That’s it!

HW-006 Module – Arduino Event Counter

Now to a simple even counter project using HW-006 module and Arduino Uno.

This is the crude Arduino Sketch. This code lets Arduino acquire signals rendered by the sensor module via digital pin 12 (D12) so that it can finally output the event counter values ​​to the computer thru serial port. Arduino’s onboard LED (D13 LED) here works as a simple visual indicator to show the event counter activity. To read the event counter, you can use Arduino’s Serial Monitor.

const int pin_SENSOR = 12;

const int pin_LED = 13;

int sensorState = 0;

int count_value = 0;

int prestate = 0;

void setup() {

pinMode(pin_LED, OUTPUT);

pinMode(pin_SENSOR, INPUT);



void loop() {

sensorState = digitalRead(pin_SENSOR);

if (sensorState == HIGH && prestate == 0) {


Serial.println(“EVENT DETECTION COUNT”);


Serial.println (count_value);

digitalWrite(pin_LED, HIGH);


digitalWrite(pin_LED, LOW);

prestate = 1;

} else if (sensorState == LOW) {

prestate = 0;



If you run this code, you’ll get an event detection counter in the Serial Monitor as shown in the below screenshot. Simply swipe your hand in front of the sensor (within 5mm) to see the counter increments.

See my quick and dirty test setup!

HW-006 Module – Quick Conclusion

I’m glad this minuscule sensor module looks better than I expected, because the output signal transitions are relatively clean and smooth (see the random oscillogram below).

The module does not have a sensitivity set trimpot, but it does have good proximity detection capabilities. Therefore, my conclusion is that this module would be an excellent infrared proximity detector even for non-robotics projects.

I already know more than I need to know, and if you’ve read this far, then you know it, too!

Leave a Comment