DFRduino GPS Shield-LEA-5H(SKU:TEL0044)

概述

来自DFRobot的这款GPS扩展板所使用u-blox公司的GPS模块,定位精度是2.5米,定位性能优异准确,整体参数真实可靠,绝对没有其余修饰水份,在防漫反射及抗干扰能力十分强劲,是工程人员得以信籁的高精度模块之一,在韩国及瑞士拥有95%以上的GPS模块市场,u-blox公司最初于1997年生产的GPS采用美国SIRF公司的GPS芯片来生产模块,之后由于采用其它公司的芯片难以发挥自己掌握到的GPS绝技,于是在2000年后开始设计GPS芯片组并委托ATMEL公司代工生产,不仅降低成本发挥了显著作用,更重要的是u-blox对于GPS产品整体性能的发挥到了一种极致的地步,使得u-blox在连续几年的销售中蝉联GPS芯片/模块类全球销售顶尖之首。 LEA-5H是u-blox公司采用最新推出的第5代芯片组应用的高灵敏度版本的GPS芯片组做成的GPS模块,产品性能优异,可进行室内及桥梁底部定位,大大的增强了产品的可靠性,定位灵敏度令人叹为观止,事实上,它可以做到毫不费力的在大部分室内进行良好的定位,当然,在中国,用得最多的地方还是将它放在汽车内部用于隐蔽安装GPS天线并做好伪装处理,这样做的好处是盗贼无法发现GPS系统从而增加车辆找回的机率。由于突出的高性能,LEA-5H是中国汽车界在2006年的主要发展方向。 LEA-5H是目前u-blox推出的小型化的第四代GPS模块定位产品本年度主力品种,,模块体积竟然不到一元硬币大小,以突出的65mW的低功耗及竟达到-158dB的高感度信号追踪,更重要的是它可以支持无源/有源天线,采用陶瓷无源天线的优势是整个可以做到很小,甚至可以内置于手机当中,也可以外接有源天线来扩展更强的外围信号,各项性能指标在同类GPS模块轻松胜出。 新款的LEA-5H来代换原有的LEA-LA,主要表现在产品的灵敏度有很大的提升,可以达到-158dB的跟踪灵敏度了,产品的改进使得整个系统的性能进行提升,功耗也得以降低,电池使用时间更长更持久,更适合于移动产品设备应用。

技术规格

示例代码

// # Editor     : Lauren from DFRobot
// # Date       : 22.02.2012

// # Product name: DFRduino GPS Shield-LEA-5H
// # Product SKU : TEL0044
// # Version     : 1.0

// # Update the library and sketch to compatible with IDE V1.0 and earlier

// # Description:
// # The sketch for using the DFRduino GPS Shield-LEA-5H

// # Connection:
// #        Directly connect the shield to the Arduino controller
// #        If you'd like to drive the shield via UART interface, you may need to connect the jumpers on the board.
// #

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#define WireSend(args) Wire.write(args)
#define WireRead(args) Wire.read(args)
#define printByte(args) Serial.write(args)
#define printlnByte(args)  Serial.write(args),Serial.println()
#else
#include "WProgram.h"
#define WireSend(args) Wire.send(args)
#define WireRead(args) Wire.receive(args)
#define printByte(args) Serial.print(args,BYTE)
#define printlnByte(args)  Serial.println(args,BYTE)
#endif

#include <Wire.h>

#define BUFFER_LENGTH 10//Define the buffer length

int GPSAddress = 0x42;//GPS I2C Address

double Datatransfer(char *data_buf,char num)//Data type converter:convert char type to float
{                                           //*data_buf:char data array ;num:float length
  double temp=0.0;
  unsigned char i,j;

  if(data_buf[0]=='-')//负数的情况
  {
    i=1;
    //数组中的字符型数据转换成整数并累�
    while(data_buf[i]!='.')
      temp=temp*10+(data_buf[i++]-0x30);
    for(j=0;j<num;j++)
      temp=temp*10+(data_buf[++i]-0x30);
    //将转换后的整数转换成浮点数
    for(j=0;j<num;j++)
      temp=temp/10;
    //转换成负数
    temp=0-temp;
  }
  else//正数情况
  {
    i=0;
    while(data_buf[i]!='.')
      temp=temp*10+(data_buf[i++]-0x30);
    for(j=0;j<num;j++)
      temp=temp*10+(data_buf[++i]-0x30);
    for(j=0;j<num;j++)
      temp=temp/10 ;
  }
  return temp;
}
void rec_init()//initial GPS
{
  Wire.beginTransmission(GPSAddress);
  WireSend(0xff);//发送数据所在的地址
  Wire.endTransmission();

  Wire.beginTransmission(GPSAddress);
  Wire.requestFrom(GPSAddress,10);//要求从GPS器件读取10个字节
}
char ID()//接收语句的ID
{
  char i = 0;
  char value[7]={
    '$','G','P','G','G','A',','      };//要接收的GPS语句的ID内容
  char buff[7]={
    '0','0','0','0','0','0','0'      };

  while(1)
  {
    rec_init();//接收数据初始化
    while(Wire.available())
    {
      buff[i] = WireRead();//接收串口的数据
      if(buff[i]==value[i])//对比是否是正确的ID
      {
        i++;
        if(i==7)
        {
          Wire.endTransmission();//结束接收
          return 1;//接收完毕返回1
        }
      }
      else
        i=0;
    }
    Wire.endTransmission();//结束接收
  }
}
void UTC()//获取时间信息
{
  char i = 0,flag=0;
  char value[7]={
    '$','G','P','G','G','A',','   };
  char buff[7]={
    '0','0','0','0','0','0','0'       };
  char time[9]={
    '0','0','0','0','0','0','0','0','0'    };//存放时间数据
  double t=0.0;

  while(1)
  {
    rec_init();
    while(Wire.available())
    {
      if(!flag)
      {
        buff[i] = WireRead();
        if(buff[i]==value[i])
        {
          i++;
          if(i==7)
          {
            i=0;
            flag=1;
          }
        }
        else
          i=0;
      }
      else
      {
        time[i] = WireRead();
        i++;
        if(i==9)
        {
          t=Datatransfer(time,2);//转换成浮点型数据
          t=t+80000.00;//将时间转换成北京时间
          Serial.println(t);//输出时间数据
          Wire.endTransmission();
          return;
        }
      }
    }
    Wire.endTransmission();
  }
}
void rec_data(char *buff,char num1,char num2)//接收数据子函数
{                                            //*buff:存放接收数据的数组;num1:逗号数目;num2:数组长度。
  char i=0,count=0;

  if(ID())
  {
    while(1)
    {
      rec_init();
      while(Wire.available())
      {
        buff[i] = WireRead();
        if(count!=num1)
        {
          if(buff[i]==',')
            count++;
        }
        else
        {
          i++;
          if(i==num2)
          {
            Wire.endTransmission();
            return;
          }
        }
      }
      Wire.endTransmission();
    }
  }
}
void latitude()//获取纬度信息
{
  char lat[10]={
    '0','0','0','0','0','0','0','0','0','0' };//存放纬度数据
  rec_data(lat,1 ,10);//接收纬度数据
  Serial.println(Datatransfer(lat,5),5);//将纬度数据转换成浮点型数据并输出
}
void lat_dir()//获取纬度方向信息
{
  char dir[1]={'0'};//存放纬度方向数据
  rec_data(dir,2,1);//接收纬度方向数据
  printlnByte(dir[0]);//将纬度方向信息输出
}
void  longitude()//获取经度信息
{
  char lon[11]={
    '0','0','0','0','0','0','0','0','0','0','0' };//存放经度数据
  rec_data(lon,3,11);//接收经度数据
  Serial.println(Datatransfer(lon,5),5);//将经度数据转换成浮点型数据并输出
}
void lon_dir()//获取经度方向信息
{
  char dir[1]={'0'};
  rec_data(dir,4,1);
  printlnByte(dir[0]);//将纬度方向信息输出
}
void altitude()//获取海拔信息
{
  char i=0,count=0;
  char alt[8]={
    '0','0','0','0','0','0','0','0' };

  if(ID())
  {
    while(1)
    {
      rec_init();
      while(Wire.available())
      {
        alt[i] = WireRead();
        if(count!=8)
        {
          if(alt[i]==',')
            count++;
        }
        else
        {
          if(alt[i]==',')
          {
            Serial.println(Datatransfer(alt,1),1);
            Wire.endTransmission();
            return;
          }
          else
            i++;
        }
      }
      Wire.endTransmission();
    }
  }
}
void setup()
{
  Wire.begin();//I2C初始化
  Serial.begin(9600);//设置波特率
  Serial.println("DFRobot DFRduino GPS Shield v1.0");
  Serial.println("$GPGGA statement information: ");
}
void loop()
{
  while(1)
  {
    Serial.print("UTC:");
    UTC();
    Serial.print("Lat:");
    latitude();
    Serial.print("Dir:");
    lat_dir();
    Serial.print("Lon:");
    longitude();
    Serial.print("Dir:");
    lon_dir();
    Serial.print("Alt:");
    altitude();
    Serial.println(' ');
    Serial.println(' ');
  }
}

相关资料

  1. u-blox 5系列GPS数据资料
  2. u-blox测试评估软件u-center
  3. [u-blox测试评估软件u-center官方指南]
  4. [u-blox测试评估软件u-center简介与使用介绍]
  5. [u-center与单片机接口参数应用]
  6. Indoor Positioning Using GPS Revisited(GPS室内应用分析)

<File:nextredirectltr.png>购买 [DFRduino GPS Shield-LEA-5H(TEL0044)]

category: Product Manual category: TEL Series category: Modules category: Shields category: Diagram