Components and supplies
Arduino Nano R3
Graphic OLED, 128 x 64
NEO 6M V2
Tools and machines
Soldering iron (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Solder Wire, Lead Free
Project description
Code
gps library
RC LOGGERSTATION
arduino
1// Test for minimum program size. 2 3#include <Wire.h> 4#include "SSD1306Ascii.h" 5#include "SSD1306AsciiWire.h" 6#include <TinyGPS++.h> 7#include <SoftwareSerial.h> 8#include<SD.h> 9 10 11 12const int cs_sd=2; 13static const int RXPin = 3, TXPin = 4; //GPS communication 14static const uint32_t GPSBaud = 9600; 15TinyGPSPlus gps; 16SoftwareSerial ss(RXPin, TXPin); 17 18int maxspeed = 0, speed1 = 0; 19int maxhigh = 0, high1 = 0; 20int maxsatelite = 0, satelite1 = 0; 21 22 23// 0X3C+SA0 - 0x3C or 0x3D 24#define I2C_ADDRESS 0x3C 25 26// Define proper RST_PIN if required. 27#define RST_PIN -1 28 29SSD1306AsciiWire oled; 30//------------------------------------------------------------------------------ 31void setup() { 32 Wire.begin(); 33 ss.begin(GPSBaud); 34 35#if RST_PIN >= 0 36 oled.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN); 37#else // RST_PIN >= 0 38 oled.begin(&Adafruit128x64, I2C_ADDRESS); 39#endif // RST_PIN >= 0 40 41 oled.setFont(System5x7); 42 oled.clear(); 43 oled.println(" "); 44 oled.println("GPS DATA LOGGER"); 45 oled.println("FOR RC PLANE"); 46 oled.print(" MAX SPEED AND HEIGHT"); 47 delay(4000); 48 oled.clear(); 49 50 51 52 if(!SD.begin(cs_sd)) //Condition vrifiant si la carte SD est prsente dans l'appareil 53 { 54 oled.clear(); 55 oled.print("Defaut SD"); 56 57 return; 58 } 59 60 oled.print("Carte SD OK"); 61 62 delay(2000); 63 64 oled.clear(); 65 66 File data = SD.open("donnees.txt",FILE_WRITE); // Ouvre le fichier "donnees.txt" 67 data.println(""); data.println("Demarrage acquisition"); // Ecrit dans ce fichier 68 data.close(); 69} 70//------------------------------------------------------------------------------ 71void loop() { 72 73 satelite1 = (abs(gps.satellites.value())); 74 75 oled.print("V max "); 76 oled.print("H max "); 77 oled.print(" SAT "); 78 oled.println(" "); 79 oled.println(" "); 80 81 82 83 84 oled.println(" "); 85 oled.println(" "); 86 speed1 = (gps.speed.kmph()); 87 if ( speed1 > maxspeed) { 88 maxspeed = speed1; 89 } 90 91 oled.setCursor(10 , 80); 92 oled.print(maxspeed); 93 94 high1 = (gps.altitude.meters()); 95 if ( high1 > maxhigh) { 96 maxhigh = high1; 97 } 98 oled.setCursor(50 , 80); 99 oled.print(maxhigh); 100 101 oled.setCursor(100 , 80); 102 oled.print(satelite1); 103 104 105 String Temps=String(gps.time.hour()+1)+(":")+(gps.time.minute())+(":")+(gps.time.second()); 106 String Date=String(gps.date.day())+("/")+(gps.date.month())+("/")+(gps.date.year()); 107 108// Ecriture des donnes dans le fichier texte 109 File data=SD.open("donnees.txt",FILE_WRITE); 110 data.println(Date + " " + Temps + " " + String(gps.location.lat(), 6)+" "+String(gps.location.lng(), 6)+(" ")+String(gps.altitude.meters(),0)+(" ")+String(gps.speed.kmph(),0))+(" ")+String(satelite1); 111 data.close(); 112 113 114 115 116 117 DelayGPS(100); 118 119 120 121 122 123 124 oled.clear(); 125 126 } 127 128 static void DelayGPS(unsigned long ms) 129{ 130 unsigned long start = millis(); 131 do 132 { 133 while (ss.available()) 134 gps.encode(ss.read()); 135 } while (millis() - start < ms); 136} 137
gps library
lite library for SSD1306
RC LOGGERSTATION
arduino
1// Test for minimum program size. 2 3#include <Wire.h> 4#include 5 "SSD1306Ascii.h" 6#include "SSD1306AsciiWire.h" 7#include <TinyGPS++.h> 8#include 9 <SoftwareSerial.h> 10#include<SD.h> 11 12 13 14const int cs_sd=2; 15static 16 const int RXPin = 3, TXPin = 4; //GPS communication 17static const uint32_t GPSBaud 18 = 9600; 19TinyGPSPlus gps; 20SoftwareSerial ss(RXPin, TXPin); 21 22int maxspeed 23 = 0, speed1 = 0; 24int maxhigh = 0, high1 = 0; 25int maxsatelite = 0, satelite1 26 = 0; 27 28 29// 0X3C+SA0 - 0x3C or 0x3D 30#define I2C_ADDRESS 0x3C 31 32// 33 Define proper RST_PIN if required. 34#define RST_PIN -1 35 36SSD1306AsciiWire 37 oled; 38//------------------------------------------------------------------------------ 39void 40 setup() { 41 Wire.begin(); 42 ss.begin(GPSBaud); 43 44#if RST_PIN >= 0 45 46 oled.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN); 47#else // RST_PIN >= 0 48 49 oled.begin(&Adafruit128x64, I2C_ADDRESS); 50#endif // RST_PIN >= 0 51 52 oled.setFont(System5x7); 53 54 oled.clear(); 55 oled.println(" "); 56 oled.println("GPS DATA LOGGER"); 57 58 oled.println("FOR RC PLANE"); 59 oled.print(" MAX SPEED AND HEIGHT"); 60 61 delay(4000); 62 oled.clear(); 63 64 65 66 if(!SD.begin(cs_sd)) //Condition 67 vrifiant si la carte SD est prsente dans l'appareil 68 { 69 oled.clear(); 70 71 oled.print("Defaut SD"); 72 73 return; 74 } 75 76 oled.print("Carte 77 SD OK"); 78 79 delay(2000); 80 81 oled.clear(); 82 83 File data 84 = SD.open("donnees.txt",FILE_WRITE); // Ouvre le fichier "donnees.txt" 85 86 data.println(""); data.println("Demarrage acquisition"); // Ecrit dans 87 ce fichier 88 data.close(); 89} 90//------------------------------------------------------------------------------ 91void 92 loop() { 93 94 satelite1 = (abs(gps.satellites.value())); 95 96 oled.print("V 97 max "); 98 oled.print("H max "); 99 oled.print(" SAT "); 100 oled.println(" 101 "); 102 oled.println(" "); 103 104 105 106 107 oled.println(" 108 "); 109 oled.println(" "); 110 speed1 = (gps.speed.kmph()); 111 if ( speed1 112 > maxspeed) { 113 maxspeed = speed1; 114 } 115 116 oled.setCursor(10 , 80); 117 118 oled.print(maxspeed); 119 120 high1 = (gps.altitude.meters()); 121 if ( high1 122 > maxhigh) { 123 maxhigh = high1; 124 } 125 oled.setCursor(50 , 80); 126 oled.print(maxhigh); 127 128 129 oled.setCursor(100 , 80); 130 oled.print(satelite1); 131 132 133 String 134 Temps=String(gps.time.hour()+1)+(":")+(gps.time.minute())+(":")+(gps.time.second()); 135 136 String Date=String(gps.date.day())+("/")+(gps.date.month())+("/")+(gps.date.year()); 137 138 139// Ecriture des donnes dans le fichier texte 140 File data=SD.open("donnees.txt",FILE_WRITE); 141 142 data.println(Date + " " + Temps + " " + String(gps.location.lat(), 6)+" "+String(gps.location.lng(), 143 6)+(" ")+String(gps.altitude.meters(),0)+(" ")+String(gps.speed.kmph(),0))+(" 144 ")+String(satelite1); 145 data.close(); 146 147 148 149 150 151 DelayGPS(100); 152 153 154 155 156 157 158 159 oled.clear(); 160 161 } 162 163 static void DelayGPS(unsigned 164 long ms) 165{ 166 unsigned long start = millis(); 167 do 168 { 169 while (ss.available()) 170 171 gps.encode(ss.read()); 172 } while (millis() - start < ms); 173} 174
Downloadable files
wiring prototype
wiring prototype
wiring prototype
wiring prototype
Comments
Only logged in users can leave comments