WSAL12223 – Tracker Sensor/en
Erscheinungsbild
Documentation notice: This technical documentation was independently rewritten from an archived supplier source. Check technical details and commands against the product version and manufacturer documentation before use.
Summary
Technical overview of the Waveshare Tracker Sensor (WSAL12223) for infrared line tracking: specifications, operating principle covering normalization, weighted average and PID control, plus example wiring to STM32 and Arduino boards.
Related products at JW Tech
Technical overview
- Operating voltage 3.3 V to 5 V; size 78 mm × 18 mm; probe spacing 16 mm; mounting hole diameter 3 mm; sensing distance about 1 cm to 5 cm.
- Five analog outputs produce values that depend on distance and reflectance: lighter (white) surfaces give higher values, dark lines lower values.
- Normalization converts raw readings into 0–1000 via y = (x − Min) × 1000 / (Max − Min), where 1000 means far from the black line and 0 means directly above it.
- Min and Max are determined by repeated sampling; during calibration the vehicle should run along the black line and swing side to side.
- Weighted average computes line position in 0–4000: y = (0·v0 + 1000·v1 + 2000·v2 + 3000·v3 + 4000·v4) / (v0+v1+v2+v3+v4).
- 2000 corresponds to module center; 0 is leftmost, 4000 rightmost.
- For precise detection the black line width should be ≤ 16 mm, and the module should be mounted so two adjacent sensors can detect a centered line.
- PID control keeps position at 2000: proportional = position − 2000; derivative = proportional − last_proportional; integral += proportional; power_error = Kp·proportional + Ki·integral + Kd·derivative.
- The AlphaBot example uses PD instead of full PID (no integral term); Kp, Ki, Kd are individually adjustable.
- Wiring to XNUCLEO-F103RB: IR1–IR5 to A0–A4, GND to GND, VCC to 3.3 V. Wiring to Arduino UNO PLUS: IR1–IR5 to A0–A4, GND to GND, VCC to 5 V.
Commands and examples – verify before use:
y = (x - Min) * 1000 / (Max - Min)
y = (0 * value0 + 1000 * value1 + 2000 * value2 + 3000 * value3 + 4000 * value4) / (value0 + value1 + value2 + value3 + value4)
proportional = position - 2000;
derivative = proportional - last_proportional;
integral += proportional;
last_proportional = proportional;
power_error = proportional * Kp + integral * Ki + derivative * Kd;
Notes and version constraints
- The source contains template placeholders such as {{{name2}}} and {{{userDefinedInfo}}}, indicating incomplete templates or rendering errors; these should be verified before publication.
- Calibration requires the vehicle to move along the line during sampling; static tests may yield less accurate Min/Max values.
- The demo code uses PD rather than full PID control; whether an integral term is needed depends on the desired dynamics and must be tuned per application.
- Exact pin assignments may vary with board revisions; the listed connections apply specifically to the XNUCLEO-F103RB and UNO PLUS boards mentioned.
Source and revision record
- Tracker Sensor - Waveshare Wiki
- Source revision: 75845
- Captured: 2026-08-30T03:19:10+00:00
- SHA-256:
c5fb05d52204778f30a86d1c26d437ab6a2593b2b5cddfce65f2d5f902de774d