Saturday, November 6, 2010

A Microcontroller based Interrupter Gear






Figure 1: The hardware

During World War I and slightly before World War II, military fighter aircraft had machine guns mounted to fuselage of the plane. These machine guns were mounted right behind the propeller. The first question that comes to mind is how can the gun fire and not hit the propeller blades as they are spinning? Some planes had special steel plates mounted to the propeller to keep the bullets from shredding the propeller.


Figure 2: A machine gun shooting through a propeller.

(I had fun with this one. Sometime, I should use a color other than black and maybe draw some wings)

There are a couple of reasons hitting steel plates in the propeller is bad. First, it introduces a physical shock to the propeller. Not good if you would like to remain in the air. Second, it adds weight to propeller; there by slightly reducing the max RPM of the propeller, making the plane go slower. Third, it wastes bullets. You would like all of the bullets to go out into the wild blue yonder.

Most planes of the day used something called an “Interrupter Gear” to time the firing of the bullets between the blades of the propeller. To see much more information on the Interrupter Gear, check out this link:

http://en.wikipedia.org/wiki/Interrupter_gear

There is a nice drawing on the page showing how the cam wheel and cam follower worked inside of the planes. So, this was done mechanically in the 1910’s to 1930’s.

My first thought was this could be updated by using a microcontroller coupled with an infrared sensor to sense the position of the propeller? Doing the project in small scale significantly lessens the chance of bodily harm, which is just awesome. The gun I used is an Airsoft pistol. For those of you unfamiliar with Airsoft pellets and guns, they are a family of plastic guns that shoot a plastic pellet. You can think of it as a miniature version of paintballs, except the pellets do not explode when they hit you.

The hardware

The pistol I originally chose for the project was battery powered and semi automatic. (A semi automatic pistol fires a pellet each time the trigger is pulled until the clip is empty) The problem I ran into was when a solenoid pulls on the trigger; a DC motor inside of the gun starts to compress a spring inside of the gun. Once the spring is fully compressed, the “hammer” is released and the gun is fired. It took about a second for the spring to compress. When you have a propeller that is spinning at 500 RPM, that is 8.3 revolutions per second. (500 RPM / 60 seconds = 8.3) There are two blades on the propeller I am using. The one-second delay between activating the trigger and the pellet firing was a showstopper.

The second pistol I used was a spring loaded Omega M650. This gun can send a pellet out of the barrel at 100 feet per second. The top has to be pulled back by hand to cock the gun.

Figure 3: This is the Airsoft gun used in project

The really nice thing is it takes only 20mS to 22mS from the solenoid on the trigger being activated to the pellet leaving the end of the gun. The pellet was detected by using a Sparkfun infrared sensor. This is how I determined the delay: Probe A on the oscilloscope was attached to the signal going to the solenoid. Probe B on the oscilloscope was attached to the IR sensor output at the end of the barrel. The oscope was setup to trigger once on Probe A. When the trigger was pulled by the solenoid, I could see a blip on the oscilloscope screen:


Figure 4: This blip is the pellet leaving the end of the gun.

If the propeller is spinning at 500 RPM, we know it takes 120mS for one rotation to occur. (60 seconds / 500 RPM = 120mS or 0.12 seconds) Since there are two blades, we’ll be seeing a blade every 60mS. Since the delay between activating the solenoid and the pellet leaving the gun is at maximum 22 milliseconds, we have no problem placing the pellet between the propeller blades.

Is the microcontroller even needed?

My thought process when I started the project had the microcontroller setting the delay between when the propeller is sensed and when the gun should be fired. If we use logic gates to immediately fire the gun when the button is pressed, this will work great unless the time between sensing the blades is 20mS to 22mS. Also, if the propeller blades are at multiples of 20mS to 22mS the pellet will hit the blade. So, it looks like a microcontroller is needed to dynamically set the delay for the solenoid.

A way to test the delay between the propeller and when the gun should fire is to setup a red LED to turn on when the pellet should be coming out of the gun. An excellent way to do this is to setup the LED so it is 90 degrees away from the propeller sensor and gun. The LED can turn on and you can see the reflected light on the propeller.


Figure 5: Infrared Sensors and the Solenoid

Once the software was completely working, I ran 20 pellets through the gun to see if any pellets would hit the propeller blade. None hit the blade. A better test would be to modify the software slightly to see if I could get the pellet to hit the spinning propeller every time. So, I added into the software a define statement “defHitTheBlade”. If you want the pellet to the hit the blade, remove the comment “//” at the beginning of the line. The pellet would hit the propeller about 4 out of 5 times. It was hard to find the pellets after they hit the propeller.

Each blade on the propeller is 0.5 inches wide in front of the Airsoft gun. The gun is 1.15 inches from the axis of the propeller. So, if we use Circumference = 2 * Pi * radius = 7.2 inches. So, we can figure if a blade is in front of the gun for 1 inch / 7.2 inches = 14 percent of the time.

The software isn’t too complicated. When the user presses a button, the analog comparator interrupt counts the time (using Timer 1) between the propeller blades passing the infrared sensor mounted under the gun. Once we know how fast the propeller is going, the software then looks for analog comparator interrupt and counts 1.5 times the time between the blades, minus the time it takes the pellet to come out of the gun.

The circuit was created on the solderless breadboard. Three power supplies were used. A 5V wallpack for the microcontroller, a 24V power supply for the solenoid, and a variable power supply for the DC motor (1 to 3V).

Figure 6: The schematic for the Interrupter Gear project

Overall, circuit worked well. Trying to hit the propeller with the Airsoft pellets was fun, it really let me know the system was working. Onto the next project… (the next one should be a little more practical)

Here is the source code for the microcontroller:

AVRGCC C source code

5 comments:

  1. interesting area. is it working

    ReplyDelete
  2. sir your interrupter gear is very interesting we want to do it so we here for to request you what is the connector(labled as j1) number and the mosfet number & diode used in the circuit and also kindly spare some time to explain the output to solenoid. it is very urgent please respond to my request as early as possible...

    ReplyDelete