How to Make a Coil Gun

Did you always wish you had a gun? Well just make one for yourself!

Somewhere in the video I mentioned it was a “Rail Gun”, but it is actually a coil gun. They both work with magnetic force, but differently.

Here I describe the detail design of the coil gun, so you may turn away if you hate details:

Basically as we all know, when we turn on or energize a coil, it starts attracting ferromagnetic material, in my case a steal bullet I made.

The issue is that if we keep the coil on, it keeps attracting the bullet. So what happens is that the bullet accelerates towards the coil and as soon as the magnetic center of the bullet reaches the magnetic center of the coil, the force of the coil over the bullet becomes zero. But as the bullet has momentum, it passes the center, at which point the coil starts pulling it back and decelerating the bullet, or accelerate it back towards the center.

You see in the video that this results in the bullet oscillating as if it was attached to a spring, and eventually stops at the center.

So the best way to make sure the bullet reaches maximum speed is to turn the coil off as soon as it reaches the magnetic center of the coil. If the coil and bullet are both symmetrical, their magnetic center will be the same as their physical center.

There are two ways to do it: one is to perfectly time the turn-off moment of the coil, or another easy way is to use a sensor and detect when the bullet reaches a sweet spot to turn the coil off.

In some designs they just use capacitors and discharge them in a coil and the capacitor runs out of charge quick. This way the coil won’t have time to pull the bullet back, which is sort of like timing the coil.

The problem with all the timing designs in my opinion is that it is not possible to easily predict the required time to keep the coil on, as it depends on the bullet mass, coil field, original distance of the bullet from the coil and etc… and therefore the coil either turns off too early or too late, both resulting in a slower bullet.

So I believe to make the on time of the coil independent to all these factors, the best way is to have a sensor and detect the location of the bullet and turn it off on time.

In my design, to turn the coil off I placed an infrared (also known as optical) sensor to detect the tip of the bullet right where their centers meet, and this would turn the coil off using a simple circuit.There are other options for the sensor such as Hall Effect sensors, which can be much faster. You need a fast response time as any delay in response will cause the bullet to pass the center and result in some deceleration. Especially when you have many coils rather than one, the speed of the bullet in the final stages is super fast.

The following circuit is what I designed and made.

Circuit Schematic of the Coil Gun

Circuit Schematic of the Coil Gun

In the circuit above I have added D1, which I forgot to show within the video. Not having this diode caused me grief and explosions which I didn’t capture on video!

This circuit is just a quick way of doing it for demonstration that came to my mind. It is by no means the best way to do it. Especially since the infrared sensor I have has limited response time (3kHz).

I purchased the parts from Digikey and here’s their part numbers for your reference (you may choose your own):

OP1: EE-SX1070 from Omron
Q1: IRF7739L2TR1PBF from International Rectifier
Q2: Generic 2N3904 NPN Transistor or similar
D1: Generic Schottky Diode Capable of >30V, >10A
SW: Generic push button, normally open
R and C: Generic
L1: Hand wound

Here’s the circuit description:

Q1 transistor is basically the switch that turns the L1 inductor on and off. When Q1 turns off, L1 will try to release the energy stored in it by continuing the current in the same direction. Without D1 this would cause the voltage at the drain of Q1 to jump to a huge number breaking Q1 and shorting it. This will short the supply through Q1 and will result in exploding Q1 and damaging the coil. Having D1, when Q1 turns of D1 turns on closing the loop of the current and protecting Q1. Another side effect is reversing the magnetic polarity of L1 that could help accelerating the bullet.

When the switch SW closes, it sends a high level voltage through the 1uF capacitor to the gate of Q1 turning it on. The 1M ohm resistor will help discharging the 1uF capacitor.

OP1 must be biased such that when the sensor is not blocked, the transistor output is at a low voltage below 0.4V to make sure Q2 is off, and when the bullet comes into the sensor blocking the infrared light, the optocoupler transistor output jumps above 0.7V turning the Q2 transistor on.

So Basically when the switch SW is pressed, the gate voltage of Q1 jumps, turning it on. This will attract the bullet into the coil and as soon as the bullet reaches the sensor, Q2 turns on pulling the gate of Q1 low and turning it off.

And it works as good as you saw in the video. There are some issues with this design though. If there is no bullet inside and the trigger is pressed, the gate voltage of Q1 drops as the capacitor at the gate is discharges by the 1M Ohm resistor. At some point this results in increment of the Q1 drain-source resistance, meaning a high power drop across Q1 that will blow it up. So there should always be a bullet. We can’t remove the 1M Ohm resistor because without it the gate voltage may never return to 0 volt.

Like I said, this circuit is only for demonstration and a better and faster circuit could work much more reliably. But the functional concept remains the same.

Now more coils can be put together in series, everyone with its own fast sensor. The bullet can be smaller and more light weight to help accelerating faster. Also there can be different ways to turn the series coils on and off. For example:

- They can turn on and off one at a time, as soon as the first coil turns off, the second one turns on and so forth.

- They can turn on two at a time. For example if we have 4 coils from L1 to L4, L1 and L2 can turn on together. As soon as the bullet reaches between L1 and L2, L1 turns off and L3 turns on, This way there can be better acceleration, but more power usage.

- All coils can turn on together, but turn off one at a time as the bullet passes them.

And the rule of thumb is: the more number of winding and more power over coil (voltage and current) the greater acceleration of the bullet. Also of course turning the coil off at the perfect spot is very important too.

I hope you like what you read. If not, please drop a comment and I will write some update when I can. Thanks and stay safe!

95 thoughts on “How to Make a Coil Gun

  1. Hi Mehdi, I’m a high school student competing in a science fair, and you inspired me to build a coil gun for my project. I’ve managed to get a one stage coil gun working off of a capacitor, but I think the way you do it (with a constant flow of electricity that is turned off by an infrared sensor) is a better alternative. Is there a chance that you could tell me the part numbers of the components you used to wire the infrared sensor? I would really appreciate it. Thanks

  2. Hi Mehdi,

    Your video is amazing!
    I tried to use a car battery (12V) for a coil. It blew up. I think the coil resistance is too low (0.3 Ohm). I’m ordering two resistors, 10 Ohm (72W) and 20 Ohm (50W). Do they work? What else should I take care?

    Regards, Jeff

  3. Hi,
    I’ve searched over the internet and through my Physics E&M equations for any kind of relation between the B field and the force on an object of mass and cannot find any.

    I know…
    B = u(N/L)I
    …but once the strength of the field is determined, are there any other equations that theorize the force the field has on an object other than a point charge?

    Also, if you can (and want) can you share your B value for your coil gun?

    Thank you

    -Decoda

    • F=u*(dB/dx)

      where
      u is the magnetic moment of the projectile.
      dB/dx is the rate at which the magnetic field is changing along the x axis.

      and,

      (dB/dx) = – (I*pi*6*10^-7) (x*R^2*N) / [(R^2 + x^2)^(5/2)]

      where
      x is the position of the projectile along the x axis
      I is the current
      R is the radius of the current loop (the coils)
      N is the number of coil turns

      Note that this formula is designed for a coil of a length (L) of 0, but if R>>L, then this won’t give us any problems. But if R<L, then we should take the origin (x=0) to be somewhere close of the end of the coil. because this is where dB/dx will not equal zero

  4. Can we put an another coil over the shooting coil an check the magnetic changes and detect the bullet without an ir sensor? Will it work?

    • It might be possible. I haven’t done that though. One needs to set it up like you say and measure the sensing waveforms and see if they make sense. But if that works, it could be better and faster than the IR sensor.

  5. Hi there,

    Is it possible to channel the energy stored in the coil to the next coil, instead of just let it go with D1?

    Thanks!

    • It is a possibility to salvage some of the energy. But it will probably make the circuit much more complex for a little saving.

      • Thanks!
        Another question, if I don’t want to use a big power source, and get low current, could that be “countered” with increasing the number of windings on the coil?

        Hilarious videos, by the way :D

        • Thanks!

          Yes you can. B, the magnetic field has a direct relation with N (number of turns) and I (current): B ~ NxI. Check this page on Wikipedia:

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

          So if you want to reduce your current from 100A to 10A, you need to increase the number of your turns by 10 time. You can choose thinner gauge wire and possibly achieve the same coil size, but smaller current.

  6. Great video, once again.

    Can you explain the physics behind why the bullet will oscillate? Why does a projectile get pulled towards the center of the coil?

    • To clarify, I just don’t understand why the bullet will want to go back and forth. I assumed there is a magnetic field in one direction only, and the projectile will simply just exit the coil. But I’m clearly confused about something.

      I made a coil gun. Used a full spool of magnetic wire, and put a small projectile in it. The projectile still flies out of one end, however, if I were to put a longer object in, it will probably oscillate like yours did (right?). Meaning, the small projectile I put in gets decelerated in the second half of the coil, but it’s initial acceleration is much stronger, which results in it leaving the coil.

      To summarize, why does the projectile want to be pulled towards the center? Can this be explained by some sort of physics law?

      • It is a simple thing. A magnetic field only pulls on a plain iron projectile. Same as the gravity that only pulls. So if your coil remains on, it continuously pulls the iron projectile. There is a center to the magnetic attraction, similar to the mass gravity, which is where the sum of all the magnetic forces is zero. For a uniformly shaped coil the magnetic center is the same as the physical center of the coil. The projectile accelerates towards the center as the sum of forces on the projectile is always a vector towards the center as long as the projectile is not at the center. as soon as it reaches the center, there is no force on the projectile, but the projectile will continue due to its momentum and passes the center, where the force vector is again towards the center. So the projectile will slow down, stop and go back towards the center and this is the cause of oscillation, similar to having a weight on a spring and pulling on the weight and watching it oscillate. There is friction that wastes the projectile energy and the oscillation gets smaller until it stops at the center where the sum of forces is zero.

        Now in your case, the projectile exits on the other side, because I believe your coil is not continuously on and turns off and lets go of the projectile. If it turns off right where the projectile is at the center, that is the maximum acceleration and otherwise if it turns off earlier, it speeds up less than it could, and if it turns off later, it gets pulled back and slows down.

  7. Is theoretically possible a variation of coil gun, where the projectile has diamagnetic properties (material reppelled away from magnetic field) ? I guess in that case projectile must be put litlle bit inside a coil first and a number of windings at the begining of the projectiles trajectory must be the biggest. then with lesser mumber of windings through the coils length to achieve smaller magnetic field
    Coil would become sort of cone shaped because of that. I assume there would be no need for sensors

  8. So my cousin and I are attempting to build a coil gun. So far we have built a small coil of 40 feet 22awg wire across 2 inches. We are powering the coil with 6 21000 microFarad 16 volt capacitors in parallel. Our current setup is working just enough to pull an iron nail and fling it about 1 foot away. We thought this was a little to week so we went on youtube to check around and found your little gun and were shocked at how effective yet simple looking it was. We were hoping if you had any tips to help us make ours more efficient.

    • Your capacitors likely won’t be able to hold the voltage long enough. Assuming the current is 10A fixed through the coil, and starting at 16V, the voltage drops to 0V within 0.2 seconds.

      But if your nail is small enough the amount of energy might be enough. Then there is another issue, maybe the nail moves too fast and passes the center of the coil before the capacitors are fully discharged. If the coil is still energized, it will suck the nail back in, or at least slow it down. That’s why I use a sensor to turn the coil off in time.

      • Thank you so much for responding! In the case of capacitors then what should we upgrade to? should we look for a higher capacitance or voltage or both? we are looking in to timing the coils duration with an arduino.

        • The key is the amount of energy you can feed into the coil. The energy in a capacitor is 0.5 x C x V^2. So raising the voltage and capacitance raises the energy in a capacitor. Of course is also means a greater burst of current. I have seen people use many “Flash” capacitors, the kind used in cameras for flash. They can be charged some where around 300V. Get many disposable cameras with build in flash, take all their capacitors and parallel them up, and use one of their flash circuits to charge the entire pack. It may take much longer for the circuit to charge the whole thing up to 300V. When done, discharge it over the coil for a great impact! Just don’t touch the capacitors, they will shock you badly, that is if you survive!

          • Ha thanks you very much for the tip and the help you have given us. We will try and put it to good use.

      • Could then this be stated as some kind of parallel LC circuit with its own resonant frequency? And to go further, can I make elektromagnetical- mechanical (Cycloid )pendulum if I curve the tube of the coil? Of course then I should match elaktromagnetical resonant frequency with the mechanical resonant frequency of the “bullets” cyclodial path for greatest efficiency.

  9. I’m using a big capacitor to supply the current and plan to charge it to several hundred volts. Can I use a boost converter to charge it? If so, should I include a series resistor on the charging side to limit the current through the inductor?

    • Yes, you can use a boost converter. Several hundred volts is a lot of volts. I assume the capacitor is not huge, is it? You don’t need a series resistor. If you adjust your booster PWM, it will provide a fixed current every period to charge the capacitor. But you must have high voltage components all over. Good luck!

  10. Fantastic videos and humor – keep it up – you are the best!

    just an observation:
    I doubt the optical sensor is slow for this application. I think the magnetic field in the coil decays slowly after shutdown especially with the necessary D1, that current keeps flying around the coil as a coil does not like changes in current (just like your Capacitor doesn’t like changes in voltage). There is no way of shutting down that current as it will cause several KV on the Mosfet -you must have blown many as these are rated at 40V and you didn’t have D1 in your video!

    One hack would be to wind another coil and place it on the output of the first coil but wound the other way so its NS is flipped from the first coil and wire this one between D1 and V1. Therefore the flyback current of L1 will flow through L2 and negate the decelerating power of L1!

    More fun videos please you are a genius!

  11. Hi Mehdi,

    I’m trying to make a coil gun, and before i start, i just want a little advice. For instance;
    1)How do you make the IR sensor?
    2)How many volts of electricity did you supply for the coil?
    3)How did you make the bullet?
    4)What is the length of the bullet and the coil?
    5)If you put a barrel around the coils, does it have to be insulated?

    I will be extremely gratefull of youre reply.

    • 1) you buy the IR sensor, not make it. Then you need to bias it properly. It is like a transistor, for a certain input current you get a certain output current. In normal condition the output is on, or like a switch it is closed. Then when something like a bullet goes in there, it opens.
      2) I put 30V I believe, but that is not as important as the current I supplied, which was 70A or more.
      3) I machined it in the machine shop at work.
      4) the coil is around 4cm and the bullet is about 5cm in my case. It is not mandatory though.
      5) you don’t need to isolate teh barrel, just make sure it doesn’t short anything!

      Good luck

  12. Dear Mr Mehdi,
    with your permission, i would like to make this my control and measurement lab project. if you can please mail me your address so we can talk about ways to modify this design. i hope to have your reply soon.

      • thank you for your reply, i was not asking you to do my project. but hoping you would give me some advice on how to make it a little more complicated.

        • You can make it exponentially more difficult by just adding a second coil to it! The third one would even be harder! Good luck.

  13. i am trying to build this coil for a gun and for door locks and i have wrapped 16 awg magnet wire around pvc with a 1/2 inch hole and bullet size i have used six 9-volt batteries in series trying to get any kind of magnetic pull on the bullet i have even tried supplying power to my 3 pound spool of wire and still no magnetic pull of any sort have been working on trying to get this work for a couple days and i am at wits end i dont know what im doing wrong please email me with some help i would greatly appreciate it thanks

    Keaton

    • Hi Keaton,

      First, 9V batteries cannot generate any decent current. Imagine I was using 70A, and the 9V battery can maybe generate 0.5A at best. If you instead use a car battery, you will get a huge pull, and maybe your coil burns too because those can generate even 500A. One thing you can do is to have a huge capacitor parallel to your 9V batteries so that the capacitor can handle the short spike of high current. Use camera flash capacitors. If you like to move a door lock, you don’t need great pull and acceleration. Then use many more turns of lower gauge wire and then you can generate good pull with much lower current.

  14. If I wanted to test the affect of varied voltage to the final speed of the projectile, where would be the best place to vary the voltage and by what means?

    Thanks

    • You should vary the voltage across the coil. Basically it is the current that creates the magnetic field. The amount of current also depends on the voltage across the coil, the coil and switch resistance.

  15. Pingback: Video tutorial: come costruirsi una pistola in casa | cose strane

  16. Hello, I just came across a startling video that had me quite speechless upon watching it. Now I admit it, I didn’t fully understand this video as I’m a physician and electricity is not my field of expertise, however I do know enough to realize this is not a hoax or bogus and has in fact validity… and I could not think of anyone better than you to send it to… surely you might enjoy watching this video… god speed

    • Hi Saviz,

      All I can say is that this person has little knowledge of electricity as most of his comments don’t make sense electrically. It is possible to capture ambient energy, but this circuit is not the way to do it. Also beside sun’s light source and wind (which is also created thanks to the Sun) all other ambient energies radiated in the environment are extremely low in energy. So, there is no secret in this circuit!

    • That’s a complicated problem. The optimum time you want to keep the inductor on would depend on the length, thickness and weight of the bullet as well as the current flowing into the coil, the resistance of the coil and many more things. A relay won’t be fast enough for multiple coils. Relays switch around 10 mS and that would decelerate the bullet.

  17. You are correct. And there is an RC on the gate of the transistor, the 1uF capacitor and the 1M resistor. It does what you say, but it may turn it off too late. As I said, this circuit is not the best, but good enough for presentation.

  18. Hello Mehdi, I love your videos and I hope you continue to make more. Informative and hilarious! As I understand it, you must have a bullet or else the coil will never turn off, which will cause damage to the rest of the circuit via over current. Would it be feasible (or wise) to attach an RC circuit to the base of Q2, causing it to turn off no matter what after a certain time? To be clear, could you have an RC circuit charge up when SW1 is pressed, but programmed in time that it would turn off the coil a little after the bullet should have passed? Just a thought, I am still very much learning.

    • It’s not a Zener, it is a schottky diode. schottky diode is fast and will respond quick to spikes avoiding the transistor to break.

  19. Would a hall effect sensor work considering the magnetic field created by the coils? I would think there would be too much interference for it to be effective at detecting the bullet

  20. Hi! i had a question! in what direction do u mount the capacitor? i know its ah neerdy question but i dont wont to blow it up! i think the minus side right when i look at the drawing or not?

  21. Pingback: Watch This Man Shoot And Electrocute Himself As He Demonstrates A Coil Gun | Gizmodo Australia

    • You don’t need to change the resistor and capacitor on the gate of the FET. You just need to make sure you don’t raise V2 too much to break the gate of the FET, which is usually 20V max. You may need to tune the resistors of the Optocoupler to make sure the output still saturates.

  22. I wanna ask you something. I really try to do this but 1uF block DC. then no current on 1M so, Gate voltage is nearly zero and source voltage also then NMOS is off. Isn’t it? Also coil resistance should be low then how can you deal with the over current

    • 1uF blocks DC. But when you close the switch, the voltage on one side of the 1uF jumps, resulting on the voltage on the other side to jump too as the capacitor likes to keep the voltage across it the same. So this will rise the gate voltage of the MOSFET high. If the switch is held on the gate voltage will slowly drop as the 1uF discharges through the 1M Ohm.
      The coil resistance is very small, but not exactly zero. For example my coil resistance is around 0.250 ohm. So there will be some current limiting anyways. If the FET can take large currents for short period of time, it will be fine like mine. Just make sure you have a bullet going to turn the circuit off and otherwise teh FET will blow. Like I said my circuit works, but is not the best way to do it.

  23. You have to make more videos! I laughed out loud when I saw both videos (Coil Gun, and ESD Gun).

    It’s nice to see someone taking a dry subject matter and injecting some humor.

    Thanks!

  24. I love the videos! Early in the written description you say ‘RF sensor’ and I think you meant ‘IR Sensor’.
    I was also thinking you could switch polarity on the coil to then push the steel rod. Thanks for clearing that up!

    • Like I explained, discharging a capacitor will be similar to a timer. The coil may discharge sooner or later than when the bullet reaches the center. It would work, but won’t be the best. Also the capacitor current drops rapidly causing the energy of the coil during acceleration. But instead using a high power supply, you can make sure the power is maximum throughout the acceleration.

  25. And I am here again.
    Think I am thinking fundamentally wrong in that if run on AC it will ‘push’ on a half cycle as well as ‘pull’ in the first 1/2 cycle.
    Whatever the polarity is I guess the bullet will be attracted to center.
    Maybe a bar magnet then? And of course AC is not something very portable!

    Dennis

  26. Another comment Mehdi,

    Will the gun work with considerably more turns and a lot less current?
    70 amps is quite a power supply too. What do you use?

    Maybe could use an ac supply where the voltage reversal does the switching?
    It would mean the bullet needs to get to the center during a half cycle then be pushed out on the other half cycle. Not sure if I can work out the length of bullet and barrel for a 60 Hz supply. It seems the bullet is not critical here but the barrel very much so? It could maybe very much simplify the gun electronics although I can see a problem getting the bullet to start its motion in the right part of the sine wave!

    • The magnetic field is affected by higher current and higher number of turns. So if we can increase both, it would be great. But more current means a thicker wire so with the same number of turns, your coil size grows. I am using a wire , which is 16 AWG I believe. It can’t continuously take 70A, but it can easily handle a short burst of current. When you make a coil, it has a resistance. So for example if you have a 12V, it maybe able to only allow 50A even if your supply can allow 100A. So you will have to raise your supply voltage for more current.
      I don’t thing you will get anything goo with AC. First the field will be alternating meaning an inconsistent power, and also if you are using a steal bullet, it doesn’t matter that the field gets reversed. It will swill attract the bullet back in.

      • Thanks you replies Mehdi.
        I now what you mean trying to get a very large current through the wire’s resistance with a 12 v supply.

        And appreciate now that if the coil is N or S it will still attract a steel bar. So reversing the current will not do any good after the bullet has got to the 1/2 way stage.
        However if the bullet is a bar magnet and the coil polarity was reversed at the 1/2 way stage, could that not be used to advantage? It would be sensitive to the polarity of the coil.
        Still needs a sensor that can detect the bullet though 1/2 way through the barrel. A pvc one could probably use a Hall effect sensor.
        Dennis

        • It is possible to use a bar magnet and reverse the polarity. You would need to find sweet spots to reverse the polarity and also still time it well too. I haven’t done this before but I’m guessing it will not make things simpler. But you may achieve better acceleration.

  27. You’re great at explaining Mehdi. And you are no mug!

    Could it be that the circuit would work and give more velocity if there was just one coil but it was a lot longer.
    Say a foot. Having thought about it though the bullet causes the sensor to switch off the current or ideally reverse the polarity. So the bullet would have to be a long one!
    Unless the sensor could be a little over 1/2 way down the barrel and ‘see’ through it to the bullet. How about a Hall effect sensor?

    Regards, Dennis.

    • Hi Dennis,

      The issue with a longer coil is that you still need to turn it off when the bullet reaches the center, which renders the second half of the coil useless. And also the very long coil will not necessarily put more force over the bullet, for example my bullet can’t be over a centimeter away from the edge of the coil or it won’t attract it at all. So in a very long coil, only maybe around 5cm (2″) of the coil has real effect on the bullet. It would be much more effective to have 6x 2″ coils and turn them on/off correctly, rather than a 1 foot coil.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>