Tuesday, June 25, 2013

Arduino Scalable Single-Stage Coilgun

In my earlier post where I built an Arduino Laser Tripwire, I mentioned that I was going to use this as a component to a later project.  I've built a scalable, single-stage coilgun that uses inexpensive components and a relatively tame 50VDC.

The premise of a coilgun is simple:  a ferromagnetic or paramagnetic projectile is attracted towards any strong magnetic field it encounters.  By switching on a strong magnetic field inside a solenoid, we can attract the projectile into the coil of wire.  When the projectile is inside the wire, the field is switched off and the projectile continues on the path it was following as it was sucked into the field.

This prototype has only a single stage, meaning that only a single solenoid accelerates the projectile; However, it can easily be scaled up.  By placing another stage just like it in the path of the projectile, we can accelerate the projectile faster and faster.  The projectile will break the laser beam for the next unit, then the magnetic field in the next solenoid will be turned on thus accelerating the projectile further.

I can achieve this multistage coilgun by placing a clear plastic barrel down the center of my solenoids, then shining the laser through the barrel.

My charging circuit, a Delon voltage doubler.

My charging circuit is a simple Delon voltage doubler.  The voltage doubler uses a 12VA transformer to convert the 120V AC from a normal US wall outlet to 24V AC.  The capacitors only need to be 24V, but I happened to have 35V capacitors on hand.  To protect my Arduino from any reverse bias that might be introduced by the relay coil, I include a 1N4937 diode in my design for protection.

My Arduino laser tripwire module., modified from my earlier design.
I have modified my Arduino laser tripire module a bit for compatibility with my trigger circuit.  I need a 1N4937 diode to prevent the voltage from my main capacitor from flowing to ground through the 100 ohm resistor on the trigger circuit.  The indicator LEDs are all optional, and power draw on my Arduino could be reduced by removing them.


The firing module for my prototype coilgun.
The firing circuit is quite spartan, dominated by a large electrolytic capacitor and a cheap 2N6507G SCR.  The 2N6507G can withstand a surge current of 250A but costs only 66 cents to purchase, making it an ideal centerpiece for my firing circuit.  To simplify things further, I use an entire quarter-pound spool of 16AWG magnet wire for my solenoid.  No winding was necessary:  I simply purchased the spool, found both ends of the wire, sanded the insulating lacquer off, and crimped on terminals.  I measured its inductance at 185 microhenries.  To be absolutely sure to protect my capacitor from any reverse bias that might be introduced, I have a 1N4937 protection diode across both the solenoid and the terminals of the capacitor.

Complete schematics for my prototype, generated with KiCad.

Before getting to the demonstration, I will share the source code that I uploaded to my Arduino Uno.  This source is similar to that which I included in my previous post, except I have modified it in two ways.  First, it opens the power supply relay at the same time that the SCR is triggered.  Second, it includes a charge signal (output 10) as well as a tripped signal (output 11).

int ledPort = 13;
int laserPort = 12;
int tripPort = 11;
int notTripPort = 10;

int timerToggle = 1000;
int timerCount = 0;
boolean timerState = false;

int onLevel = -1;
int offLevel = -1;
int currentLevel = -1;

boolean tripped = false;

void setup() {
  pinMode(ledPort, OUTPUT);
  pinMode(laserPort, OUTPUT);
  pinMode(tripPort, OUTPUT);
  pinMode(notTripPort, OUTPUT);
  
  digitalWrite(tripPort, LOW);
  digitalWrite(notTripPort, HIGH);
  
  // Check the state of the phototransistor with the laser on
  // and off.
  digitalWrite(laserPort, LOW);
  delay(1000);
  offLevel = analogRead(A0);
  
  digitalWrite(laserPort, HIGH);
  delay(1000);
  onLevel = analogRead(A0);
}

// An alive signal that appears on the arduino, 
// just to let me know the program is running.
void timer() {
  timerCount++;
  if (timerCount == timerToggle) {
    timerCount = 0;
    timerState = !(timerState);
    if (timerState) {
      digitalWrite(ledPort, HIGH); 
    } else {
      digitalWrite(ledPort, LOW);
    } 
  } 
}

void loop() {
  delay(1);
  timer();
  if (!(tripped)) {
    currentLevel = analogRead(A0);
    if (currentLevel < onLevel - (onLevel - offLevel) / 10) {
     tripped = true;
     digitalWrite(tripPort, HIGH);
     digitalWrite(notTripPort, LOW);
   } 
  }
}
Source code for my coilgun, as uploaded to my Arduino Uno.

Finally, you may check the YouTube video below to see how it works!




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.