2-Axis Light Tracker
A battery-powered dual-axis light tracker in bare-metal C on an ATmega328P with MOSFET H-bridges and a fixed-point Kalman filter.
Drag to orbit · scroll to zoom · hover to highlight · click for details
Highlights
- Built a battery-powered dual-axis light tracker in bare-metal C on an ATmega328P, with motor control through MOSFET H-bridges
- Combined an LDR array with Hall-effect and potentiometer feedback to keep tilt within safe limits and stop motor over-rotation
- Implemented a fixed-point Kalman filter that reduced ADC noise from 3 LSBs to < 1 LSB without a Floating-Point Unit
- Streamed raw and filtered ADC data, plus I/O data, to a PC over a register-level 115.2 kbps UART driver
- Designed a 4-layer KiCad PCB with separate power, ground, and signal layers, and widened the power traces to reduce voltage drop
Overview
A closed-loop tracker that keeps a panel pointed at the brightest light source on two axes, with DC motors on both axes through MOSFET H-bridges. The firmware is bare-metal AVR C and handles everything on one microcontroller: sensing, filtering, motor control, safety limits, and telemetry.
Results
- Kalman on the ADC path cut peak noise from ~3 LSBs to under 1 LSB on the LDR / pot / battery channels.
- Hall end-stops latched cleanly in bring-up — analyzer captures show ~15 ms low windows used for limit timing (see gallery).
- Four-layer KiCad board: ATmega328P, op-amp conditioning, MOSFET H-bridges; interactive 3D model above.
How it works
- Sensing. Paired LDRs measure the light difference on each axis. Potentiometers report each axis’s position, and a resistor divider monitors the battery voltage.
- Filtering. A fixed-point Kalman filter smooths the raw ADC readings from the LDRs, potentiometers, and battery monitor, cutting peak noise from 3 LSBs to under 1 LSB.
- Control. When an LDR difference crosses its threshold, the firmware drives the base or panel motor toward the light through a MOSFET H-bridge.
- Calibration and safety. At power-up the tracker sweeps each axis into its Hall-effect limit sensors to learn the potentiometer’s minimum and maximum ADC values. Latched software states then stop the motors before they over-rotate.
- Telemetry. A register-level UART driver, clocked from a 9.216 MHz crystal so standard baud rates divide exactly, streams system status to Python logging scripts on a host computer.
Hardware
The control board is a four-layer KiCad design built around the ATmega328P, with MOSFET H-bridges for both motors, op-amp conditioning on the sensor inputs, an ISP header for programming, and test points on the key nets for bring-up. Explore the interactive board above, or the layout and schematic in the gallery.
See it follow a light source in the demo video.
Checkpoint reports
Weekly write-ups from ELEE 4230 (Sensors and Transducers), plus the final course report:
| Checkpoint | |
|---|---|
| CP1 — Project idea, BOM, sensor selection | Download |
| CP2 — Hall-effect sensor characterization | Download |
| CP3 — LDR sensing and signal chain | Download |
| CP4 — Capacitive touch input | Download |
| CP5 — Enclosure, telemetry, demo | Download |
| CP6 — Final report | Download |