Team Lux: Jonah Lou, Jenny Hoac and Chris Woodall
Team Lux: Jonah Lou, Jenny Hoac and Chris Woodall
There are two main components that make up the Laser Turret. The first component is the
webcam, which is used in finding the moving target. The second component includes the servo
motors, which drive the laser that points at the moving target. The servo motors are clamped onto
a stand and attached to the top of the motor is the webcam. Integrating the webcam with the
gumstix board was rather challenging as finding the proper software that could interface between
the two was difficult. However, uvccapture turned out to be the best at providing the proper
drivers that the gumstix could understand and control the webcam with. After the libraries were
installed, processing the images became the next step. The processed image provided the
coordinates of the detected object (a number between 0 and 320 on the x-axis and 0 and 240 on
the y-axis). Then the coordinates are converted into the proper inputs for the servo kernel
module. The servo kernel module “pwmservo”, is a character driver at “/dev/pwmservo” and
receives the coordinates through file system writes. The format for the servo inputted
coordinates are “pNUM” or “tNUM” where NUM is an integer from 200 to 410, which map
between 0 degrees and 180 degrees. The servo signals are sent using the PWM peripheral on
the PXA270, but are sent in bursts of 4-5 every 100ms to prevent overheating.
Upon project completion, we were able to take images and process them within one second. We
allocated another second for the servo motors to move the laser to the targeted area. After all the
implementation, we realize that the servo motors do not need one second to move to the next
targeted area. This could be one area that we could improve upon in the future.
Design Flow
Quantity Component Market Price Description
PPU
2 Servo Motors $10.00
1 Gumstix $150.00
1 Physics Experiment $0.00 Gifted from BU Physics Department
Stand and Clamps
1 Laser Pointer $10.00
1 HD Webcam C270 $40.00 720HD webcam from Logitech
1 Protoboard $3.00 Provides a small circuit board for easy wiring of the
gumstix to the servo motors and power lines
3 .1" Header (3 pin) $1.00
2 Metal L pieces $0.00 Scavenged scrap metal
Table : Parts Table
The components listed above are all the parts needed to create the Laser Turret. The protoboard
is a small board used to easily connect the gumstix pins to the proper servo wires. The .1”
headers are also used to ease the process of wiring the gumstix board. The metal pieces are
attached to the servo motors to provide a base for the laser to rest on. The two servo motors
provide a pan tilt system for the pointing of the laser. The lab stand and clamps are used to hold
the servo motors in place and the webcam is mounted on top of everything. Shown below are
Figure 2: Block Diagram and Figure 1: Protoboard with headers which demonstrate how the
hardware and software interface together.
Work Distribution
Christopher Woodall worked on the servo device driver, which runs the two servo motors that
drive the direction of the laser. He also made the framework that combined all of the
components as well as the mechanical parts of the Laser Turret.
Jonah Lou worked on the image processing code, which detects objects by comparing the
current image with a base image and calculates the correct area to target.
Jenny Hoac worked on the user space code, which does calibration, accesses the two separate
components, and converts the image processing output into the proper servo device driver
inputs.
RC Servomotor Signals
The servo motors we have are standard RC servomotors which take signals like the one in
Figure : Standard RC Servo Signal. The signals are essentially a pulse width modulation with a
period, or frame rate, of 20 ms and a pulse width between 1 ms and 2 ms where the pulse widths
determine the angle of the servo, in our case it was over a range of 180 degrees. There are three
solutions for implementing the servo signaling: (A) using the PWM peripheral (PWM0 and
PWM1) on the PXA270; (B) timer based soft pwm; and (C) using a dedicated microcontroller to
generate the signals which accepts angles over UART, SPI or I 2C from the gumstix. Which
solution is appropriate is determined by the specific needs of the system. For example, in this
case (B) was out of the question because in order to get the resolution we wanted we would have
had to use OS timer interrupts on the order of 1us or less, which brings Linux to a halt.
First of all, the 2 second pause is due to the fact that we want to give the program enough time to
process the images and drive the motors to the desired position. We could definitely have sped up
this wait time but we did not want to risk overwhelming the servo motors – we wanted a smooth
laser to target transition.
Our implementation also required us to have tight setting constraints. Since the images were
converted to gray scale, objects that were vastly different in color from the background but had
the same shade in grey scale may not have been detected. Therefore, motion detection worked
best when there was high contrast between the target and the background. In addition, our
calibration technique required the image backdrop to be fairly flat and the target to be fairly close
to the background in order to simulate the flatness of the actual image. Otherwise, the spot we
actually hit would have been slightly offset from the spot we wanted to hit.
Ideally, we would have wanted our laser turret to work instantaneously and in any setting but we
had limited resources and implemented something that proved to work well regardless.
References
[1] The CImg Library. http://cimg.sourceforge.net/
[2] Latest Drivers for V4L. http://git.linuxtv.org/media_tree.git
[3] Convert RGB image to grayscale using CImg library. http://sorj.de/?p=168
[4] The Cog Shop. “Motion Detection and Segmentation.
http://www.ai.mit.edu/projects/cog/VisionSystem/motion_detection.html
[5] Robot Platform. “Hobby Servo Motor Tutorial”.
http://www.robotplatform.com/knowledge/servo/servo_tutorial.html
[6] Standard RC Servo Signal.
http://upload.wikimedia.org/wikipedia/commons/7/7b/ServoPwm.png
[7] Servo Protocol. http://www.rcheliwiki.com/Servo_protocol