Author Options:

Linear LED ammo Counter? Answered

So, my friend and I are building a Coil Gun!  Nothing super powerful, but it will punch a nice hole in a cardboard box.  Here's the problem; we want to add an ammo counter to it.  We were thinking of using an IR LED, a Photo-transistor, and a voltage comparator circuit, kind of like the one here (http://home.cogeco.ca/~rpaisley4/PhotoDetectors.html , first photo, right circuit)) .  The circuit would send a pulse when the projectile interrupted the IR beam. Now what?  The magazine holds 6 rounds, so maybe 3 green LEDs, 2 yellows and 1 red to count the ammo.  We were thinking of maybe using a 4017 counter IC to advance down an LED after each pulse, but doing it this way means only one LED is lit at a time.  We would really like it if somehow we could have all the LEDs lit, and after each pulse one would turn off, but I'm unaware of how to do this.  Oh yea, we don't have access to a micro-controller, which is why we have this problem.  So to recap, we need a circuit that will light 6 LEDs when powered on, then shut off one LED for each pulse received.  Is there any way to make a circuit that does this?


This is the circuit you want.

It starts with all six LEDs on and turns them off one at a time every time something passes between the IR or UV LED and the phototransistor.

Then you hit clear and all six LEDs are on again.

It is called a modified Johnson ring counter.


That's perfect, lets see how I can implement it. Thanks!

I have something like 100,000 components at my disposal.

If you give me your power supply specks I can build the circuit on a bread board and test it for you.

Saves you from buying components for a test circuit.

What are you making the barrel out of?

I have built several single stage coil guns and now I am building a multi stage coil gun with a rotating EM field based on a Fibonacci series firing sequence and timing.

I got some free 3D prints from the 123D group and I designed this barrel, action, and magazine.

Made out of plastic I don’t need to worry about eddy currents.

What do you think of my gun core?


That core looks AMAZING! I wish I could make something like that. Our barrel is a plastic pen tube, nothing fancy at all. Our power supply is a 12 volt battery.

I got the 3D prints by joining Autodesk 123D group here at Instructables; the core took about 6 months to come in.

My target velocity is 1200 feet per second.

Here is something I found out from the coil guns I built, make sure you have air vents in the barrel behind the projectile. As the projectile travels through the barrel it creates a vacuum behind it and a plow wave in front of it slowing the projectile down. In my barrel assembly you can see where I put air vents between the sections of the barrel and in the action assembly to allow air in and out of the barrel to aid in the projectiles movement.

Ok so your power supply is 12 volts.

The D flip flops run on 5 volts so the circuit will need a voltage regulator.

I’ll whip together a circuit on a breadboard and get back to you in a couple days.


I built and tested this circuit a number of different ways using SN74LS74 and SN74LS175 ICs.

With SN74LS175 ICs the circuit is smaller and uses 2 ICs and 20 wires less than building it with SN74LS74 ICs.

It works the way you want turn on the circuit and all the LEDs turn on, if all 6 LEDs do not come on press the reset button and all the LEDs will turn on.

Every time you pass an object between the IR LED and the Phototransistor, one LED turns off at a time until all 6 LEDs are off, then when you press the reset button all 6 LEDs turn on.

If you pass an object between the IR LED and the Phototransistor a 7th time or more and the LEDs start to turn on.

If you need a place to get the ICs you can get them at http://ca.mouser.com/search/Default.aspx

For the voltage regulator just enter 78M05 in the search box.

You can get the datasheets at http://www.maxim4u.com/

This is two different ways to wire the circuit.


1. Proto board

1. IR or UV LED

1. IR or UV Phototransistor

1. CJ78M05 voltage regulator

1. Push button switch

1. 220 uF 16 volt electrolytic capacitor

1. 10 uF 16 volt electrolytic capacitor

2. SN74LS175N D Flip Flops

3. 1N4001 Diode

6. LEDs, 2 red, 2 green, 2 yellow

9. 1 KΩ ¼ watt Resistors

Liner Counter 5.JPG

Ok, here's a tutorial: replace the Arduino with your sensing circuit (unless you want to use an Arduino), and the bar graph with your discrete LED's.


I'm not understanding, how would replacing the Arduino with the optical trigger circuit make it work? The trigger would only send out one pulse when one projectile is fired. Thanks for replying, I'm probably just not seeing something.

Use persistence of vision to trick your eyes into thinking more than one light is lit at the same time by lighting up all the relevant ones in a very fast sequence. I don't have time to describe how to do that fully, but you'll need a counter and a clock signal. Each clock cycle increments the lights until you reach your capacity, then the reset is pulsed to start it again. This happens at high frequency, and works on the same principle as cartoons.