icon

Fire punch!

Inspired by Allen Pan's project, I decided to recreate in my own a fire-gun, with different components (for ex. mpu5060) and code.

projectImage

Things used in this project

 

Hardware components

HARDWARE LIST
1 Arduino Nano R3
1 DFRobot 6 DOF Sensor - MPU6050
1 Relay (generic)
1 Jumper wires (generic)
1 Resistor 100 ohm or less
1 General Purpose Transistor NPN

Hand tools and fabrication machines

Soldering iron (generic)

Story

 

projectImage

While I was surfing in this platform, I founded the Allen Pan's project, so, inspired by him, I watched inside my Arduino's box and I realised that I had everything I needed: Arduino mini, mpu6050, relay, transistor 2n222A and a voltage regulator.

 

This project is very dangerous and I decline any responsibility.

 

To sum up, the fire-punch is a device that reads a certain acceleration and passed a minimum value, shoot the gas through a plasma lighter.

THE CIRCUIT

What does Arduino have to do? Read a certain acceleration, open a contact in the relay that controls the electrovalve.

projectImage

First of all, I connected the Arduino mini with Mpu6050 and a relay.

projectImage

In this sketch, I used an Arduino Micro instead of Mini, because they look the same but there are some differences between them. The differences are that in the Micro, the Sda and Scl are in Pin D2 and D3, rather than in A4 and A5 (mini).

 

Moreover, to control the relay, I used a transistor.

 

Between the White wire and the transistor (base), I suggest to place a resistance (less than 100 Ohm).

Naturally, in the other side of the relay, I put the positive of the electrovalve (common) and of the battery.

projectImage

THE LIGHTER

I bought this on Amazon, but every plasma lighter is good for this project.

projectImage

Then I opened it, and I found the way to leave the switch on.

projectImage

For the component I ordered, I welded a different switch between the contacts of the first one, that when it pressed, allows the lighter to stay on.

projectImage
projectImage

I decided to keep the Arduino's circuit and the circuit of the lighter separated for security reasons.

POWER SOURCE

First of all, the lighter has its power source.

For the electrovalve, I used these two batteries (tot.12 V).

projectImage
projectImage

To power Arduino I used two 18650 with a voltage regulator.

projectImage

PIPES

projectImage
projectImage

(1) 12 V electrovalve 1/8"(https://www.amazon.it/gp/product/B07RJGVRX9/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1)

(1) Reducer 1/2"->1/8"

(1) Pipe 1/2" for 10cm long

(1) Female connector 1/2"

(1) Manual valve 1/2"

You can find them in every hardware store.

CODE

For the mpu6050 I found a library on github called: "MPU6050_6Axis_MotionApps20.h".

 

I downloaded this library from this website:"https://www.arduinolibraries.info/libraries/mpu6050" and then I edited one of its examples (MPU6050_DMP6).

 

Moreover, for this project you need to install :"I2Cdev.h" and "Wire.h".

FINAL RESULT

projectImage
projectImage

REFILL

TEST

Schematics

 

projectImage
CODE
#include "I2Cdev.h"

#include "MPU6050_6Axis_MotionApps20.h"

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif


MPU6050 mpu;






#define OUTPUT_READABLE_REALACCEL






#define INTERRUPT_PIN 2  // use pin 2 on Arduino Uno & most boards
#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;

// MPU control/status vars
bool dmpReady = false;  // set true if DMP init was successful
uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount;     // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer

// orientation/motion vars
Quaternion q;           // [w, x, y, z]         quaternion container
VectorInt16 aa;         // [x, y, z]            accel sensor measurements
VectorInt16 aaReal;     // [x, y, z]            gravity-free accel sensor measurements
VectorInt16 aaWorld;    // [x, y, z]            world-frame accel sensor measurements
VectorFloat gravity;    // [x, y, z]            gravity vector
float euler[3];         // [psi, theta, phi]    Euler angle container
float ypr[3];           // [yaw, pitch, roll]   yaw/pitch/roll container and gravity vector

// packet structure for InvenSense teapot demo
uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };





// ================================================================
// ===                      INITIAL SETUP                       ===
// ================================================================

void setup() {
  pinMode(2, OUTPUT);
  
    // join I2C bus (I2Cdev library doesn't do this automatically)
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
//        Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif

    // initialize serial communication
    // (115200 chosen because it is required for Teapot Demo output, but it's
    // really up to you depending on your project)
    Serial.begin(9600);
   

    // initialize device
    Serial.println(F("Initializing I2C devices..."));
    mpu.initialize();
    pinMode(INTERRUPT_PIN, INPUT);

    // verify connection
    Serial.println(F("Testing device connections..."));
    Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));

  

    // load and configure the DMP
    Serial.println(F("Initializing DMP..."));
    devStatus = mpu.dmpInitialize();

    // supply your own gyro offsets here, scaled for min sensitivity
    mpu.setXGyroOffset(220);
    mpu.setYGyroOffset(76);
    mpu.setZGyroOffset(-85);
    mpu.setZAccelOffset(1788); // 1688 factory default for my test chip

    // make sure it worked (returns 0 if so)
    if (devStatus == 0) {
        // Calibration Time: generate offsets and calibrate our MPU6050
        mpu.CalibrateAccel(6);
        mpu.CalibrateGyro(6);
        mpu.PrintActiveOffsets();
        // turn on the DMP, now that it's ready
        Serial.println(F("Enabling DMP..."));
        mpu.setDMPEnabled(true);



       
        Serial.println(F("DMP ready! Waiting for first interrupt..."));
        dmpReady = true;

        // get expected DMP packet size for later comparison
        packetSize = mpu.dmpGetFIFOPacketSize();
    } else {
        // ERROR!
        // 1 = initial memory load failed
        // 2 = DMP configuration updates failed
        // (if it's going to break, usually the code will be 1)
        Serial.print(F("DMP Initialization failed (code "));
        Serial.print(devStatus);
        Serial.println(F(")"));
    }

}



// ================================================================
// ===                    MAIN PROGRAM LOOP                     ===
// ================================================================

void loop() {
  
    // if programming failed, don't try to do anything
    if (!dmpReady) return;
    // read a packet from FIFO
    if (mpu.dmpGetCurrentFIFOPacket(fifoBuffer)) { // Get the Latest packet 
        

       

        #ifdef OUTPUT_READABLE_REALACCEL
            // display real acceleration, adjusted to remove gravity
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            Serial.print("areal\t");
            Serial.print(aaReal.x);
            Serial.print("\t");
            Serial.print(aaReal.y);
            Serial.print("\t");
            Serial.println(aaReal.z);
        #endif


        
 if (aaReal.y <= -9500 ){
   digitalWrite(2, HIGH);   
  delay(175);                      
  digitalWrite(2, LOW);   
  delay(175);    
   }

    }
   
}

The article was first published in hackster, August 5, 2021

cr: https://www.hackster.io/cicchine_ing/fire-punch-f7d5c9

author: cicchine_ing

License
All Rights
Reserved
licensBg
0