DIY Coil Gun Redux: Life Really is Easier with Arduino

A common complaint in the comments of many a Hackaday project is: Why did they use a microcontroller? It’s easy to Monday morning quarterback someone else’s design, but it’s rare to see the OP come back and actually prove that a microcontroller was the best choice. So when [GreatScott] rebuilt his recent DIY coil gun with discrete logic, we just had to get the word out.

You’ll recall from the original build that [GreatScott] was not attempting to build a brick-wall blasting electromagnetic rifle. His build was more about exploring the concepts and working up a viable control mechanism for a small coil gun, and as such he chose an Arduino to rapidly prototype his control circuit. But when taken to task for that design choice, he rose to the challenge and designed a controller using discrete NAND and NOR gates, some RS latches, and a couple of comparators. The basic control circuit was simple, but too simple for safety — a projectile stuck in the barrel could leave a coil energized indefinitely, leading to damage. What took a line of code in the Arduino sketch to fix required an additional comparator stage and an RC network to build a timer to deenergize the coil automatically. In the end the breadboarded circuit did the job, but implementing it would have required twice the space of the Arduino while offering none of the flexibility.

Not every project deserves an Arduino, and sometimes it’s pretty clear the builder either took the easy way out or was using the only trick in his or her book. Hats off to [GreatScott] for not only having the guts to justify his design, but also proving that he has the discrete logic chops to pull it off.

41 thoughts on “DIY Coil Gun Redux: Life Really is Easier with Arduino

  1. I was almost expecting it to end with a mic drop. Lovely video, can’t wait for people to shit all over him again and tell him that he overcomplicated the circuit or something along those lines.

    1. I’ll bite…. ” In the end the breadboarded circuit did the job, but implementing it would have required twice the space of the Arduino while offering none of the flexibility.” what about with surface mount components? The MCU isn’t DIP.

      1. Sorry, what exactly is your point? The ATMEGA CPU of the arduino is available as DIP or surface mount. You can prototype with an Arduino Mini (which uses a surface mounted CPU on a DIP carrier) and produce a single board version of the project later with either type of mount.

        1. Point was to cause ruckus.

          But your reply to me could easily be aimed at the original comment ” In the end the breadboarded circuit did the job, but implementing it would have required twice the space of the Arduino while offering none of the flexibility.”

    2. There is possible ways to get clever and design a WTF circuit I think. Where you abuse a very specific logic chip as transistors analog style and limit your fire time with a one shot in the first place. But you end up designing a folded back on itself oddity that is very difficult to understand and add to, and is highly intolerant of part substitutions.

      1. Actually, the circuit would be very simple and intuitive.

        Think about what you’re doing here for a moment: you’re trying to achieve a 1-2-punch circuit that produces two short pulses one after another, out of a single trigger edge event, and each timer is stopped early by an external event.

        That means two resettable monostable (one shot) timers. First timer is triggered by the button, second timer is triggered by the fall of the first timer’s signal.

        That means you can get away with a single 556 chip that contains two 555 timers. Add to that a couple capacitors, resistors, the button of course and the optical sensors, and not much else.

        The 555 monostable can be trivially capacitor-coupled to trigger on a rising or falling signal edge, which solves the problem of burning the circuit by keeping the trigger down. Same goes for the sensors – getting a stuck sensor won’t latch the circuit, and since the sensors are stopping the timers instead of starting them or directly controlling the FETs, reloading the slug won’t trigger the gun.

          1. The beauty of that circuit is that you can keep adding stages to it, or intermediate delays by just adding one more 555 and repeating the same. The 555 can drive the output FETs directly so you don’t necessarily need a driver chip either.

      1. PS. I checked his YT channel and he is in fact German. It might be interesting to find out how many people adopted that style because it made their handwriting more readable. I started doing it for just that reason, but can’t remember how I discovered it. Maybe it was because I was studying German. It is more than 50 years ago and my memory isn’t what it was.

      2. He went to a lot more effort than I would have, simply to prove a point. I’ve been designing hardware and software since getting my EE back in the dark technological ages of 1973. I’ve designed with tubes, relays, and mechanical timers. Discrete IC’s like the video, and then with PALS, PROM based state machines, FPGAs, and microcontrollers. Back in the olden days, even micro processors were often a pain to use, with multiple chipsets in the implementation. The video points out the only real reason for using discreet logic or an FPGA, and that is when the microcontroller cannot handle the speed requirement. The microcontroller is generally faster to implement, less complicated for implementation, and generally less expensive to implement, especially in a commercial design, and easier to change when correcting bugs or adding features.
        As for slashing letters and numerals, as a communication guy I’ve slashed 7’s and Z’s and diagonally slashed zeros to tell the 0 from the o or O; but, it just comes down to what makes sense for the operator.

        1. “that is when the microcontroller cannot handle the speed requirement”

          Another is robustness, because a microcontroller is eventually going to corrupt itself when the flash runs out of life, or crash due to a random cosmic ray. Analog electronics are generally going to last a lot longer than a cheap chinese arduino clone.

          A third is repairability, because an analog circuit can be diagnosed, analyzed and fixed as long as it’s not relying on some esoteric effect of a particular component, whereas an MCU is a black box that typically cannot be opened 20 years from now.

          1. “whereas an MCU is a black box that typically cannot be opened 20 years from now.”
            With the speed of technological development, if your project has lasted for 20 years, I’d say you well met your design goals, and have already designed several replacement versions

          2. Unless you haven’t. Let’s say you’re fixing something made by someone else, and the MCU is dead. Too bad, you have to rip it out and re-engineer the whole thing. If the circuit was analog, you could trace how it works and fix the part that is broken.

          3. If the circuit has degraded enough, you might not be able to replace components if you cannot ascertain the correct original values (they only wrote the refdes near the component, not the value, etc…). Or if you don’t know what response to expect from some sub-set circuit. Along the same lines with MCUs though, even if the flash doesn’t crap out, good luck finding a way to tweak it… especially with many MCUs not allowing their flash to be dumped.

    1. Also in Italy we write in this way the 7s.
      Could be an EU thing, never thought that could be so strange to an american…
      Instead, what is wrong with the 1s? Sometimes are written with a base line, sometimes not :)

      1. Typically in the US either the top serif is omitted w/ the baseline in 1’s or both included.

        I got hung up on his mu since the upstroke is mostly missing making it look like a y, but a 10 yotta-farad capacitor would be worthy of it’s own article and probably an international prize of some sort.

  2. The discrete solution has another advantage: it won’t crash from the EMI caused by the coilgun itself.

    Though the speed advantage is lost in using op-amps as comparators because they’re prone to being sticky when the output saturates.

    All in all, the circuit could be simplified a great deal – he’s thinking about replicating the arduino program, instead of designing a circuit that does the job. For example, the bugs about powering the coils on indefinitely would be solved by a 555 one-shot timer at the trigger, which would enable power to the relevant circuits for the few milliseconds they actually need to be on and then turn it all off. No need for so many checks and glue logic.

    1. Yup, a 555 is likely to be enough; you could even implement feedback to de-energise the coil at the right moment by tying the output of the optocouple to the reset or threshold input (for an active low/high optocouple output respectively).

  3. Very enjoyable.

    I like that he took up the challenge to replace the microcontroller with more discrete components. Well done.

    Now, I’m sure someone will complain and want it done without IC’s, and with just transistors, resistors and capacitors.

    I’m sure the overall design could be simplified even more, but at the cost of flexibility, expansion and enhancement.

    With the right hardware components, the microcontroller takes care of all the “details” that make it work as intended, and also offers a quick development turn around.

    Again, well done.

  4. What pisses me off is that you guys shill for arduino constantly, now to the point of just calling it a “microcontroller” synonymously as if it’s the only microcontroller around. Well, not “now’ as in if it’s something new, but the joke is getting reallllyyy fucking tired. The horse is dead. Stop kicking it!!! But “lulz because Arduinos are divisive!” right? And in fact, its more of a development board for a microcontroller, but that is neither here nor there.

    The point is there are BETTER microcontrollers than the fucking POS Atmel chips and better suited micro’s than going all out with ARMs at that. There are micros with these things we call “Peripherals” – many of the good ones, that would be well suited to this problem are NOT included in the POS Atmel arduino chips. And if there are any, they are buried under layers of abstraction to the point they may as well not exist anyway.

    You could make a rail or coil gun using pushbuttons as someone above said, but it isn’t going to work very well due to timing, which when your talking about accelerating a projectile down a barrel or some rails is important if you want it to work, and better yet, work efficiently.

    But no, lets half ass a build because it’s just a concept and we don’t really care if it’s optimal and ardunios are so much easier than doing things right in the first fucking place.

    1. Why must you be so toxic? Are you upset because you were forced to read this article some how? They referred to this particular situation as an arduino enough times that the plugin for removing hackaday articles that mention arduino had plenty of chances to block this article. I suggest you use this plugin to create your safe space since this is obviously a trigger word for you. The only time they mention microcontroller (that I notice) is when they are generalizing the discussion to the overall idea of micro vs discrete logic. Even if they did refer to the arduino as a micro, so what? Arduinos are microcontrollers. Or should I always list out the full product details of every component to keep you happy? Are there micros that are in many ways better than Arduinos? Of course. Do Arduinos have flaws? No shit sherlock. However, Arduino clearly makes these known and has a large supportive community, something most microcontrollers do not have. I have spent way too much time reading over TI flavor of the week dev boards under the thinking that they were better for my small project than an arduino for what ever reason only to discover small bits of errata far to late, and see that TI has dropped support of the board by the time I get around to reusing the board for something else. The reason arduino is used is because it shortens development time, and is far easier to implement than hand building discrete logic, calculating RC values for 555’s, or tracking down chip information and errata on hostile websites. If I need to toggle a couple dozen pins at microsecond precision, I will find something else. If my project needs to work reliably 50 years from now without me around, then I will look elsewhere. But, if my project is a personal project that only needs 20 millisecond response times, then I will probably use a simple arduino to do it. If you want to design the whole thing with something else, do it and post a video on youtube yourself. Now, please either show some respect to the community here, or leave. I am tired of finding such toxic comments on these articles.

      1. “far easier to implement than … calculating RC values for 555’s”

        How simple do you want? The 555 switches at roughly 1/3 and 2/3 of the VCC which makes calculating the RC constants ridiculously simple. That’s because the RC time constant, literally R times C, is the time it takes to charge or discharge the capacitor to approximately those values from a constant voltage.

        If you can multiply in your head, you can see that 1 uF times 20 kOhms is about one millionth times 20,000 which equals 20 milliseconds to ~2/3 of the VCC which is when a 555 monostable would switch the output from high to low – and that’s your timer. It doesn’t get any simpler than that.

        It’s not that the Arduino is easier or faster to implement, but the fact that it can be done with less knowledge and understanding of the hardware you’re dealing with. Of course everything seems difficult when you know less than pigs know about pearls of it. For someone who knows a 555, the Arduino is just obtuse and unwieldy.

        1. I mean for pete’s sake, these chips are designed for the purpose of being simple and easy to understand. People these days, especially people who come from programming backgrounds (read web development) just have this attitude that if it’s not software then it’s difficult and esoteric.

        2. Point being that for the person who knows the 555, by the time they’ve finished wiring the circuit up it’s already working, whereas by the time the Arduino engineer is finished wiring everything up, they’ve still got the programming to do.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s