I´m working on my coilgun prototype, but I have troubles with IR sensors for projectile detection.

When any of accelerating coils is switched off, all sensors report false detection.

I´m using this connection:

CG IR sensor connection

On the left side is connected IR photodiode (pin 1,2) and IR diode (pin 3,4). The resulting signal (on the right side) is connected to ESP32 via 3.3v zener diode, where I handle it with an interrupt.

I tried to add debounce capacitors, but it doesn't help. Currently, I handle it by software, but that's not the best solution.

Do you have any suggestion for this problem?

Is it possible that the coil induces a voltage on the sensors or is it just a circuit error?

EDIT: I switching coils by this circuit: enter image description here

I´d try to put sensors in copper grounded boxes, use shielded wires and add some decoupling capacitors as was said in comments.

  • \$\begingroup\$ The coil may produce a big EMI pulse as it operates, and an even bigger one as it switches off. Can you show a circuit diagram for the coil switching circuit? Does it have snubber diodes? \$\endgroup\$ – Jack B May 4 '19 at 9:30
  • \$\begingroup\$ "Debounce" and "decoupling" are two different things. Decoupling applies to supply voltages, debouncing applies to signals. You need lots of decoupling here, but debouncing would delay your signals, and may not be what you want. \$\endgroup\$ – JRE May 4 '19 at 11:30

I'm not going to go into any math, just some general principles.

  1. You need decoupling capacitors on your LM393. These are (relatively) small capacitors that you install right at the IC power pins. Usually like 100nF. Very short leads. Like, millimeters not centimeters.

  2. Your sensors and LEDs are on long(ish) wires. The wires will pickup any pulses that occur when you switch off a coil. Use twisted pairs for your sensor wires, or twisted pairs with a grounded shield. This will minimize the intereference that the wires pick up.

  3. You use a potentiometer to set the trigger threshhold for your sensors. You need a capacitor from the potentiometer wiper to ground. In your example, that's pin 2 of the potentiometer. Again, something like 100nF. This will keep noise and intereference from disturbing your threshhold setting.

  4. Coils store a lot of energy. When you switch them off, that energy has to go somewhere. When you just switch one off, the energy has to go somewhere. A lot of it goes into an electromagnetic pulse. This induces currents (and voltages) in nearby conductors - including your circuits. You need shielding (enclose your circuits in metal boxes) and you need to reduce the intensity of the turn off pulses. Instead of just opening the circuit to the coil, switch it to short the coil through a (low value) resistor. That will absorb the energy instead of transmitting it. It also changes the time it takes for the magnetic field to die, so you may need to experiment with the discharge resistor (optimize the time) or modify the timing between the coils.

  5. Another thing to consider is how you run your wires. The orientation of the wires to the coils influences the amount of interference the wires pick up. You probably can't get rid of all of the interference this way, but if the wires are run just absolutely the wrong way it can make a bad situation much worse.

That's all just general stuff. Really, it all comes down to minimizing the interference your coils generate and making your circuits "immune" to the intereference that you can't avoid.

You've added the coil driver circuit to your question.

That brings me to another suggestion:

It looks to me like you have the drivers centralized, with long wires to the coils.

I think you ought to put the driver for each coil right at the coil.

The wires between the driver and the coil will act like antennas. The longer they are, the more interference they will transmit.

Shorter wires, less interference.

Run the 80V power and the control signals to each coil, with your switching circuit right there at the coil.

Use short wires, and twist them together.

Use the thickest wire you can to distribute the 80V to the drivers. Each driver would also need a large(ish) capacitor on the 80V connection (on the driver board) to make up for higher resistance and inductance on the power supply.

Use twisted or shielded wires on your control signals going to the drivers.

| improve this answer | |
  • \$\begingroup\$ I am going to try it, thanks a lot. \$\endgroup\$ – LucasN May 4 '19 at 11:29
  • \$\begingroup\$ If I'll put the driver ic as close as possible to the coil, wouldn't it be interfered too? Or would it work correctly? \$\endgroup\$ – LucasN May 4 '19 at 13:55
  • \$\begingroup\$ The driver signals are sent when the coils are in a rest state (on or off.) They shouldn't be bothered by the coils. Also, you can make the trigger signals lower impedance so they can stand more noise before there's a problem. \$\endgroup\$ – JRE May 4 '19 at 14:32

Here is some inductive (magnetic) interference math. Assume 100 amps, switching in 100 nanoseconds; this is 1Billion amps per second

Assume a long straight wire carries that 100 amps, and that wire is in the plane of a square loop, 1cm by 1cm; assume there is 1cm separation between wire and loop. For exact prediction of the voltage interference, we should write an integral; however we'll use an approximation like this

Vinduce = [MUo * MUr * Area/ (2 * PI * Separation)] * dI/dT

For MUo = 4 * PI * 1e-7 Henry/meter, and MUr = 1 (air, copper, FR-4, aluminum0

the formula becomes 2e-7 * Area/Separation * dI/dT

Lets insert the values

Vinduce = 2e-7 * (1cm * 1cm)/1cm * 1e+9

Vinduce = 2e-7 * 1e-2 * 1e+9 = ONE VOLT <<<<< This is a big problem


Use twisted pairs everywhere for sensor wiring, power wiring, output wiring.

Use copper planes as magnetic shields? The (assumed slow: 100nanosecond) switching is too slow to be much affected, but you should test this.

Aluminum rails may be thick enough to provide useful magnetic attenuation. Just some thoughts. I've never built a coilgun.

| improve this answer | |

My suggestion - keep the sensors well away from the big current pulses. Use optical fibres.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.