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”
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.
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.
He could have used a dip version of the atmega without the rest of the Arduino around it and it would have been even smaller.
Or he could have used a 556 and saved a whole bunch of other components as well, seeing the chip is well capable of driving the FETs directly.
The above is a link, not a broken image.
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.
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.”
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.
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.
Yes, that was a half formed thought of “could probably do it with one shots” in the midst of thinking about logic chip abuse. Thanks for running with the ball.
Though let us not forget Clarke’s great saying.. “Sufficiently advanced deployment of analog electronics is indistinguishable from magic.” … ;-)
There’s a really long link that opens up into an in-browser circuit simulator. You can play with that.
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.
Am I the only one who’s never seen 1’s written like that before? The first time I saw it was last week on a german website.
That’s also why they cross their 7s.
You may well be. I’ve written my ones and seven’s the German way since the mid-60s. It makes numbers much clearer, and I know lots of people who are not German who write like that. Even some Americans!
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.
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.
“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.
“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
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.
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.
We use the same way of writing In the Netherlands.
We use the same way of writing in the Netherlands
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 :)
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.
This guy loves to teach. First rule of teaching is there are no stupid questions just teaching opportunities. Well done!
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.
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).
or the ctrl input. Pulling that low pulls the output low.
Instead of all the complicated electronics, just use pushbuttons.
Heh, though sometimes you can look at things and think, “Damn, just 2 relays and a reed switch!!”
I bet you could do it with a single push-button and an analog delay line. :)
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.
“at the cost of flexibility, expansion and enhancement. ”
I’m not sure how flexible or expandable it is right now. It could be done simpler AND better.
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.
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.
“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.
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.
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.
Ok, I am waiting for your blogpost when you do it with an Intel Curie. Is that better than Atmel or ARM-licensed?
Please be kind and respectful to help make the comments section excellent. (Comment Policy)