[Arduino] Build a Launch System with Arduino 7 segment (2 digit) timer and HC-06

    INTRODUCTION

     

    Good Rocket needs good Launch System and Stand.
    Good Launch System should assure safety and stablity.
    That means whenever you find risks, should turn off system and solve that issues.
    So even though I pulled the trigger, I can turn it off with my bluetooth control.

    Building Rocket Launch System with Arduino Uno, 7 Segment 2 digit (Cathode Type), Buzzer, HC06 Bluetooth Module.
    Two 4.7 KΩ (for 7-Segment) and one 150 Ω (for Buzzer) resistors are used.

     

     

    PROGRAMMING GOAL

     

     As soon as Bluetooth module received Signal ' 1 ', T-10 second timer and Buzzer alert for each second. And each second you have chance to stop System with Signal ' 0 '. When timer reaches 'zero', Buzzer makes long sound and iginites the Rocket.

     

     

    7  - SEGMENT


    Perhaps your 7-Segment has different circuit, so should check pins and type(Cathode or Anode)
    Just turn two jumper wire on and connect. You can easily check it.

    7 - Segment UNO
    a 2
    b 3
    c 4
    d 5
    e 6
    f 7
    g 8
    dp 9
    BUZZ ,HC06 RX 10
    HC06 TX 11
    D1 12
    D10 ( 2 Digit) 13

     

     

    HC-06 module


    Sadly, HC-06 can't operate in iOS so you should prepare android phone. HC-06 works in 5V.
    Do not confuse place of RX and TX pins.
    Download 'Serial Bluetooth Terminal' in Google store, then you can send and receive Signal for Arduino.



    Arduino CODE

     

    #include <SoftwareSerial.h>
    
    SoftwareSerial mySerial(11, 10); // RX, Tx ( RX is connected with Buzzer)
    char Data = 0; // Data from Bluetooth
    
    int LedNum[] = {2,3,4,5,6,7,8,9,12,13};
    int Numset_DPo[10][8] = { // DP on
    {1,1,1,1,0,1,1,1}, //9
    {1,1,1,1,1,1,1,1}, //8
    {1,1,1,0,0,0,0,1}, //7
    {1,0,1,1,1,1,1,1}, //6
    {1,0,1,1,0,1,1,1}, //5
    {0,1,1,0,0,1,1,1}, //4
    {1,1,1,1,0,0,1,1}, //3
    {1,1,0,1,1,0,1,1}, //2
    {0,1,1,0,0,0,0,1}, //1
    {1,1,1,1,1,1,0,1} //0
    };
    int Numset_DPx[10][8] = { // DP off
    {1,1,1,1,0,1,1,0}, //9
    {1,1,1,1,1,1,1,0}, //8
    {1,1,1,0,0,0,0,0}, //7
    {1,0,1,1,1,1,1,0}, //6
    {1,0,1,1,0,1,1,0}, //5
    {0,1,1,0,0,1,1,0}, //4
    {1,1,1,1,0,0,1,0}, //3
    {1,1,0,1,1,0,1,0}, //2
    {0,1,1,0,0,0,0,0}, //1
    {1,1,1,1,1,1,0,0} //0
    };
    
    unsigned int BUZZ = 10;
    unsigned int TONE = 392;
    
    void setup(){
    Serial.begin(9600); // Pc - Arduino
    mySerial.begin(9600); // Arduino - Bluetooth
    for (int i=0; i<10; i++){
    pinMode(LedNum[i], OUTPUT);
    }
    pinMode(BUZZ, OUTPUT); // For BUZZ
    }
    
    void loop(){
    if (mySerial.available()) { // Bluetooth -> Arduino
    Serial.write(Serial.read());
    Data = mySerial.read();
    if (Data == '1'){
    mySerial.println("T-10 Seconds, Ready for Launch");
    for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
    for(int l=0; l<5; l++){
    for(int k=0; k<8; k++){
    digitalWrite(LedNum[9],LOW);
    digitalWrite(LedNum[8],HIGH);
    digitalWrite(LedNum[k],Numset_DPx[j][k]);
    }
    delay(9);
    for(int k=0; k<8; k++){
    digitalWrite(LedNum[8],LOW);
    digitalWrite(LedNum[9],HIGH);
    digitalWrite(LedNum[k],Numset_DPo[i][k]);
    }
    delay(9);
    }
    }
    Data = mySerial.read();
    if (Data == '0'){ // Whenever you want, you can stop System
    mySerial.println("Emergency Stop !");
    while(1) {
    digitalWrite(BUZZ, LOW);
    tone(BUZZ, TONE);
    delay(500);
    tone(BUZZ, TONE);
    digitalWrite(BUZZ,HIGH);
    noTone(BUZZ);
    delay(2000);
    }
    }
    digitalWrite(BUZZ, LOW);
    tone(BUZZ, TONE);
    delay(100);
    digitalWrite(BUZZ,HIGH);
    noTone(BUZZ);
    }
    mySerial.println("We have lift off");
    while(1){
    for(int i=0; i<10; i++){
    digitalWrite(LedNum[8],LOW);
    digitalWrite(LedNum[9],LOW);
    digitalWrite(LedNum[i],Numset_DPx[10][i]);
    digitalWrite(BUZZ, LOW);
    tone(BUZZ, TONE);
    }
    }
    }
    }
    else {
    mySerial.println("Waiting for the Launch Signal...");
    delay(2500);
    }
    }


    You probably wonder why the delay is 9.
    The basic principle of operation is to allocate high speed on switching between 2 and 1 digit that you can't recognize the discontinuousness. (Normal person can't recognize delay of under 10)
    There is allocated delay for buzzer and Arduino isn't operated in exact time, so 10 delay isn't good.
    You can re-adjust delay time by your phone stopwatch.

    It's just an practice program for launch system so I will put ignition system for real launch with Nichrome wire.




    Thanks for your reading and I hope you got what you wanted !

     

    Thanks for people who give me Inspiration and Source.

    댓글