亿迅智能制造网
工业4.0先进制造技术信息网站!
首页 | 制造技术 | 制造设备 | 工业物联网 | 工业材料 | 设备保养维修 | 工业编程 |
home  MfgRobots >> 亿迅智能制造网 >  >> Manufacturing Technology >> 制造工艺

GPS 数据记录器、实时曲线、最大高度和最大速度

组件和用品

Arduino UNO
arduino uno
× 1
跳线(母线)、跳线引线组
× 1
Arduino Proto Shield
× 1
1.8" TFT SPI LCD 屏幕,带 MicroSD 插槽
或其他带 SD 卡的
× 1
u-blox gps neo 6m
× 1

必要的工具和机器

烙铁(通用)
焊锡丝,无铅
剥线钳和切割机,18-10 AWG / 0.75-4mm²容量线

关于这个项目

简介

我练习航模,我喜欢知道我的飞机的速度和高度。不幸的是,商用 GPS 数据记录器非常昂贵。

所以我决定制作一个基于 Arduino 的 GPS 数据记录器,成本低于 50 欧元。

我的第一个原型是基于 Arduino Uno R3,带有集成 SD 卡和 NEO 6M V2 GPS 模块的 Sainsmart ST7735 屏幕。

在第二个项目中,我将使用带有 SSD1306 OLED 屏幕、相同 GPS 模块和微型 SD 卡的 Arduino Nano。带外壳的重量应该在40克左右,可以很容易地集成到中型飞机中(尺寸L 50 mm X l 30mm X H 22mm)。

这将是我的下一个项目(我正在等待材料。)

测试

在车上拍摄Arduino的屏幕并不容易,但我做到了,你可以在视频上看到结果。

下一次测试将在无线电遥控飞机上使用新的、更小、更轻的原型机。待续!


代码

  • gps 数据记录器
  • sauvegarde SD
gps 数据记录器 Arduino
#include #include #include  #define cs 10#define dc 9#define rst 8 #include #include  Adafruit_ST7735 tft =Adafruit_ST7735(cs, dc, rst);static const int RXPin =4, TXPin =3; //GPS 通信static const uint32_t GPSBaud =9600;#define OLED_RESET 5TinyGPSPlus gps;SoftwareSerial ss(RXPin, TXPin);int x=80;int xh=80;int maxhigh=0;int maxspeed =0, speed1 =0;int high1 =0;;void setup(){ Serial.begin(9600); ss.begin(GPSBaud); tft.initR(INITR_GREENTAB); tft.fillScreen(ST7735_BLACK); tft.setCursor(5, 58); tft.setTextSize(1); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("初始化"); }void loop(){ tft.setTextSize(1); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); // 发送 chaque bonne 接收卫星的信息 while (ss.available()> 0){ gps.encode(ss.read());如果(gps.location.isUpdated()){干部(); tft.setCursor(5, 44); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("纬度:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.location.lat(), 6); tft.setCursor(5, 58); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("经度:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.location.lng(), 6); //affichage ecran date tft.setCursor(5, 7); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("日期:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.date.day()); tft.print(" "); tft.print(gps.date.month()); tft.print(" "); tft.print(gps.date.year()); //affichage ecran heure tft.setCursor(5, 20); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("heure :"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.time.hour()+1); tft.print(" "); tft.print(gps.time.minute()); tft.print(" "); tft.print(gps.time.second()); tft.print(" "); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.setCursor(3, 30); //affichage ecran高度 tft.setCursor(5, 80); tft.print("H m :"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print (gps.altitude.meters(),0); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.setCursor(5, 95); hmax(); tft.print("Hmax :"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(maxhigh); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" ");库尔贝(); //affichage ecran vitesse tft.setCursor(5, 115); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("V 行为:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print (gps.speed.kmph(),0); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); tft.setCursor(5, 130); tft.setTextColor(ST7735_GREEN,ST7735_BLACK);最大(); tft.print("vmax:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(最大速度); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); tft.setTextColor(ST7735_GREEN,ST7735_BLACK);库尔布(); //affichage ecran nombre de Satellites tft.setCursor(5, 147); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("星期六名称:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.satellites.value()); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); // 水平暗淡。精度 (100ths-i32) Serial.print("HDOP ="); Serial.println(gps.hdop.value());智能延迟(400); } }}// 延迟倒酒 bonne recptionstatic void smartDelay(unsigned long ms){ unsigned long start =millis();做 { while (ss.available()) gps.encode(ss.read()); } while (millis() - start 123) { x=80; tft.fillRect(82,110,43,30,ST7735_BLACK); }}void courbeh() { int nouvelleValeurh; // 转换 vitesse max (350 km/h) en pixel nouvelleValeurh =map((gps.altitude.meters()), 0, 1000, 104, 72); // car l'cran a 64 pixel de haut xh++; tft.drawPixel(xh,nouvelleValeurh,ST7735_CYAN);如果 (xh>123) { xh=80; tft.fillRect(82,72,43,35,ST7735_BLACK); }}void vmax() {// calcul vitese最大速度1 =(gps.speed.kmph()); if ( speed1> maxspeed) { maxspeed =speed1; } } void hmax() {// 计算高度最大值 high1 =(gps.altitude.meters()); if (high1> maxhigh) { maxhigh =high1; } }
sauvegarde SDArduino
数据记录器
#include #include#include #include  #define cs 10#define dc 9#define rst 8 #include #include Adafruit_ST7735 tft =Adafruit_ST7735(cs, dc, rst);static const int RXPin =4, TXPin =3; //GPS通信static const uint32_t GPSBaud =9600;const int cs_sd=4;#define OLED_RESET 5TinyGPSPlus gps;SoftwareSerial ss(RXPin, TXPin);int x=80;int xh=80;int maxhigh=0;int maxspeed =0, speed1 =0;int high1 =0;;void setup(){ Serial.begin(9600); ss.begin(GPSBaud); tft.initR(INITR_GREENTAB); tft.fillScreen(ST7735_BLACK); tft.setCursor(5, 58); tft.setTextSize(1); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("初始化"); tft.setCursor(5, 70); tft.print("初始化 SD");延迟(1000); if(!SD.begin(cs_sd)) //条件vrifiant si la carte SD est prsente dans l'appareil { tft.setCursor(5, 82); tft.print("默认 SD");返回; } tft.setCursor(5, 82); tft.print("Carte SD OK");延迟(1000); tft.fillScreen(ST7735_BLACK);文件数据 =SD.open("donnees.txt",FILE_WRITE); // Ouvre le fichier "donnees.txt" data.println(""); data.println("Dmarrage 获取"); // Ecrit dans ce fichier data.close(); }void loop(){ tft.setTextSize(1); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); // 发送 chaque bonne 接收卫星的信息 while (ss.available()> 0){ gps.encode(ss.read());如果(gps.location.isUpdated()){干部(); tft.setCursor(5, 44); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("纬度:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.location.lat(), 6); tft.setCursor(5, 58); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("经度:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.location.lng(), 6); //affichage ecran date tft.setCursor(5, 7); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("日期:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.date.day()); tft.print(" "); tft.print(gps.date.month()); tft.print(" "); tft.print(gps.date.year()); String Date=String(gps.date.day())+(" ")+(gps.date.month())+(" ")+(gps.date.year()); //affichage ecran heure tft.setCursor(5, 20); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("heure :"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.time.hour()+1); tft.print(" "); tft.print(gps.time.minute()); tft.print(" "); tft.print(gps.time.second()); tft.print(" "); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.setCursor(3, 30); String Temps=String(gps.time.hour()+1)+(" ")+(gps.time.minute())+(" ")+(gps.time.second()); //affichage ecran高度 tft.setCursor(5, 80); tft.print("H m :"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print (gps.altitude.meters(),0); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.setCursor(5, 95); hmax(); tft.print("Hmax :"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(maxhigh); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" ");库尔贝(); //affichage ecran vitesse tft.setCursor(5, 115); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("V 行为:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print (gps.speed.kmph(),0); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); tft.setCursor(5, 130); tft.setTextColor(ST7735_GREEN,ST7735_BLACK);最大(); tft.print("vmax:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(最大速度); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); tft.setTextColor(ST7735_GREEN,ST7735_BLACK);库尔布(); //affichage ecran nombre de Satellites tft.setCursor(5, 147); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.print("星期六名称:"); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(gps.satellites.value()); tft.setTextColor(ST7735_CYAN,ST7735_BLACK); tft.print(" "); // 水平暗淡。精度 (100ths-i32) Serial.print("HDOP ="); Serial.println(gps.hdop.value());智能延迟(400); // Ecriture des donnes dans le fichier texte File data=SD.open("donnees.txt",FILE_WRITE); data.println(Date + " " + Temps + " " + String(gps.location.lat(), 6)+" "+String(gps.location.lng(), 6)+(" ")+String( gps.altitude.meters(),0)+(" ")+String(maxhigh)+(" ")+String(gps.speed.kmph(),0)+(" ")+String(maxspeed));数据关闭(); } }}// 延迟倒酒 bonne recptionstatic void smartDelay(unsigned long ms){ unsigned long start =millis();做 { while (ss.available()) gps.encode(ss.read()); } while (millis() - start 123) { x=80; tft.fillRect(82,110,43,30,ST7735_BLACK); }}void courbeh() { int nouvelleValeurh; // 转换 vitesse max (350 km/h) en pixel nouvelleValeurh =map((gps.altitude.meters()), 0, 1000, 104, 72); // car l'cran a 64 pixel de haut xh++; tft.drawPixel(xh,nouvelleValeurh,ST7735_CYAN);如果 (xh>123) { xh=80; tft.fillRect(82,72,43,35,ST7735_BLACK); }}void vmax() {// calcul vitese最大速度1 =(gps.speed.kmph()); if ( speed1> maxspeed) { maxspeed =speed1; } } void hmax() {// 计算高度最大值 high1 =(gps.altitude.meters()); if (high1> maxhigh) { maxhigh =high1; } }

示意图


制造工艺

  1. 用三星 SAMIIO、Arduino UNO 和 Raspberry Pi 在几分钟内制作一个火灾探测器
  2. 使用 Arduino 的太阳能电池板实时数据采集
  3. 如何构建 Arduino 能源监视器和数据记录器
  4. LCD 动画和游戏
  5. 温湿度数据记录仪
  6. 简单的 UNO 计算器
  7. 视觉的坚持
  8. u-blox LEA-6H 02 GPS 模块,带有 Arduino 和 Python
  9. 4x4x4 LED 立方体,带有 Arduino Uno 和 1sheeld
  10. Python3 和 Arduino 通信
  11. 使用 Arduino 和 RDA8057M 的 FM 收音机
  12. 带 GPS 和 TFT 显示屏蔽的 GPS 位置显示