Coil Gun Mk2

Device

The Coil Gun Mk2 is a handheld electromagnetic device that launches ferromagnetic objects from the barrel via a charged capacitor bank discharged through a large inductor. It utilizes an Arduino Nano to toggle a MOSFET controlling the capacitor bank's connection to the coil. The device currently shoots at 12.4 mph, and is a second iteration of the Mk1 Coil Gun.

Me holding a working prototype showing the wiring, alligator clips, Arduino Nano microcontroller, and inductor (red coil).

The capacitor bank containing 13 35v 5600µF capacitors in parallel for a large in-rush current, all mounted to a PCB I milled.

Skills Used

Advanced Circuitry

Corel Draw

Laser Cutting

Fusion 360

3D Printing

KiCad

Milling PCBs

C++

Final Product & How it Works

The device fires a 3 gram 25mm bolt at 12.4 miles per hour out of the barrel. It works by charging a large group of capacitors, from which the user can then (once the bank is fully charged and disconnected) hit the trigger causing the microcontroller to toggle the gate of the onboard MOSFET open allowing current to flow from the capacitor bank through the large coil for a short duration (around 13ms) before quickly switching it off. This generates a powerful electromagnetic field due to the current flowing through the coil which then pulls the projectile towards the center of the coil. By turning the coil off quickly before it reaches the center, the projectile keeps its momentum but isn't pulled backwards and launches out of the other side of the barrel. Below is a gallery of the final product's CAD design, PCB design, and photos of the device.

A simple demo of a firing test prior to full assembly.

Final KiCad Schematic (Though an Arduino Nano was used in place of the ATtiny1614).

Final Fusion Model (Front).

Final Fusion Model (Back).

Me holding the device in one hand (Though copper board replaced with protoboard).

The device sitting on my desk (Though copper board replaced with protoboard).

Development Documentation

Start to finish of how I developed the device.

Where to Begin - Electronics

Before I hopped into designing a basic housing for the electronics of the device, I first worked on the basic electronics. I used both a protoboard (solderable breadboard) in tandem with an Arduino Nano to build the first simple circuit. Based almost identically off of the electronics of the original Mk1 launcher, these simple elecronics essentially started me off where I left off with the Mk1 version. I then hopped into design for the housing of components.

First Design - Gun-Look and 18 AWG Coil

The first design I developed was modled off of a 1911 pistol airsoft gun that I took the dimensions of and modled similarly to to make sure it would have a real pistol feel and look. I printed and iterated on this design about 8 or so times. I eventually got to a final build that allowed for bolt-based mounting of the main electronics board, the coil on the barrel that could be removed and swapped if needed, the 9v battery, slide switch to turn the device on, and finally the small capacitor bank on top. While the design was very appealing to look at and the housing for all the components did fit and work very well, it didn't shoot at all. The coil on this model, keep in mind, is 18 AWG thickly insulated speaker wire that I wound myself, around 161 turns. However, I ultimately realized the MOSFET being used on this design was insufficient. While its current and voltage rating was high enough to handle what was needed, the gate required 10v to fully open and reduce gate resistance to a minimum. Since I was using an Arduino Nano, which uses 5v logic level, I was never fully opening the gate of the MOSFET, and as a result was severely limiting the current reaching the coil. While a good first iteration in terms of getting an idea of the design and a simple version of the electronics based off of the original Mk1 launcher (the orignal proof of concept that this could be done), it wasn't anywhere near what I wanted and as I mentioned basically was non-functional.

The first design for the Coil Gun Mk2, later discontinued for practicality and ease of testing.

The 161-turn 18 AWG inductor I wound. The first coil wrapped of many.

The original Mk1 launcher's capacitor bank utlized for this device.

The MOSFET Problem

To solve the supposed MOSFET issue, or what I believed was limiting the performance of the gun, I began researching. I ended up purchasing 6 IRLZ44N logic-level MOSFETs. The key difference to the previous IRF540N MOSFETs I was using is that the IRLZ44N is a logic-level MOSFET, meaning its Gate can be controlled by logic-level (5v) voltages, making my Arduino Nano microcontroller capable of opening and closing it as its digital pins output 5v when set to HIGH. I installed this new MOSFET but to disapointing results. While it was fully opening properly, the results were still disapointing. Me and Jack Donnelly ultimately concluded that the coil must be the issue, furthered by seeing online that most every coil others had wrapped to create a similar device seemed to be much higher gauge than our 18 AWG speaker wire, as well as smaller and thinly insulated. While we concluded the coil to be the issue, we atleast fixed the MOSFET which we would have needed to do later anyways.

Second Design - Baseplate Design and Solenoid Coil

To make development of the device easier I ended up designing a simple plate for everything to sit on allowing for easy accsess to electronics and the components in case I needed to swap anything. This design was used very breifly during this project so there isn't much to go into, but it did help a little for testing and other things.

Research and Speeds

Using this model I captured the speed of projectiles exiting the barrel. I placed my camera on my phone in 60 frames per second video mode and would record shots of the device which I placed along a tape measurer. I would then record the distance it would travel in a single a frame and doing so could calculate the speed. I used a 25mm bolt as my projectile, and tried a range of timings ultimately concluding that 13ms was the optimal timing for this model, reflected on the whiteboard in the photo attached. It reached a peak exit speed of 6.82mph. Note that the "NEW" boxed section is from later on.

The whiteboard of each test I conducted at the different speeds as well as a graph showing outcomes.

Undesirable Performance - Coil Problem?

As I said, we still believed the coil was our main issue. We wrapped about 5 different coils ourselves on 3D printed spools of all kinds of variety: different lengths, different AWGs of wire, different numbers of turns - and still we had poor results. Even worse, the original Mk1 launcher's coils still performed better than all of the new ones we wrapped. What makes it difficult is we were blindly testing all kinds of variables at once (coil length, number of turns, AWG of wire, etc.) and kept getting frustrated.

Bigger and Better Capacitors

Taking a pause on the coil issue, in addition to the MOSFETs I previously ordered from DigiKey, I also purchased 26 35v 5600µF LLS1V562MELA capacitors to be used and to upgrade the previous capacitor bank. In addition, I milled a capacitor bank PCB board on FR-1 PCB, designing it in KiCad and milling it ultimately on a Bantam milling machine. I then solder the caps through from the bottom and now had a much more powerful and capable capacitor bank I could use, much larger than the previous capacitor cell. This cell consists of 13 of these large capacitors wired in parallel.

The copper side showing the traces of that board I milled out for the capacitor bank.

The mounted and soldered capacitors on the underside of the PCB.

A comparison of the previous capacitor bank (right) and the new bank (left).

The Real Problem - The MOSFET

Still frustrated over the coil issue, I ultimately purchased a high-quality solenoid with plans of dismantilling it for its copper coil inside. My idea was that the coil should in theory be designed with the inside plunger (moving piece of the solenoid) in mind, that the coil would therefor be perfectly wrapped and made for this piece and that I could simply take the coil out and use that as my coil and the plunger as my projectile. I did find that the solenoid did seem to have better performance than previous coils did, but it still was very disapointing. By chance, about a day later, I decided for whatever reason to test using the new capacitor bank in tandem with the original Mk1 launcher's coil, but with the key difference being I would bypass the MOSFET and my circuit I designed entirely and instead manually tap the alligator clip connection between the ground of the coil to the capacitor bank, and with SHOCKING results. The original Mk1 launcher coil was launching bolts across my bedroom and hitting the far wall, more then double the best results we had ever gotten simply by chance that I happened to experiment with ignoring the MOSFET. From here, I began doing a ton of digging and researching on MOSFETs to understand why. Ultimately, after lots of research, it seemed I should try replacing the 10kΩ pull-down resistor of the MOSFET's Gate to a 1kΩ. I did so and with astonishing results. Now, by using my original MOSFET circuit with a simple resistor replacement I was getting consistently powerful results from the coil. Bolts would consistently shoot long distances, finally achieving desirable results. In addition, I also added a series resistor of 10Ω before the pulldown resistor on the line between the digital output of the Arduino Nano and the Gate of the MOSFET. I also added a 1N4007 flyback diode across the coil in reverse to VCC and GND (against the conventional flow of the coil), and a 100µF capacitor across the 5v and GND lines of the Arduino Nano to stablize voltage spikes that could damage the Nano. The flyback diode on the coil helps prevent current surges from the coil that could damage the Nano as well. I was very satisfied by these results and also very happy to have finally discovered my issue.

Third Design - Capacitor Bank Build

From here I chose to do some design work. I designed a shell for the large capacitor bank in Fusion 360 to enclose it to help prevent the possibility of being able to touch the traces while it is live. It includes an opening to allow the user to acsess the VCC and GND traces with alligator clips as well as holes for cooling on the capacitor side. It is bolted together on the sides and fits tightly on the circuit board. It also includes markings for VCC and GND. After this orignal design that I liked, I decided ultimately to simply mount all of the components on on side of the bank. I used velcro, as seen in some photos below, to attach components, and now the device was portable after a quick capacitor bank charge and I could carry it around and use it with its full power anywhere. With this model, I also clocked speeds, this time using slow motion 240 frames per second due to the sheer speed of the projectile, as well as used velocity calculations in tandem with the Mean Value Theorem in Calculus to get the acceleration at some point C of the projectile, allowing me then to use F=ma to find the force of the projectile. Though not optimal, as this method finds the acceleration at only a single moment and most certainly not its peak acceleration. Doing basic calculations as seen below, I found the bolt to be exerting a disapointing 0.6 newtons of force during its travel time in the barel, though once again keep in mind that this number is nowhere near the peak of its force but rather a force that must occur at some point during that period it is in the barel. The bolt weights 3 grams and accelerated at 210.45 m/s/s. Disapointed by this number, as I knew it wasn't actually the true peak force, I decided for the first time to measure its velocity exiting the barel. I used the previous 240 frame per second video to analyze the velocity leaving the barel by taking the symetric difference quotiont of the projectile's position at two points around the end of the barrel to get a speed of 12.4 miles per hour exiting the barrel, not bad at all.

The setup prior to mounting components on the bank but still showing the bank encased.

The holes on the capacitor side of the PCB allowing for airflow.

The exposed copper leads for VCC and GND to utlize the bank.

The actual capactior bank build with all parts mounted via velcro.

Custom Circuit Board

Now that I had a functional device with solid housing, I decided I wanted to make the circuitry look more professional and make it more compact. I hopped into KiCad and drew up my entire circuit, including implementing the capacitor bank and coil into the schematic view just to give a guide for wiring. The final design came out like this:

The entire schematic including the brains, the capacitor bank, and the coil layed out on one document.

The traces, edge cuts, and through hole pads of the physical board to be cut layed out.

KiCad's 3D modeled version (lacking some components) of what the board will look like.

I then milled this board out on a Bantam milling machine and soldered on the components.

A side view of the soldered PCB.

A closeup of the surface mount components I soldered on. (Keep in mind this is very poor SMD work, I used an iron in the lab and should have spaced out components in my design better!)

The final circuit board.

This board was functional and replaced my breadboard that I had been using. The only issue was the power would to the board was occasionally inconsistent for some reason.

Design 4 - Reworking the Capacitor Bank Design

Now that my electronics were working and professional looking (for the most part...), I went back and further developed the capacitor bank design. This time, I added bolt holes for mounting the PCB to the top, for which I used KiCad's PCB view to get the exact location of bolts in my design. I also added additional labeling, including labels for the PCB pinouts as well as warning signs for the high voltage in addition to the strong magnetic field. I also implemented a battery and switch compartment on the side of the device that is concealed and uses bolts to open and close. This version most importantly no longer used an velcro and could be completely disassembled and assembled without adhesive (aside from the slide switch and a few nuts that require glue).

The 4th iteration of the design.

A closeup of the warnings on the device, which use the standard set of symbols to depict the danger, though not in the standard of color.

The side battery and switch compartment.

Redesigning the PCB

In the meantime while the new casing printed, I wanted to redesign the PCB in a lot of ways. My biggest issues with the PCB is the difficulty to solder the SMD components (due to poor placement on my design), the size being about as large if not larger than the previous breadboard negating and space benefits, and the inconsistency of the device on the current PCB (I believe the VIN trace may be too small and could be losing contact occasionally). With all of this, I began to take my current design and simply rework it. The biggest change will be swapping the current Arduino Nano board with a single chip, the ATTiny1614. This will drastically reduce not only the size of the board but additionally the cost. It will drop the cost per microcontroller from around $7 on the low end for a Nano to around just under a dollar at $0.90, making prototyping much more practical. Due to the switch to the ATTiny, which as a lone IC SMD part with no board has no VIN like the Nano, I needed to step down the voltage from the 9v battery to properly power the ATtiny. I ended up implementing a through hole 5v regulator, specifically the L7805. Additionally, I changed the resistor leading to LED to GND to a 330 ohm resistor as opposed to the 100 ohm I was using prior to avoid damaging the microcontroller, and I also changed the pulldown resistor of the MOSFET to 330 ohm from 1k as an experiment. I then milled and soldered this board design.

My PCB design in the Bantam milling software during the milling of my custom board.

A shot of the machine actually milling my PCB.

A photo of the produced board with female pin headers connected through the bottom of the board.

While I don't include a shot of the soldered board above, the next section details a new design for the electronics housing and includes shots where the new soldered board can be seen.

5th & Final Housing Design

Lastly, now that I had a new board, I needed to once more redesign my electronics housing. The prior design did end up printing, however it was not as I had hoped in terms of the battery and switch mounting ease and space. I went back to the drawing board with my battery/switch mounting as well as my PCB mounting. I reshaped the previous PCB in the design to the current PCB's size, as well as adjusting the holes as necessary for the nuts and bolts to mount it to the case. I then moved the battery and switch to the top of the device so that everything was able to be mounted atop the capacitor bank with nothing on the sides. I liked this design much better, in fact finally felt satisfied with this design, mainly because the battery/switch mounting didn't feel super clunky, and because it all fit on top of the capacitor bank making it space efficient and no longer cumbersome.

Full body shot of the 5th design.

Up-close shot of the new battery and switch mounts.

With this I printed the new casing and everything mounted well and I was very happy with this new design.

Shot of me holding the device.

Overall shot of the front of the device.

Programming the ATtiny1614

The next step is to program the on-board chip, the ATtiny1614, with the code I wrote prior for the Arduino Nano. Different to the Nano, however, you cannot simply plug this chip in and program it in any way as it communicates through different protocol to the Nano and so a more complex communication method is needed. To begin, I opened the Arduino IDE and pasted this ("http://drazzy.com/package_drazzy.com_index.json ") into the "Additional Boards" section of File>Preferences. I then went Tools>Boards>Board Manager and installed the "megaTinyCore" board library to my IDE. I then downloaded the following library via zip folder: https://github.com/ElTangas/jtag2updi. I unzipped this, renamed the "source" folder to the name of the jtag2updi sketch's name from inside the folder, and opened that sketch. I then uploaded that jtag2updi.ino sketch to my Arduino Uno. I then wired GND between both boards, 5v from the Uno to the 5v pin of the chip, and D6 of the Uno to the UPDI pin of the chip. I then opened the sketch I wanted the chip to have and setup my tools menu to look as follows:

I then uploaded the sketch as normal but with the Uno connected and successfully programmed my chip!

And with that, the device was fully designed, built, and functional!

One Major Issue - Reverting to Nano due to Time Constraints

While the chip was programmed and everything was in place, I was having one major issue: the device wasn't firing, meaning the MOSFET wasn't opening properly from the ATtiny. In fact, after further testing, I gauged that the MOSFET wasn't opening at all via the ATtiny. Though curious and interested to fix the problem, I was running out of time to develop the project, as I at the time needed to pack up my equipment and leave for college, so I decided to take a step back and conclude the project. I switched back to the previous Arduino Nano protoboard version to be the completed version of the project. While I was hopeful of using my own board, the project was still overall a success, and I was happy with my work!