### Coil Gun [Part 2] – Theory, Design and Simulation of the Charging Circuit

WARNING: This circuit can produces voltages that can cause serious electrical burns or easily kill you if not handled properly. Please do some research before beginning this project to ensure you are taking all proper safety precautions when working with high voltage. If you are at a beginner level, I strongly encourage you to start with low voltage projects before taking on a high voltage project. This resource is a great place to start educating yourself. Then search Google for “high voltage safety tips” and read through as many links as you can.

## Theory – Boost Converter

With that warning out of the way, lets dive in to the circuit. The centerpiece of the charging circuit is a boost converter. This circuit is a DC-DC converter, taking an input DC voltage and outputting a DC higher voltage. Below is an illustration of the circuit topology. To charge the capacitor, a high frequency square wave is applied to the gate of an NMOS transistor.

When the transistor gate is pulled high (Figure 2), an LR series circuit is formed with the inductor ($L$) and the resistance of the inductor ($R_L$) plus the ON state drain-source resistance of the transistor ($R_{DS}$). The sudden flow of current induces a voltage across the inductor ($V_L$) in opposite polarity of the voltage source to resist the flow of current.

When the transistor gate is pulled low, the conduction path is now through the diode and the capacitor (Figure 4). The inductor tries to maintain the current flow by collapsing its magnetic field, inducing a large voltage across its terminals that adds in series with $V_S$. Since $(V_S + V_L) - V_C > V_F$ (where $V_F$ is the forward voltage of the diode), current flows into the capacitor. This continues until $(V_S + V_L) - V_C < V_F,$ or the transistor gate is pulled high. As the transistor is alternated between ON and OFF states, the capacitor is quickly charged to a high voltage.

## Circuit Design

### Power Source

The charging circuit requires a power source capable of delivering high current. Other important factors are portability and ability to recharge.

I found a 14.8V LiPo 1300mAh 25C battery on Amazon for $20. Using 14.8V ensures fast charging of the capacitor. It can also handle up to 32.5A (calculated by multiplying the battery capacity times the ‘C’ rating: 1300mAh*25C = 32.5A ) continuous discharge, which is far above what the boost circuit will be drawing from it. Can never have too much power! ### Voltage Regulator It is an important that the low-voltage electronics (such as the 555 timer) are powered via a voltage regulator. The switching action and high current draw of the boost converter will introduce a lot of noise and fluctuations in the voltage supply. Therefore, adding in a voltage regulator will help increase reliability and prevent any damage to the gate drive circuitry during the charge phase. I am using an LM317 regulator for this circuit. The datasheet gives the output voltage formula as $V_o = V_{REF} (1 + R_2/R_1) + I_{ADJ} R_2$ where$V_{REF} = 1.25\mathrm{V} &fg=333333&s=1$under normal regulation. The schematic below shows the LM317 configured for an output voltage of ~9V. ### Capacitor Before deciding on a capacitor, you need to decide your maximum charge voltage. A voltage of around 100V will get the projectile moving, but not very fast. I’ve built a gun using 200V that was able to shoot a screwdriver tip into drywall and have it stick. Beyond 200V, things start to get quite dangerous; not only because of the high voltage, but component failures become catastrophic. I recommend starting at 100V and working your way up only when you are confident in your ability to safely design a higher voltage circuit. For my design, I will be using a maximum charge voltage $V_{C(MAX)} = 200\textrm{V}$. It is important that the voltage rating of the capacitor should include an adequate safety factor (at least 25% higher than your desired charge voltage). It is also important to choose a capacitor with low ESR (equivalent series resistance). This will prevent waste heat being expended in the capacitor, increasing the efficiency of the coil gun and improving the lifetime of the capacitor. I found a 450V 1800μF Nippon electrolytic capacitor on eBay for about$20.

#### Safety Note: Bleed-Off Resistor

High voltage capacitors are capable or storing dangerous amounts of energy. You’ll find no shortage of stories of people who touched a capacitor they thought was discharged only to receive a nasty shock (or worse). It is paramount to include a bleed-off resistor across the terminals of the capacitor. I’ve added a 200k resistor in parallel with capacitor bank. Smaller values will cause the bank to discharge faster. Make sure the resistor can handle having a large voltage across it!

### MOSFET

There are several criteria that must be considered when choosing the MOSFET. I have chosen the STP25N60M2EP for my design.

1. The maximum drain-source voltage $V_{DS(MAX)}$ must be at least 25% higher than the highest voltages seen by the circuit. Since I chose $V_{C(MAX)}$, $V_{DS(MAX)}$ should be at least 250V for my design. The STP25N60M2EP is rated for 650V, which allows me to scale up my design to higher voltages later on.
2. The on-state drain-source resistance $R_{DS(ON)}$ effects the charging speed and power lost to heat. Choosing a lower $R_{DS(ON)}$ decreases charging time but increases the inductor current. For the STP25N60M2EP, $R_{DS(ON)}$ is rated at 175mΩ.
3. The power dissipation rating $P_D(MAX)$ must be high enough to handle the power loss in the transistor $P = I^2 R_{DS(ON)}$. I will show via simulation that the peak current through the transistor is <5A. Therefore, $P = I^2 R_{DS(ON)} = (5\mathrm{A})^2 \times 175 \mathrm{m\Omega} = 4.4W$, well within the 125W rating of the transistor.
4. The maximum continuous drain current $I_D(MAX)$ must be high enough to handle the currents generated by the charging circuit. The STP25N60M2EP is rated for 18A, which I will show (via simulations below) is sufficiently high.
5. It is critical the 555 timer is driving the gate at high enough voltage to achieve the desired drain current. Don’t make the mistake of looking at the gate-source threshold voltage! This voltage specifies when the transistor starts to conduct, not the voltage for achieving maximum conduction. Looking at the transfer characteristics for the STP2560M2EP below, it starts conducting when $V_{GS} \approx 3\mathrm{V}$ but does not achieve $I_D(MAX)$ until $V_{GS} \approx 5\mathrm{V}$. Since the 555 is supplied with 9V via the voltage regulator, the 555 should have no problems driving the gate of the transistor.

### Inductor

The inductor can be selected to increase/decrease the amount of current flow. I recommend choosing a value of inductance around 300μH-500μH, as this will limit the inrush current when first charging the capacitor as well as decrease the overall RMS current.

I chose a J.W. Miller 330μH inductor for my design, which has a DC resistance of 74mΩ and is rated for a maximum DC current of 11.4A.

### Diode

The diode must be rated for both high voltage and high current. When the transistor switches to the ON state and the inductor discharges, the reverse voltage across the diode will be $V_C$. Therefore, it is important to choose a diode that can withstand this repetitive reverse voltage. The diode must also withstand the high currents flowing when the inductor discharges into the capacitor.

I chose the Rohm RF1005TF6S for my design, which is capable of handling 600V reverse voltage. It is also rated for a maximum forward current of 10A. As the simulations will show below, this diode is more than adequate.

### 555 Timer

As mentioned above, the gate of the MOSFET must be driven using a high frequency square wave. This is a perfect job for the 555 timer configured in astable mode. The regulated power is applied to Vcc and V_GATE is connected to the gate of the transistor.

The switching frequency can be calculated from the following formula

$f = \frac{1.44}{(R_1 + 2R_2)C_2} = 14,500 \textrm{kHz}$

How does the switching frequency affect performance? This can be thought of intuitively by realizing that increasing the switching frequency decreases the duration of the ON/OFF cycles. Shortening the ON cycle means the inductor current cannot build up to as high of a level. Therefore, increasing the switching frequency will increase charging time but decrease the inductor current. Using a SPICE simulation will help you determine the optimal switching frequency for your components.

## Simulation

Below is the schematic of the charging circuit. I wasn’t able to find a model of the STP25N60M2EP, so I used a MOSFET with a similar $R_{DS(ON)}$. I am not overly concerned with an accurate simulation, but rather verifying that the voltages and currents in the system do not exceed what the components are capable of handling.

Below is a plot of the of capacitor voltage and inductor current after 100ms of charging. The purpose of this simulation is to measure the peak and average current seen by the inductor. The inductor current achieves a peak value of nearly 60A over a period of 10ms. While this may seem high, the time duration is small enough that the inductor and transistor won’t see any excessive heating. Computing the RMS value of the inductor current between 20ms and 100ms yields of a value of 2.3A, well within what all components are rated for.

A final plot shows the capacitor voltage over two seconds of charging, reaching a value of nearly 180V. We can extrapolate from the plot that the capacitor will reach latex V_{C(MAX)} = 200\textrm{V}&fg=333333\$ within approximately 2.5 seconds.

### Conclusion

In this post, I covered the theory behind the boost converter as well as some important considerations to take into account during design. In the next post, I will be building the actual circuit and running some tests to make sure it matches what the simulation predicts.