当前位置:网站首页>[Arduino connected to GPS module (NEO-6M) to read positioning data]

[Arduino connected to GPS module (NEO-6M) to read positioning data]

2022-08-02 04:32:00 WENJIE Technology

GPS信息

什么是全球定位系统

全球定位系统 (GPS) Is a satellite-based navigation system,由至少 24 颗卫星组成.GPS 全天 24 Work hours in any weather conditions,Work anywhere in the world,No subscription fees or set fee.

GPS的工作原理

GPS In satellite precise orbit around the earth twice a day.Each satellite transmission unique signal and orbital parameters,使 GPS Equipment can decode and calculation of the satellite precise location.GPS Receiver USES this information and trilateration to calculate the user's exact location.本质上,GPS Receiver transmission signal by receiving the amount of time required to measure the distance to each satellite.Through more satellite distance measurement,The receiver can determine the user's location and show it.

To calculate your two-dimensional position(纬度和经度)And track movement,GPS The receiver must be locked at least 3 颗卫星的信号.In view of 4 Or more satellites under the condition of,The receiver can determine your 3-D 位置(纬度、经度和高度).通常,GPS The receiver will track 8 Or more satellite,But it depends on the time of day and your location on the earth.

Identify your location,GPS Unit can calculate other information,例如:

速度
轴承
追踪
行程范围
到目的地的距离

什么信号?

GPS Satellite transmission at least 2 A low power radio signal.Signals travel through the line of sight,This means that they will through the clouds、玻璃和塑料,But not through the most solid objects,Such as buildings and mountains.然而,Modern receiver is more sensitive,Can usually track houses.

GPS 信号包含 3 Different types of information:

Are pseudo random code is to identify which satellite transmission of information ID 码.You can look up in the device's satellite on a page from which satellite signal.
Need to determine the location of the satellite ephemeris data,And provide relevant satellite health、The current date and time of the important information.
Calendar data tell GPS 接收器,每颗 GPS Satellite where should at any time of the day,And according to the satellite and the orbit of the system in all other satellites information.

NEO-6M GPS模块

NEO-6M GPS模块如下图所示.It has an external antenna,Without a plug pin.So you need to welding.
在这里插入图片描述
NEO-6M GPS芯片
该模块的核心是 u-blox 的 NEO-6M GPS 芯片.它可以在 50 A channel on track as much as 22 颗卫星,And reach the highest level of sensitivity,即 -161 dB 跟踪,同时仅消耗 45mA 电源电流.u-blox 6 Positioning the engine also has less than 1 Second positioning for the first time time (TTFF).The chip provides is one of the best features of power saving mode (PSM).It can selectively open and close the receiver of the parts to reduce the power consumption of the system.This module power consumption significantly reduced to only 11mA,使其适用于 GPS The application of the watches is sensitive to power.NEO-6M GPS Chip necessary data pin was broken up into“0.1” Spacing between joints.这包括通过 UART Communicate with micro controller needed pin.

注意:- Module support baud rate from 4800bps 到 230400bps,默认波特率为 9600.

在这里插入图片描述位置固定 LED 指示灯

NEO-6M GPS 模块上有一个 LED,Used to indicate a positioning state.It will according to the state it is shining with different rates

No Blinking ==> Said it was searching satellite
每 1 秒闪烁一次- Said it had found location
在这里插入图片描述3.3V LDO 稳压器
NEO-6M The working voltage of the chip as 2.7 至 3.6V.但是,The module is equipped withMICREL的MIC5205超低压差3V3稳压器.Logical pin also can withstand 5 伏电压,So we can easily connect it to the Arduino 或任何 5V 逻辑微控制器,Without using any logic level converter.

在这里插入图片描述电池和 EEPROM

The module is equipped with a HK24C32 Two-wire serial EEPROM.Its size is4KB,通过I2C连接到NEO-6M芯片.Button module also contains a rechargeable batteries,As a super capacitor.

EEPROM Together with the battery will help keep battery support RAM (BBR).BBR Contain clock data、The latest location data(GNSS Or a data)And the module configuration.But it does not mean that the permanent data storage.

Due to the battery to keep the clock and the final location,首次定位时间 (TTFF) 显着减少到 1 秒.This allows faster position lock.

如果没有电池,GPS Always cold start,因此初始 GPS The lock need more time.Electricity when the battery will automatically charge,And in the absence of power supply to keep data for up to two weeks.

在这里插入图片描述引脚排列:
在这里插入图片描述GND 是接地引脚,需要连接到 Arduino 上的 GND 引脚.
TxD(发送器)Pin is used for serial communication.
RxD(接收器)Pin is used for serial communication.
VCC 为模块供电.You can connect it directly to the Arduino 上的 5V 引脚.

Arduino UNO与GPS模块的连接

将 UBLOX The four pins connect to Arduino,如下所示:

GPS模块==> Arduino

接地 ==> 接地
TX ==> 数字引脚 (D3)
RX ==> 数字引脚 (D4)
VCC ==> 3.3 V
在这里,I suggest you use external power supply GPS 模块供电,因为 GPS The module is the minimum power requirement of 3.3 V,而 Arduino Can't provide so many voltage.

Arduino UNO与LCD的连接

LCD ==> Arduino

VSS ==> 接地
VCC ==> 5V
VEE ==> 10K 电阻
RS ==> A0(模拟引脚)
读/写 ==> 接地
E ==> A1
D4 ==> A2
D5 ==> A3
D6 ==> A4
D7 ==> A5
LED+ ==> VCC
LED- ==> GND

电路图

在这里插入图片描述在这里插入图片描述

安装GPS库文件

Library file has been uploaded to the personal home page.

代码

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>
//The latitude and longitude object
float lat = 37.5458,lon = 112.3303; //As the latitude and longitude object
SoftwareSerial gpsSerial(3,4);//rx,tx
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
TinyGPS gps; // 创建 GPS 对象
void setup(){
    
Serial.begin(9600); // 连接串口
//Serial.println("The GPS Received Signal:");
gpsSerial.begin(9600); // 连接gps传感器
lcd.begin(16,2);
}
 
void loop(){
    
    while(gpsSerial.available()){
     // 检查gps数据 data
    if(gps.encode(gpsSerial.read()))//编辑 gps 数据
    {
     
    gps.f_get_position(&lat,&lon); // 获取纬度和经度
    // 显示位置
    lcd.clear();
    lcd.setCursor(1,0);
    lcd.print("GPS Signal");
    //Serial.print("Position: ");
    //Serial.print("Latitude:");
    //Serial.print(lat,6);
    //Serial.print(";");
    //Serial.print("Longitude:");
    //Serial.println(lon,6); 
    lcd.setCursor(1,0);
    lcd.print("LAT:");
    lcd.setCursor(5,0);
    lcd.print(lat);
    //Serial.print(lat);
    //Serial.print(" ");
    
    lcd.setCursor(0,1);
    lcd.print(",LON:");
    lcd.setCursor(5,1);
    lcd.print(lon);
    
   }
  }
  
  String latitude = String(lat,6);
    String longitude = String(lon,6);
  Serial.println(latitude+";"+longitude);
  delay(1000);
  
}
原网站

版权声明
本文为[WENJIE Technology]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/214/202208020323554572.html