산업 제조
산업용 사물 인터넷 | 산업자재 | 장비 유지 보수 및 수리 | 산업 프로그래밍 |
home  MfgRobots >> 산업 제조 >  >> Manufacturing Technology >> 제조공정

Arduino + GPS 모듈 - 목적지 알림

구성품 및 소모품

Arduino UNO
× 1
GPS 모듈(일반)
NEO-6M GPS 모듈
× 1
LED(일반)
× 1
Texas Instruments 듀얼 H-Bridge 모터 드라이버 L293D
× 1
Brown Dog Gadgets 태양 바퀴벌레 진동 디스크 모터
× 1
SparkFun 스냅 가능 프로토보드
× 1
9V 배터리(일반)
× 1
9V 대 배럴 잭 커넥터
× 1
상자
프로젝트를 묶을 것
× 1
점퍼 와이어(일반)
× 1

필요한 도구 및 기계

납땜 인두(일반)
와이어 스트리퍼

앱 및 온라인 서비스

Arduino IDE

이 프로젝트 정보

소개:문제 및 솔루션

교통 체증이 시간 낭비라는 사실은 누구나 알고 있습니다. 그리고 출발지에서 목적지까지 얼마나 걸릴지 예측할 수 없습니다.

두 달 전에 도시에 왔을 때 교통 체증 문제가 영향을 미쳤습니다. 나는 매일 2시간 이상을 잼에 갇힌 채 보낸다. 그리고 나는 왜 이 시간을 뭔가 하는 데 활용하지 못하는가 하는 생각이 들었습니다.

참고로 저는 대중교통을 이용합니다. :-)

교통 체증에 갇힌 상태에서 할 수 있는 다른 일들이 많이 있습니다!

아래 내용 중 일부는 재미있을 뿐만 아니라 생산적입니다.

<울>
  • 현재 및 미래 프로젝트에 대해 생각하고 계획하는 데 시간을 사용합니다.
  • 시간을 활용하여 Udemy, Coursera 등에서 자신을 교육하거나 교육 동영상을 시청하거나 e-Learning 과정을 수강하십시오.
  • 물론 만드는 전자 제품은 항상 저에게 영감을 줍니다. 그래서 Arduino와 GPS 모듈을 사용하여 목적지 알리미를 만들었습니다. 그래서 목적지에 가까울 때마다 LED를 켜거나 진동(미니 진동 모터 사용)을 통해 알려줍니다. LED와 진동 모터 모두에 대한 회로를 제공했습니다.

    이를 위해서는 먼저 위도와 경도를 찾아 위치를 정의해야 합니다. 위치를 찾으면 위도 및 경도 값을 사용하여 위치까지의 거리를 찾고 범위를 유지하여 알리미를 켤 수 있습니다. 논리가 간단하죠?!

    그럼 시작하겠습니다........

    부품 및 도구:

    목적지 알리미를 시작하기 위해 필요한 부분은 다음과 같습니다.

    <울>
  • 아두이노 UNO
  • <울>
  • NEO-6M GPS 모듈
  • GPS 글로벌 포지셔닝 시스템의 약자이며 이동 중인 경우 위치, 시간 및 속도를 결정하는 데 사용할 수 있습니다.

    <울>
  • 이 모듈에는 외부 안테나와 내장 EEPROM이 있습니다.
  • 인터페이스:RS232 TTL
  • 전원 공급 장치:3V ~ 5V
  • 기본 전송 속도:9600bps
  • 표준 NMEA 문장 사용
  • NEO-6M GPS 모듈에는 VCC, RX, TX 및 GND의 4가지 핀이 있습니다. 모듈은 TX 및 RX 핀을 사용하여 직렬 통신을 통해 Arduino와 통신하므로 배선이 더 간단할 수 없습니다.

    NEO-6M GPS 모듈아두이노 UNO에 배선

    VCC VIN

    소프트웨어 직렬에 정의된 RX TX 핀

    소프트웨어 직렬에 정의된 TX RX 핀

    GND GND

    L293D IC

    L293D는 16핀 모터 드라이버 IC로 어느 방향에서든 최대 2개의 DC 모터를 동시에 제어할 수 있습니다.

    L293D를 사용하는 이유는 무엇입니까?

    모터 드라이버 IC 또는 모터 드라이버에 대한 입력은 저전류 신호입니다. 회로의 기능은 저전류 신호를 고전류 신호로 변환하는 것입니다. 이 고전류 신호는 모터에 제공됩니다.

    TinyGPS++ 라이브러리 :

    TinyGPS++ 라이브러리를 사용하면 유용하고 이해하기 쉬운 형식으로 위치 정보를 쉽게 얻을 수 있습니다.

    TinyGPS++ 라이브러리를 사용하면 위치보다 더 많은 정보를 얻을 수 있으며 간단한 방법으로 위치 외에 다음을 얻을 수 있습니다.

    >>날짜

    >>시간

    >>속도

    >>과정

    >>고도

    >>위성

    >>HDOP

    위도 및 경도 캡처:

    더 나은 연결을 위해 프로젝트 마지막에 제공된 fritzing 파일을 다운로드하는 것이 좋습니다. 의심스러운 점이 있으면 언제든지 댓글로 질문해 주세요.

    위치 캡처를 위한 Arduino 코드:

    #include 
    #include
    정적 const int RXPin =4, TXPin =3;
    정적 const uint32_t GPSBaud =9600;
    // TinyGPS++ 개체
    TinyGPSPlus gps;
    // GPS 장치에 대한 직렬 연결
    SoftwareSerial ss(RXPin, TXPin);
    void setup(){
    Serial.begin(9600);
    ss.begin(GPSBaud);
    }
    void loop(){
    // 이 스케치는 새로운 문장이 올바르게 인코딩되었습니다.
    while (ss.available()> 0){
    gps.encode(ss.read());
    if (gps.location.isUpdated()){
    Serial.print("위도=");
    Serial.print(gps.location.lat(), 6);
    Serial.print(" 경도 =");
    Serial.println(gps.location.lng(), 6);
    }
    }
    }

    참고:설치해야 합니다. TinyGPS++ 라이브러리

    회로도에 따라 연결하고 위의 코드를 업로드하고 9600의 전송 속도에서 직렬 모니터를 열면 다음 출력이 표시됩니다.

    참고: 위도와 경도를 얻으려면 시간이 걸릴 수 있습니다. 수신기가 신호를 캡처해야 하기 때문입니다. 신호를 받기 시작할 때마다 GPS 모듈의 LED가 깜박입니다.

    LED를 통한 목적지 알림:

    그래서 내 아이디어가 제대로 작동하는지 확인하기 위해 LED를 사용하여 대상을 알리는 프로토타입을 만들었습니다. 그래서 내가 한 것은 이전 코드(Read_Lat_Lng.ino)에서 목적지의 위도 및 경도 값을 추가하고 현재 위치에서 목적지까지의 거리를 찾은 것입니다. 그리고 LED가 켜져야 하는 범위를 설정하는데 사용합니다.

    코드:

    #include 
    #include
    정적 const int RXPin =4, TXPin =3;
    정적 const uint32_t GPSBaud =9600;
    // TinyGPS++ 개체
    TinyGPSPlus gps;
    // GPS 장치에 대한 직렬 연결
    SoftwareSerial ss(RXPin, TXPin);
    // 5초마다 발생
    unsigned long last =0UL;
    int ledPin =13;
    void setup()
    {
    Serial.begin(115200);
    ss.begin(GPSBaud);
    pinMode(ledPin, OUTPUT);
    }
    void loop()
    {
    // 들어오는 문자 전달
    while (ss.available()> 0)
    gps.encode(ss.read());
    if (gps.location.isUpdated())
    {
    직렬. print(F(" 위도="));
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(" Long="));
    Serial.println(gps.location.lng(), 6);
    }
    else if (millis() - 마지막> 5000)
    {
    Serial.println();
    if (gps.location.isValid())
    {
    // 'Dest_LAT' 및 'Dest_LON' 값 bas 대체 edon your location
    // 위도와 경도는 Read_Lat_Lng.ino에서 찾을 수 있습니다.
    static const double Dest_LAT =18.786254, Dest_LON =73.880798;
    double distanceToDest =
    TinyGPSPlus::distanceBetween
    gps.location.lat(),
    gps.location.lng(),
    Dest_LAT,
    Dest_LON);
    Serial.print(F("까지의 거리 대상 =));
    Serial.print(distanceToDest/1000, 6); // *목적지까지의 거리를 출력합니다.
    if(distanceToDest/1000 <0.050000) //여기서 distanceToDest/1000이 0.050000보다 작으면 LED가 켜집니다. 따라서 요구 사항에 따라 *distance를 목적지까지 변경하십시오.
    {
    digitalWrite(ledPin, HIGH);
    }
    else
    {
    digitalWrite(ledPin, LOW);
    }
    }
    if (gps.charsProcessed() <10)
    Serial.println(F("경고:GPS 데이터가 없습니다. 배선을 확인하십시오."));
    last =millis();
    Serial.println();
    }
    }

    코드를 업로드하면 직렬 모니터에 다음과 같이 표시됩니다.

    따라서 목적지까지의 거리는 출력 작업(알림)이 수행되어야 하는 범위를 정의하는 데 사용할 수 있습니다.

    마지막!

    내 프로토타입이 제대로 작동했습니다. 이제 Arduino, GPS 모듈, 드라이버 IC가 있는 모터 및 9V 전원 공급 장치를 넣을 수 있는 상자에 프로젝트를 묶고 싶습니다.

    L293D IC에 연결

    <울>
  • 5V를 연결하여 L293D에서 1, Vs 및 Vss 활성화
  • 디지털 출력 핀(6과 7 사용)을 L293D의 입력 1과 입력 2에 연결합니다.
  • Arduino의 GND를 L293D의 같은 쪽에 있는 두 GND 핀에 연결합니다.
  • 마지막으로 L293D의 출력 1과 출력 2를 모터 핀에 연결합니다.
  • 코드:

    #include 
    #include
    정적 const int RXPin =4, TXPin =3;
    정적 const uint32_t GPSBaud =9600;
    // TinyGPS++ 개체
    TinyGPSPlus gps;
    // GPS 장치에 대한 직렬 연결
    SoftwareSerial ss(RXPin, TXPin);
    // 5초마다 발생
    unsigned long last =0UL;
    int motorpin1=6;
    int motorpin2=7;
    void setup()
    {
    직렬 .begin(115200);
    ss.begin(GPSBaud);
    pinMode(motorpin1,OUTPUT);
    pinMode(motorpin2,OUTPUT);
    }
    무효 루프 ()
    {
    // 들어오는 문자 전달
    while (ss.available()> 0)
    gps.encode(ss.read());
    if (gps.location.isUpdated())
    {
    Serial.print(F(" Lat="));
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(" Long="));
    Serial.println(gps.location.lng(), 6);
    }
    else if (millis( ) - 마지막> 5000)
    {
    Serial.println();
    if (gps.location.isValid())
    {
    // 위치를 기반으로 'Dest_LAT' 및 'Dest_LON' 값 바꾸기
    // Read_Lat_Lng.ino에서 위도 및 경도를 찾을 수 있습니다.
    static const double Dest_LAT =18.786254, Dest_LON =73.880798;
    double distanceToDest =
    TinyGPSPlus::distanceBetween(
    gps.location.lat(),
    gps.location.lng(),
    Dest_LAT,
    Dest_LON);
    Serial.print(F("목적지까지의 거리 ="));
    Serial.print(distanceToDest/1000, 6); // *목적지까지의 거리를 출력합니다.
    if(distanceToDest/1000 <0.050000) //여기서 distanceToDest/1000이 0.050000보다 작으면 LED가 켜집니다. 따라서 요구 사항에 따라 *distance를 목적지까지 변경하십시오.
    {
    digitalWrite(motorpin1,LOW);
    digitalWrite(motorpin2,HIGH);
    }
    else
    {
    digitalWrite(motorpin1, HIGH);
    digitalWrite(모터핀2,HIGH);
    }
    }
    if (gps.charsProcessed() <10)
    Serial.println(F("경고:GPS 데이터가 없습니다. 배선을 확인하십시오."));
    마지막 =millis();
    Serial.println();
    }
    }

    즐거운 만들기

    <섹션 클래스="섹션 컨테이너 섹션 축소 가능" id="코드">

    코드

    <울>
  • Read_Lat_Lng.ino 읽기
  • Destination_notifier_LED.ino
  • Destination_notifier_motor.ino
  • Read_Lat_Lng.ino아두이노
     #include #include static const int RXPin =4, TXPin =3;static const uint32_t GPSBaud =9600;// TinyGPS++ objectTinyGPSPlus gps;// GPS에 대한 직렬 연결 deviceSoftwareSerial ss(RXPin, TXPin); 무효 설정(){ Serial.begin(9600); ss.begin(GPSBaud);}void loop(){ // 이 스케치는 새 문장이 올바르게 인코딩될 때마다 정보를 표시합니다. 동안 (ss.available()> 0){ gps.encode(ss.read()); if (gps.location.isUpdated()){ Serial.print("위도="); Serial.print(gps.location.lat(), 6); Serial.print(" 경도="); Serial.println(gps.location.lng(), 6); } }}
    Destination_notifier_LED.inoArduino
    #include #include static const int RXPin =4, TXPin =3;static const uint32_t GPSBaud =9600;// TinyGPS++ objectTinyGPSPlus gps;// GPS에 대한 직렬 연결 deviceSoftwareSerial ss(RXPin, TXPin);// 5초마다 발생하는 통계에 대해 unsigned long last =0UL;int ledPin =13;void setup(){ Serial.begin(115200); ss.begin(GPSBaud);pinMode(ledPin, OUTPUT);}void loop(){ // 들어오는 문자를 전달합니다. while (ss.available()> 0) gps.encode(ss.read()); if (gps.location.isUpdated()) { Serial.print(F(" Lat=")); Serial.print(gps.location.lat(), 6); Serial.print(F(" Long=")); Serial.println(gps.location.lng(), 6); } else if (millis() - 마지막> 5000) { Serial.println(); if (gps.location.isValid()) { // 위치에 따라 'Dest_LAT' 및 'Dest_LON' 값 바꾸기 // Read_Lat_Lng.ino에서 위도와 경도를 찾을 수 있습니다. static const double Dest_LAT =18.786254, Dest_LON =73.880798; 이중 distanceToDest =TinyGPSPlus::distanceBetween( gps.location.lat(), gps.location.lng(), Dest_LAT, Dest_LON); Serial.print(F("목적지까지의 거리 =")); Serial.print(distanceToDest/1000, 6); // *목적지까지의 거리를 출력 if(distanceToDest/1000 <0.050000) //여기서 distanceToDest/1000이 0.050000보다 작으면 LED가 켜진다. 따라서 요구 사항에 따라 *distance를 목적지까지 변경하십시오. { 디지털 쓰기(LED 핀, 높음); } else { digitalWrite(ledPin, LOW); } } if (gps.charsProcessed() <10) Serial.println(F("경고:GPS 데이터가 없습니다. 배선을 확인하십시오.")); 마지막 =millis(); 직렬.println(); }}
    Destination_notifier_motor.inoArduino
    #include #include static const int RXPin =4, TXPin =3;static const uint32_t GPSBaud =9600;// TinyGPS++ objectTinyGPSPlus gps;// GPS에 대한 직렬 연결 deviceSoftwareSerial ss(RXPin, TXPin);// 5초마다 발생하는 통계에 대해 unsigned long last =0UL;int motorpin1=6;int motorpin2=7;void setup(){ Serial.begin(115200); ss.begin(GPSBaud); 핀모드(모터핀1, 출력); 핀모드(모터핀2, 출력); }void loop(){ // 들어오는 문자를 전달 while (ss.available()> 0) gps.encode(ss.read()); if (gps.location.isUpdated()) { Serial.print(F(" Lat=")); Serial.print(gps.location.lat(), 6); Serial.print(F(" Long=")); Serial.println(gps.location.lng(), 6); } else if (millis() - 마지막> 5000) { Serial.println(); if (gps.location.isValid()) { // 위치에 따라 'Dest_LAT' 및 'Dest_LON' 값 바꾸기 // Read_Lat_Lng.ino에서 위도와 경도를 찾을 수 있습니다. static const double Dest_LAT =18.786254, Dest_LON =73.880798; 이중 distanceToDest =TinyGPSPlus::distanceBetween( gps.location.lat(), gps.location.lng(), Dest_LAT, Dest_LON); Serial.print(F("목적지까지의 거리 =")); Serial.print(distanceToDest/1000, 6); // *목적지까지의 거리를 출력 if(distanceToDest/1000 <0.050000) //여기서 distanceToDest/1000이 0.050000보다 작으면 LED가 켜진다. 따라서 귀하의 요구 사항에 따라 *distance를 목적지까지 변경하십시오. { 디지털 쓰기(모터핀1,낮음); 디지털 쓰기(모터핀2, 높음); } else { digitalWrite(motorpin1, HIGH); 디지털 쓰기(모터핀2, 높음); } } if (gps.charsProcessed() <10) Serial.println(F("경고:GPS 데이터가 없습니다. 배선을 확인하십시오.")); 마지막 =millis(); 직렬.println(); }}

    회로도

    read_lat_lng_l3VSL54w0k.fzz destination_notifier_led_c7qaqTImXg.fzz destination_notifier_motor_fGc8OV6Y0w.fzz

    제조공정

    1. Arduino 디지털 주사위
    2. JX 웨이브 생성기
    3. 아이언맨
    4. 나를 찾기
    5. Arduino 3D 인쇄 로봇 팔
    6. Arduino Mega를 NEO-6M GPS 모듈과 인터페이스하는 방법
    7. Arduino 가습기 제어
    8. U-blox LEA-6H 02 GPS 모듈(Arduino 및 Python 포함)
    9. NeoMatrix Arduino Pong
    10. Arduino 조이스틱