← Projects/P-02

Autonomous light-tracking turret

Camera-based anti-drone systems go blind at night, but drones flying with night vision emit infrared. As a team of three we built a prototype that finds an IR source, centers on it with a proportional control loop, measures the distance and, once the target is close enough, fires a 3D-printed dart with a burst of compressed air. The project was graded 10/10.

Course
Electronic Systems, Comillas ICAI
Team
3 students; all of us worked on every part
My part
All the analog electronics, plus part of the code and part of the CAD
Year
2024
Stack
dsPIC33F · C · MPLAB X · Solid Edge · 3D printing
Result
Fully working demo: tracked the source, ranged it and fired the dart
Grade
10/10 for the project
Fig. 01Demo with the lights off
Fig. 02Updated turret head

01How it works

Four infrared photodiodes sit around a panel: up, down, left, right. Comparing them in pairs gives an error signal in each axis; a proportional controller drives two 180° servos (pan and tilt) until the four readings are equal, which means the panel points straight at the source. An ultrasonic sensor then measures the distance, a buzzer beeps faster as the target approaches, and a solenoid valve releases compressed air to fire the dart.

The shot is guarded by several layers: separate arm and stop buttons, an ultrasonic proximity check that only allows firing once the target is inside the set distance, and a 2 s audible and visual warning (buzzer and red LED) before the valve opens. After every shot the system disarms itself.

00Disarmedservos at 90°, LEDs blink 1 Hz
start button
01Scanpan sweeps 10°→170°, tilt fixed at 45°
IR above threshold
02AlertP-control tracking · ultrasonic ranging · buzzer speeds up as range closes
centered & d < dsafe
03Firered LED, 2 s warning, solenoid valve opens

Losing the source drops Alert back to Scan · the stop button returns any state to Disarmed · after firing, the system disarms.

Fig. 03State machine implemented on the microcontroller.

02Electronics

The analog circuits were my part: the photodiode amplifiers and the transistor stages that let the 3.3 V logic switch the 12 V valve and the buzzer.

  • Sensing: 4× SFH203P IR photodiodes in a transimpedance stage built on MCP6002 op-amps (Rg = 5.5 MΩ for a 0.6 µA maximum photocurrent, no dark-current offset).
  • Actuation: 12 V / 0.5 A solenoid valve switched by a BD137 power transistor from the 3.3 V logic; buzzer through a BDX33C Darlington; two PWM servos.
  • Ranging: HC-SR04 ultrasonic module.
  • Controller: dsPIC33FJ32MC202 programmed in C. The course supplied the ADC, PWM and ultrasound drivers; the team wrote the timer, servo, buzzer, LED and push-button drivers and the state machine, and reused a P/PI/PD/PID module from the labs (the turret runs its P term).

03Mechanics

The turret body, servo housings, antenna mount and the dart were modeled in Solid Edge and 3D-printed, then assembled on a pan-tilt base, with the compressed-air launcher and its solenoid valve on the sensor head.

The launcher works a bit like a syringe. With a pump we filled a small chamber with pressurized air, and a butterfly valve driven by a 12 V solenoid kept it shut. When the microcontroller energizes the solenoid, the valve opens and the stored air rushes through a tube into the barrel, pushing the dart out. Depending on how much pressure we pumped into the chamber, the dart flew about 5 to 10 m.

Fig. 04On the bench: photodiode head, pan-tilt servos and wiring.
Fig. 05Servo arm and housing assembly in Solid Edge.
Fig. 06The finned dart, about 30 mm long, modeled for 3D printing.

04The team

We were three, and all of us worked on every part of the turret, so nobody was left without a job. My main areas were the analog electronics, all of which I did, plus part of the code and part of the CAD. One teammate did most of the CAD and a good share of the code; the other wrote much of the code and the technical documentation. It paid off: the turret worked in the final demo and the project was graded 10/10.