Enemy Tracking Gun (The Dead-Eye)

The purpose was to come up with a working model of an automated enemy tracking GUN. We used a red tag as an enemy identifier. And here is the result that you may see in this video.

 

 
 

DEAD EYE is an automated gun project in which a real gun movement can be controlled from a distance and fired. There is a camera mounted as a scope of the gun. The video is used as a feedback to control the movement of the gun. Based on the image anyone sitting on the computer can decide whether or not to shoot and where exactly to shoot without even holding the gun. Moreover the gun can also auto-target objects using image processing. This is achieved by the RF link between the gun movement control unit and a computer.
This idea if properly implemented for security purposes can help save lives of guards, army personnel and policemen. I would use this simple block diagram to illustrate my concept.

1 This actually means that we don’t carry a gun while holding it, rather we would be monitoring the gun movement on our computer and a click would be translated into a real trigger press at the same time. This would actually be helpful in a lot of occasions that I would mention further. This could give guards or army men a lot of time to react to any critical situation while they won’t be at personal risk at the first attack. And most probably, they could deactivate the threat the first time it attempts to react violently.
This is an inspired version of some movie clips and other projects, but the aim was to make a cheap product from Pakistan that is beneficial for our law enforcing agencies once it reaches its implementation stage.
DEAD EYE consists of a software part and a gun mount. The software could be for a laptop or a PC depending on the conditions for its intended use. The gun mount (mechanical part) would have a wireless camera to it that provides the feedback. The user on the computer end would be monitoring via this camera and make decisions based on it. There would be some auto functionalities included that could be object detection, object tracking, sentry gun etc. These could be extended to targeting and then wireless controls over the internet so that global access can be provided.
The DEAD EYE could be helpful in various occasions. Army personnel can use these instead of initial trooping in any fight scenario. The snipers can use this at some distance as an aid to their mission. And the best of its application is the life saving of guards at security check points. If a thread is determined, shooting decisions can be made from a safe distance if the area is in threat of a suicide attack.

have simple single instructions and the programmer has to tell (dictate) each and every step to achieve the final outcome.

    As explained previously the user interface of the ‘Dead Eye’ uses OpenCV.  A camera is mounted on gun so that when gun moves camera moves with it.  The user interface consists of a Camera Window that displays live video feedback from camera along with cross hair as shown in the figure.

    2 

That camera is aligned so that the centre of crosshair is where the gun is targeting. In the software part each frame is accessed from the camera one at a time. Then using some OpenCV functions a crosshair is drawn at the centre of that window by calculating the dimensions and width of that window.  After that there are two modes in the software part. Mouse tracking and objecting.

TRACKING WITH MOUSE:-

After generation of crosshair mouse listener function checks for any mouse movement/click. If any movement or click is detected a mouse call back function is called. This function stores the coordinates of mouse and any click/key pressed at that location and compares them with mouse position in previous frame thus giving us the magnitude of mouse movement.  These coordinates are stored in variables and sent through serial port over to the RF transmitter. In case of no mouse movement some data in still transmitted indicating no movement.  The data consists of 3 bytes. One indicating X coordinate, one Y coordinate and one indicating any click or key presses. After that the next frame is loaded into memory and process carries on for each frame in a loop. That serial data is received by microcontroller and PWM and encoder signals are generated for each motor accordingly hence moving the gun and camera.

AUTOMATOC TARGET TRACKING:-

In this mode a crosshair is generated in a similar way. The whole frame is stored in memory in RGB format. The software then divides the whole frame into several 5x5 pixel areas and applies a filer which detects red pixels. If the concentration of red pixels crosses a threshold it marks it as red area and draws a tiny circle around it indicated a detected area. Similarly whole frame is scanned for red pixels. A red object is going to have several red pixel areas as indicated by circles in the figure. Then the centroid of red areas is calculated and X and Y coordinate of that centroid is compared with current crosshair position and sent through serial port, the same way mouse coordinates are sent in mouse tracking mode. The same process is carried out in each frame of the video sending coordinates of the target by taking feedback from the camera, enabling the gun to autotrack the object in real time.

3Here is an overall schematic of our project, each part is then further explained. This is our actual final implementation and the necessity of DEAD EYE as well.

4 In the initial stages, we were unable to transmit through this module, the reason was mainly that these modules don’t come with a proper data sheet and circuit diagrams. Then we had a hit and trial method and finally we were able to transmit serial data wirelessly.

  1. The first way was to just use it as the circuit diagrams shown and the pin names suggested. We used a USB-RS-232 converter and tried the circuit and then the signal received was in mill-volts as compared to a 5v transmitted signal. This was certainly no acceptable.
  2. The next way was to use a PC’s Serial Port and then the same configuration but the results were the same even on a 12V Transmitted Signal that is from a PC’s Serial Port.
  3. At first in the forums etc. It was mentioned that this module is excellent without an antenna at small ranges and also where there are no hindrances, but we then tried it out with a laptop and a USB-RS232 converter along an antenna and the results were better, we were getting a 1V signal but not as we wanted. The antenna for 433Mhz was of 17Cm in length.
  4. The next experiment was indeed refreshing for us and that gave us excellent results i.e around 3.8V Received Signal as compared to a 5V transmitted. Now this was done by a rather simpler approach, i.e an antenna mapped to the module, the serial port from a PC and then an MAX-233 before the Transmitter.

The issue with this configuration was glitches, unreliability, noise increments as the temperature rose and a reset was also required timely.

  1. The next was the use of 2 ICs that were a bit expensive as well with the previous configuration.

The HT 12E Encoder ICs are series of CMOS LSIs for Remote Control system applications. They are capable of Encoding 12 bit of information which consists of N address bits and 12-N data bits. Each address/data input is externally trinary programmable if bonded out.
The HT 12D ICs are series of CMOS LSIs for remote control system applications. This ICs are paired with each other. For proper operation a pair of encoder/decoder with the same number of address and data format should be selected. The Decoder receive the serial address and data from its corresponding decoder, transmitted by a carrier using an RF transmission medium and gives output to the output pins after processing the data. Compatible with RF Modules 433 MHz.

Serial Communication Block 

As explained in the PC part, the computer sends 3 bytes of data in every frame of video through serial port over an RF link. The microcontroller receives those 3 bytes of data.One byte represents mouse movement in X axis, one for Y axis and one represents clicks/keys pressed. The magnitude of number is directly proportional to movement of mouse in respective axis.   For example if the mouse moved 10 pixels in X direction and 2 pixel in Y direction. It will transmit 10,2,0 to the microcontroller. The actual data received it at a rate of  (3 x framerate/second).

Here is the schematic of the Serial Port along with a MAX233 implemented physically on our final board.

5 The PID Controller was implemented by the microcontroller in DEAD EYE. The block diagram can make things easier to understand that is as follows:

6Its easy to get the basic idea of this part that how is the microcontroller acting. Actually the PC sends data via RF link and then the microcontroller generates the desired PWM and sends it to the H-Bridge which in turn powers the motors. Now the best part is that the encoders send pulses back to the microcontroller as feedback and then the actual motion of the motor is sensed and then again the microcontroller pulses the H-Bridge and in this way an accurate control system is established.

An H-bridge has been well explained in the previous chapters, but there is something new to the one we implemented finally, the limit switches. Now these were needed as we have to limit the motion of our gun to as far as a naked eye’s vision can see. If a switch doest short the ends, the respective side of the H-Bridge would not find a groud and hence limiting its motion to that side. The limit switches were fixed physically at locations so that the mechanical structure isn’t affected in case of false PWM Generation. Therefore the normally closed switches and the final H-Bridge is shown below

7A digital optical encoder is a device that converts motion into a sequence of digital pulses. By counting a single bit or by decoding a set of bits, the pulses can be converted to relative or absolute position measurements. Encoders have both linear and rotary configurations, but the most common type is rotary. Rotary encoders are manufactured in two basic forms: the absolute encoder where a unique digital word corresponds to each rotational position of the shaft, and the incremental encoder, which produces digital pulses as the shaft rotates, allowing measurement of relative position of shaft. Most rotary encoders are composed of a glass or plastic code disk with a photographically deposited radial pattern organized in tracks. As radial lines in each track interrupt the beam between a photo-emitter-detector pair, digital pulses are produced.
The most popular type of encoder is the optical encoder, which consists of a rotating disk, a light source, and a photo-detector (light sensor). The disk, which is mounted on the rotating shaft, has coded patterns of opaque and transparent sectors. As the disk rotates, these patterns interrupt the light emitted onto the photodetector, generating a digital or pulse signal output. A similar disk was mounted on the rear axle of each motor. Its shown in the figure below and similar to the approach we used in our structure.

8 

 We designed the encoder ourselves using a (commonly known as) U Shape Infrared Sensor in series with a resistor and a Pull-UP resistor. Below is its PCB Layout :

9

THE 1st Protype:
As mentioned in the previous chapter, we were using power window DC motors and therefore we made a simple and light mechanical assembly for the project. The material used was ACRYLIC and that was as it had DIY capabilities. It had a low height base and a strong Y-Axis as well. But due to the change in motor selections, the whole mechanical structure had to be revised.

10

THE FINAL STRUCTURE:
There was a lot to be done as the time lines were getting tougher and tougher but we had to cope with it. As soon as the motors were bought and tested thoroughly, we realized that a strong and long lasting mechanical structure shall be designed that has the capabilities to work further and beyond this project as well. Therefore we shifted to metal and there was Iron, Steel, Aluminium, Cast Iron, Plastics and all sorts of nuts and bolts used for the completion.

The Base
This design was indeed a challenge in itself but it worked pretty well. The base has the ability to rotate 360 degrees clockwise and counter clockwise. It can be limited to design it for any specific application. Therefore we limited it to 180 degrees as that is what a human eye is capable of.This was designed using simple mechanics and the structure could be repaired as well (if anything goes wrong). That means that it was thought before for errors.

The first step was to create a base sheet .3 inch wide of iron in dimensions of 20inch by 20inch. There were wheels below and handles on it for easy carriage of the structure while working on it. This was chosen so that weldings could be done on it later. Then the motor holding plate along with the rotating pulley was made out of cast iron. After this the appropriate height was given to the plate and then wheels to be equal in height to the pulley were lifted using Steel Bars and all this is illustrated by the picture below:

11

The Top Part
The next step became to feel critical as there was further less time remaining. Then we first made an aluminium sheet of 19 inch in diameter. Then a steel plate of 3feet by 1 feet was taken. 1 feet on each side was bended at right angles and then it was cut in between for weight reduction. Its illustrated well in the picture. Then the tops ends of the bended plate were fitted with ball bearings and then an iron bar was fitted in it for rotation.

12

Finally the motor and the gun was mounted and the structure was complete. This was done well in time.

13

 

Contribution: Saad Ali, Wasif Ali, Dilshad.

Contact: saad.xt@hotmail.com