Term project: Demo

Term - project Demo video


Below is open source that will be used.

#include <LCD5110_Graph.h>
LCD5110 myGLCD(A0,A1,A2,A3,A4);
extern uint8_t SmallFont[];
const int ServoA = 11;
const int ServoB = 10;
const int ServoC = 9;
const int ServoD = 6;
const int clockwise = 1700;
const int counterclockwise = 1300;
const int ButtonA = 8;
const int ButtonB = 7;
const int ButtonC = 5;
const int ButtonD = 4;
const int LEDready = 13;
const int coinInsert = 12;
long previousMillis = 0;
long intervalIdle = 500;
int LEDreadyState = LOW;
int y1= 0; int y2= 10; //position shifters for LCD txt
void setup() {    
     myGLCD.InitLCD(); 
     myGLCD.setFont(SmallFont); 
     myGLCD.setContrast(70); 
     pinMode(ButtonA, INPUT_PULLUP);
     pinMode(ButtonB, INPUT_PULLUP);
     pinMode(ButtonC, INPUT_PULLUP); 
     pinMode(ButtonD, INPUT_PULLUP); 
     
     pinMode(LEDready, OUTPUT); 
     pinMode(coinInsert, INPUT_PULLUP); 
     myGLCD.invert(true); 
     myGLCD.print("VenDuino", CENTER, 1); 
     myGLCD.print("by Ryan", CENTER, 10); 
     myGLCD.print("(c) 2017", CENTER, 30);
     myGLCD.drawRoundRect(13, 0, 70, 8);
     myGLCD.drawRect(0, 20, 83, 47); 
     myGLCD.update(); delay(1000); 
     myGLCD.clrScr();
     myGLCD.update();          } 
 void loop()
 //--Blink Ready LED---------------------------------------------------
       unsigned long currentMillis = millis(); 
          if(currentMillis - previousMillis >= intervalIdle) { // save the last time you blinked the LED             previousMillis = currentMillis; 
            if (LEDreadyState == LOW){     // if the LED is off turn it on and vice-versa: 
                   LEDreadyState = HIGH; 
                   myGLCD.clrScr(); 
                 myGLCD.print("Please insert", CENTER, y1); 
                 myGLCD.print(" $0.25. ", CENTER, y2);    
                 myGLCD.invert(false); 
                 myGLCD.update();               }
         else
              LEDreadyState = LOW;
              digitalWrite(LEDready, LEDreadyState);// set the LED with the ledState of the variable:
              y1=y1 +5; y2=y2+5; //shift the text position down 
              if ((y1==35) && (y2== 45)) //when the text almost goes off-screen, move it back up 
                     {y1=0; y2=10; } 
      }
 //---Wait for Coin/Credit---------------------------------------------------------------
while (digitalRead(coinInsert)==LOW) { //if coin inserted stay in servo enable loop 
     digitalWrite(LEDready, HIGH); 
     myGLCD.clrScr();     myGLCD.update(); 
     myGLCD.print("Please make", CENTER, 0); 
     myGLCD.print(" a selection. ", CENTER, 10);
     myGLCD.drawRect(20, 20, 63, 47); 
     myGLCD.drawRect(20, 20, 41, 47); 
     myGLCD.drawRect(20, 20, 63, 34); 
     myGLCD.update(); 
     servoEnable();                                         }
}
void servoEnable(){ 
while (digitalRead(ButtonA) == HIGH || digitalRead(ButtonB) == HIGH ||
digitalRead(ButtonC) == HIGH || digitalRead(ButtonD) == HIGH) {
   //---------Servo A---------------------------------------------------- 
     if ((digitalRead(ButtonA) == LOW) ) { 
            for(int i=0; i<2; i++)
         {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); }
myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);
myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("A1", 25, 24); 
 myGLCD.update();
     for(int i=0; i<57; i++) // change this to adjust +- full revolution 
        { 
         digitalWrite(ServoA,HIGH); 
         delayMicroseconds(clockwise); 
         digitalWrite(ServoA,LOW); 
         delay(18.5); // 18.5ms
          //delay(50); enable this line to slow servo rotation
          } 
          break;                                                  } // when item is dispensed exit loop and return to wait for
  coin 
        //---------Servo B---------------------------------------------------- 
         if ((digitalRead(ButtonB) == LOW) ) { 
              for(int i=0; i<2; i++) 
              {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); }    
        myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
        myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);
        myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("B1", 46, 24); 
        myGLCD.update();
            for(int i=0; i<57; i++) 
              { 
              digitalWrite(ServoB,HIGH);
              delayMicroseconds(clockwise); 
              digitalWrite(ServoB,LOW); 
              delay(18.5); // 18.5ms 
               //delay(50); 
               } 
             break;                                                             }
           //---------Servo C----------------------------------------------------
           if ((digitalRead(ButtonC) == LOW) ) {
               for(int i=0; i<2; i++) 
               {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); } 
         myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
         myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);
         myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("C2", 25, 37); 
         myGLCD.update(); 
             for(int i=0; i<57; i++)
            {
             digitalWrite(ServoC,HIGH); 
             delayMicroseconds(clockwise); 
             digitalWrite(ServoC,LOW); 
             delay(18.5); // 18.5ms 
              //delay(50);
              } break;                                                               }
  //---------Servo D---------------------------------------------------- 
 if ((digitalRead(ButtonD) == LOW) ) { 
      for(int i=0; i<2; i++) 
    {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); } 
   myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
   myGLCD.drawRect(20, 20,63,7); myGLCD.drawRect(20, 20, 41, 47);
   myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("D2", 46, 37); 
   myGLCD.update(); 
        for(int i=0; i<57; i++) 
          { 
          digitalWrite(ServoD,HIGH); 
          delayMicroseconds(clockwise); 
           digitalWrite(ServoD,LOW); 
           delay(18.5); // 18.5ms 
            //delay(50);
            } 
            break;                                         }                                                                                                        
                                                                                                  }
   }


Term project: proposal

Term-Project 제안서
     
2017103733 소프트웨어융합학과 우수진
이름 자율주행자동차 사고방지 소프트웨어
사용도구 : ultrasonic distance sensor, RC아두이노 키트
목표 사고방지 소프트웨어를 통해 차량간격이 적정 간격으로 유지될 수 있도록 함으로써 충돌사고와 이로 인한 인명피해 등을 방지할 수 있도록 하고자 한다.
영감 : “고속도로에 자율주행 자동차가 달리고 있을 때 뒤차와의 간격이 가까워지면 앞서가던 자동차는 거리 유지를 위해 속도를 높인다같은 시각 뒤차는 앞차와의 충돌 위험을 줄이기 위해 속도를 줄인다이로써 두 자율주행 자동차 사이의 간격이 벌어지자그 사이에 또 다른 차량이 끼어든다이 차선 변경으로 인해 이번에는 세 차량 모두가 속도를 변경하는 상황이 벌어진다문제는 고속도로에 이 세 차량만 주행 중인 것이 아니며그 앞뒤좌우로 다른 여러 자동차들이 달리고 있다는 점이다.” 이 글을 보고서 적정 차량간격유지를 위해  최소한의 차량의 속도변화를 줄 수 있게되면 에너지 등 여러방면에서 효율적일 것 이라는 생각을 하게 되었다.
원리 한 자율주행자동차가 도로를 달리고 있을 때 앞뒤로 두 대의 차량이 있다고 가정한다이때 가운데 자율자동차는 센서를 통해서 거리를 받는다앞뒤 간격을 초음파 센서를 통해 수집하고 이를 2로 나누어 적정 간격을 유지하게 된다.
한계점 : ultrasonic distance sensor의 distance range는 2cm to 400cm이기 때문에 실질적인 상황에 적용하기 위해서는 distance range가 더 큰 센서가 요구될 것이다또한 실질적으로 자율주행 시에는 세대 이상의 차량이 나란히 있는 경우가 훨씬 많을 것이다따라서 이때 어떤 차량의 속도를 조절해야 최소한의 차량의 속도변화를 주게 되는지에 대해서는 더 복잡한 과정이 요구될 거라 생각한다. 뿐만아니라 실제 도로에서는 자율주행 자동차와 인간이 컨트롤하는 자동차가 뒤섞이게 될것이다. 이 경우에는 더욱 복잡한 케이스까지 다룰 수 있도록 함으로써 한계점을 극복할 수 있어야 할 것이다.
참고 문헌 :

How to install M.2 SSD 512GB in laptop

* Details The old one: M.2 SATA3 128GB 2280 The new one: M.2 SATA3 512GB 2280

2017년 11월 11일 토요일

Term project: Demo

Term - project Demo video


Below is open source that will be used.

#include <LCD5110_Graph.h>
LCD5110 myGLCD(A0,A1,A2,A3,A4);
extern uint8_t SmallFont[];
const int ServoA = 11;
const int ServoB = 10;
const int ServoC = 9;
const int ServoD = 6;
const int clockwise = 1700;
const int counterclockwise = 1300;
const int ButtonA = 8;
const int ButtonB = 7;
const int ButtonC = 5;
const int ButtonD = 4;
const int LEDready = 13;
const int coinInsert = 12;
long previousMillis = 0;
long intervalIdle = 500;
int LEDreadyState = LOW;
int y1= 0; int y2= 10; //position shifters for LCD txt
void setup() {    
     myGLCD.InitLCD(); 
     myGLCD.setFont(SmallFont); 
     myGLCD.setContrast(70); 
     pinMode(ButtonA, INPUT_PULLUP);
     pinMode(ButtonB, INPUT_PULLUP);
     pinMode(ButtonC, INPUT_PULLUP); 
     pinMode(ButtonD, INPUT_PULLUP); 
     
     pinMode(LEDready, OUTPUT); 
     pinMode(coinInsert, INPUT_PULLUP); 
     myGLCD.invert(true); 
     myGLCD.print("VenDuino", CENTER, 1); 
     myGLCD.print("by Ryan", CENTER, 10); 
     myGLCD.print("(c) 2017", CENTER, 30);
     myGLCD.drawRoundRect(13, 0, 70, 8);
     myGLCD.drawRect(0, 20, 83, 47); 
     myGLCD.update(); delay(1000); 
     myGLCD.clrScr();
     myGLCD.update();          } 
 void loop()
 //--Blink Ready LED---------------------------------------------------
       unsigned long currentMillis = millis(); 
          if(currentMillis - previousMillis >= intervalIdle) { // save the last time you blinked the LED             previousMillis = currentMillis; 
            if (LEDreadyState == LOW){     // if the LED is off turn it on and vice-versa: 
                   LEDreadyState = HIGH; 
                   myGLCD.clrScr(); 
                 myGLCD.print("Please insert", CENTER, y1); 
                 myGLCD.print(" $0.25. ", CENTER, y2);    
                 myGLCD.invert(false); 
                 myGLCD.update();               }
         else
              LEDreadyState = LOW;
              digitalWrite(LEDready, LEDreadyState);// set the LED with the ledState of the variable:
              y1=y1 +5; y2=y2+5; //shift the text position down 
              if ((y1==35) && (y2== 45)) //when the text almost goes off-screen, move it back up 
                     {y1=0; y2=10; } 
      }
 //---Wait for Coin/Credit---------------------------------------------------------------
while (digitalRead(coinInsert)==LOW) { //if coin inserted stay in servo enable loop 
     digitalWrite(LEDready, HIGH); 
     myGLCD.clrScr();     myGLCD.update(); 
     myGLCD.print("Please make", CENTER, 0); 
     myGLCD.print(" a selection. ", CENTER, 10);
     myGLCD.drawRect(20, 20, 63, 47); 
     myGLCD.drawRect(20, 20, 41, 47); 
     myGLCD.drawRect(20, 20, 63, 34); 
     myGLCD.update(); 
     servoEnable();                                         }
}
void servoEnable(){ 
while (digitalRead(ButtonA) == HIGH || digitalRead(ButtonB) == HIGH ||
digitalRead(ButtonC) == HIGH || digitalRead(ButtonD) == HIGH) {
   //---------Servo A---------------------------------------------------- 
     if ((digitalRead(ButtonA) == LOW) ) { 
            for(int i=0; i<2; i++)
         {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); }
myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);
myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("A1", 25, 24); 
 myGLCD.update();
     for(int i=0; i<57; i++) // change this to adjust +- full revolution 
        { 
         digitalWrite(ServoA,HIGH); 
         delayMicroseconds(clockwise); 
         digitalWrite(ServoA,LOW); 
         delay(18.5); // 18.5ms
          //delay(50); enable this line to slow servo rotation
          } 
          break;                                                  } // when item is dispensed exit loop and return to wait for
  coin 
        //---------Servo B---------------------------------------------------- 
         if ((digitalRead(ButtonB) == LOW) ) { 
              for(int i=0; i<2; i++) 
              {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); }    
        myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
        myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);
        myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("B1", 46, 24); 
        myGLCD.update();
            for(int i=0; i<57; i++) 
              { 
              digitalWrite(ServoB,HIGH);
              delayMicroseconds(clockwise); 
              digitalWrite(ServoB,LOW); 
              delay(18.5); // 18.5ms 
               //delay(50); 
               } 
             break;                                                             }
           //---------Servo C----------------------------------------------------
           if ((digitalRead(ButtonC) == LOW) ) {
               for(int i=0; i<2; i++) 
               {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); } 
         myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
         myGLCD.drawRect(20, 20, 63, 47); myGLCD.drawRect(20, 20, 41, 47);
         myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("C2", 25, 37); 
         myGLCD.update(); 
             for(int i=0; i<57; i++)
            {
             digitalWrite(ServoC,HIGH); 
             delayMicroseconds(clockwise); 
             digitalWrite(ServoC,LOW); 
             delay(18.5); // 18.5ms 
              //delay(50);
              } break;                                                               }
  //---------Servo D---------------------------------------------------- 
 if ((digitalRead(ButtonD) == LOW) ) { 
      for(int i=0; i<2; i++) 
    {digitalWrite(LEDready, HIGH); delay(50); digitalWrite(LEDready, LOW); delay(50); } 
   myGLCD.clrScr(); myGLCD.print("Vending", CENTER, 0);
   myGLCD.drawRect(20, 20,63,7); myGLCD.drawRect(20, 20, 41, 47);
   myGLCD.drawRect(20, 20, 63, 34); myGLCD.print("D2", 46, 37); 
   myGLCD.update(); 
        for(int i=0; i<57; i++) 
          { 
          digitalWrite(ServoD,HIGH); 
          delayMicroseconds(clockwise); 
           digitalWrite(ServoD,LOW); 
           delay(18.5); // 18.5ms 
            //delay(50);
            } 
            break;                                         }                                                                                                        
                                                                                                  }
   }


2017년 10월 18일 수요일

Term project: proposal

Term-Project 제안서
     
2017103733 소프트웨어융합학과 우수진
이름 자율주행자동차 사고방지 소프트웨어
사용도구 : ultrasonic distance sensor, RC아두이노 키트
목표 사고방지 소프트웨어를 통해 차량간격이 적정 간격으로 유지될 수 있도록 함으로써 충돌사고와 이로 인한 인명피해 등을 방지할 수 있도록 하고자 한다.
영감 : “고속도로에 자율주행 자동차가 달리고 있을 때 뒤차와의 간격이 가까워지면 앞서가던 자동차는 거리 유지를 위해 속도를 높인다같은 시각 뒤차는 앞차와의 충돌 위험을 줄이기 위해 속도를 줄인다이로써 두 자율주행 자동차 사이의 간격이 벌어지자그 사이에 또 다른 차량이 끼어든다이 차선 변경으로 인해 이번에는 세 차량 모두가 속도를 변경하는 상황이 벌어진다문제는 고속도로에 이 세 차량만 주행 중인 것이 아니며그 앞뒤좌우로 다른 여러 자동차들이 달리고 있다는 점이다.” 이 글을 보고서 적정 차량간격유지를 위해  최소한의 차량의 속도변화를 줄 수 있게되면 에너지 등 여러방면에서 효율적일 것 이라는 생각을 하게 되었다.
원리 한 자율주행자동차가 도로를 달리고 있을 때 앞뒤로 두 대의 차량이 있다고 가정한다이때 가운데 자율자동차는 센서를 통해서 거리를 받는다앞뒤 간격을 초음파 센서를 통해 수집하고 이를 2로 나누어 적정 간격을 유지하게 된다.
한계점 : ultrasonic distance sensor의 distance range는 2cm to 400cm이기 때문에 실질적인 상황에 적용하기 위해서는 distance range가 더 큰 센서가 요구될 것이다또한 실질적으로 자율주행 시에는 세대 이상의 차량이 나란히 있는 경우가 훨씬 많을 것이다따라서 이때 어떤 차량의 속도를 조절해야 최소한의 차량의 속도변화를 주게 되는지에 대해서는 더 복잡한 과정이 요구될 거라 생각한다. 뿐만아니라 실제 도로에서는 자율주행 자동차와 인간이 컨트롤하는 자동차가 뒤섞이게 될것이다. 이 경우에는 더욱 복잡한 케이스까지 다룰 수 있도록 함으로써 한계점을 극복할 수 있어야 할 것이다.
참고 문헌 :