this is my third attempt at this project, this time I think I have enough knowledge to push it forward. The first was a two-stage coilgun that used 2200uf capacitors charged to 100v and fire the projectile. the second was the same with some extra stages, however, I ran into issues with the circuit and shelved it.
This time around I've decided to utilize an atmega328 on a custom board dev board I designed to switching relays for each stage through some 2N5551 transistors. The entire circuit board is designed to be powered with a 75c 1300mah 4s lithium-ion battery which is just should be just enough.
I know I would have better results if I were to have some kind of sensors to tell where the projectile was, but this is going to be more of a "proof of design" than a completed project. As the project progresses I plan to add notes here about what I've learned.
Details
just a 5 stage coil gun using relays and an atmega328. here are some videos of the final project
Files
Coilgun_Mk3_Code.ino
this is the code operating this project, "mk3" because I made some less impressive coilguns before.
and that's it, a short and sweet project. the end result of this is that I was able to get a 1/4" ball bearing to travel 14 inches horizontally with a 2 inch elevation of the barrel. not exactly the most stellar results, but i'm glad i did it, and as a proof of concept it works.
the timing was kind of a pain, here was my basic setup
since I don't have any feedback, I just had to start with one coil at a time and move my way through, finding (roughly) what timing got me the furthest distance. I feel like the project could work better if I put even more time into getting the coils to fire perfectly, but i'm satisfied with the way it is now.
the circuitry for this project is now complete. Since this project uses relays to power the coils i decided there wasn't a good reason to keep the micro-controller and transistors on the same circuit as the coil's themselves. This resolved an issue i was experiencing where the micro-controller would reset for seemingly no reason. It did however add another set of batteries to deal with, but i can live with that. now all that's left is to work out the timing to fire the 1/4" ball bearings that this coilgun was designed for.
so this is really a project that was born of boredom, i was sitting around one morning and i just wanted to do a project. so i took something I've tried many times. after a few hours of soldering i ended up with a buggy protoboard prototype that seemed to look right. I wrote the code for it in about 20 minutes and gave it a shot... and it worked! twice.... added some flyback diodes to every coil in the circuit and tried it again with better results. i drew up a schematic to illustrate how each stage is wired and how i have it connected to the micro-controller.
the micro-controller diagram is a bit messy, it uses an Lm7805 linear regulator with a 330uF electrolytic cap and a 22pF ceramic cap on the output. other than that most of the circuit real-estate is composed of the relay circuit which is above, each pin connects to the 2n5551 in its respective circuit.
and that's basically all this mess of wires is
also, the micro controller and the 2n5551s draw from different 5v regulators, the 7805 powers the micro controller while the collector of each transistor is powered by the Vout of a AMS1117. i don't exactly remember why i did it, but it's more work to fix it than leave it.
Magnetic force is proportional to the field GRADIENT, so you could about double the force by collapsing each coil's current after the ball passes. Due to the coupling between adjacent coils, this discharge and charging the next coils current will be faster in this case. Also, the field at the end will not rob you of your velocity by attracting the ball back toward the gun after it passes the last coil. Second, the ball is accelerating, so you could relax your timing issues by spacing the coils quadratically along the barrel... x(t) = 1/2 a t^2. Finally, a good conductor (i.e. copper) could be pushed ahead of the coils much stronger than a ferromagnetic ball can be pulled into the coils due to eddy currents in the steel. If you utilize this advice, you will need MUCH more mass in the gun to absorb the recoil; this mass will need to support the coils very thoroughly and will need to be an insulator. A ferromagnetic insulator would be better still. CAUTION: Eddy currents will heat the copper in this case.
The transistors would have worked better on the low side, i honestly sat down one morning and just started soldering and it worked so i kept it.
as for why the relays, they were what i had on hand. i only had a few MOSFETs i could have used in their place, but i'd be using them all. also a couple TIP120 transistors which wouldn't have been able to stand up to the current i wanted to put through the coils.
all the choices i made basically boiled down to what parts i had on hand since i didn't feel like waiting on parts for this project.
Magnetic force is proportional to the field GRADIENT, so you could about double the force by collapsing each coil's current after the ball passes. Due to the coupling between adjacent coils, this discharge and charging the next coils current will be faster in this case. Also, the field at the end will not rob you of your velocity by attracting the ball back toward the gun after it passes the last coil. Second, the ball is accelerating, so you could relax your timing issues by spacing the coils quadratically along the barrel... x(t) = 1/2 a t^2. Finally, a good conductor (i.e. copper) could be pushed ahead of the coils much stronger than a ferromagnetic ball can be pulled into the coils due to eddy currents in the steel. If you utilize this advice, you will need MUCH more mass in the gun to absorb the recoil; this mass will need to support the coils very thoroughly and will need to be an insulator. A ferromagnetic insulator would be better still. CAUTION: Eddy currents will heat the copper in this case.