{"id":9314,"date":"2019-09-24T22:25:11","date_gmt":"2019-09-24T22:25:11","guid":{"rendered":"https:\/\/stevepedwards.today\/stevepedwards.com\/ElectronicsStuff\/?p=8953"},"modified":"2019-09-24T22:25:11","modified_gmt":"2019-09-24T22:25:11","slug":"weather-station-complete","status":"publish","type":"post","link":"https:\/\/stevepedwards.today\/ElectronicsStuff\/weather-station-complete\/","title":{"rendered":"Weather Station Complete"},"content":{"rendered":"<p>Packed in a Neo6 GPS, BMP180, DHT11 and OLED screen controlled by a Nano fixed into female headers for easy component swap out and height gain- shame about my engineering skills, but..it works, and finally used that 6 year old project box..:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8954\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/09\/bits.png\" alt=\"\" width=\"936\" height=\"608\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8955\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/09\/stnlid.png\" alt=\"\" width=\"748\" height=\"534\" \/><br \/>\nNano code:<\/p>\n<pre class=\"lang:default decode:true\">\/******************************************************************************\n  Steve_GPS_DHT_BMP_OLED.ino based on:\n  TinyGPSPlus_GPS_Shield.ino\n  TinyGPS++ Library Example for the SparkFun GPS Logger Shield\n  By Jim Lindblom @ SparkFun Electronics\n  February 9, 2016\n  https:\/\/stevepedwards.today\/github.com\/sparkfun\/GPS_Shield\n  This example uses SoftwareSerial to communicate with the GPS module on\n  pins 8 and 9. It uses the TinyGPS++ library to parse the NMEA strings sent\n  by the GPS module, and prints interesting GPS information to the serial\n  monitor.\n  After uploading the code, open your serial monitor, set it to 9600 baud, and\n  watch for latitude, longitude, altitude, course, speed, date, time, and the\n  number of visible satellites.\n  Resources:\n  TinyGPS++ Library  - https:\/\/stevepedwards.today\/github.com\/mikalhart\/TinyGPSPlus\/releases\n  SoftwareSerial Library\n  Development\/hardware environment specifics:\n  Arduino IDE 1.6.7\n  GPS Logger Shield v2.0 - Make sure the UART switch is set to SW-UART\n  Arduino Uno, RedBoard, Pro, etc.\n******************************************************************************\/\n\/\/steve_station.ino - uses 84m elevation and daily pressure from https:\/\/www.sueandalan.plus.com\/weewx\/index.html\n#include &lt;TinyGPS++.h&gt; \/\/ Include the TinyGPS++ library\nTinyGPSPlus tinyGPS; \/\/ Create a TinyGPSPlus object\n#include &lt;Adafruit_GFX.h&gt;\n#include &lt;Adafruit_SSD1306.h&gt;\n#include &lt;SFE_BMP180.h&gt;\n#include &lt;Wire.h&gt;   \/\/ I2C bus\n#include \"dht.h\"\n\/\/ If you're using an Arduino Uno, RedBoard, or any board that uses the\n\/\/ 0\/1 UART for programming\/Serial monitor-ing, use SoftwareSerial:\n#include &lt;SoftwareSerial.h&gt;\n#define ARDUINO_GPS_RX 9 \/\/ GPS TX, Arduino RX pin\n#define ARDUINO_GPS_TX 8 \/\/ GPS RX, Arduino TX pin\nSoftwareSerial ssGPS(ARDUINO_GPS_TX, ARDUINO_GPS_RX); \/\/ Create a SoftwareSerial\n\/\/ Set gpsPort to either ssGPS if using SoftwareSerial or Serial1 if using an\n\/\/ Arduino with a dedicated hardware serial port\n#define gpsPort ssGPS  \/\/ Alternatively, use Serial1 on the Leonardo\n\/\/ Define the serial monitor port. On the Uno, and Leonardo this is 'Serial'\n\/\/  on other boards this may be 'SerialUSB'\n#define SerialMonitor Serial\n#define GPS_BAUD 9600 \/\/ GPS module baud rate. GP3906 defaults to 9600.\n#define dht_apin A0 \/\/ Analog Pin sensor is connected to\ndht DHT;\n#define ALTITUDE 84.0 \/\/ Altitude of sensor in meters\n\/\/ OLED screen type parameters\n#define SCREEN_WIDTH 128 \/\/ OLED display width, in pixels\n#define SCREEN_HEIGHT 32 \/\/ OLED display height, in pixels\n\/\/ Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)\n#define OLED_RESET     4 \/\/ Reset pin # (or -1 if sharing Arduino reset pin)\n\/\/ NOTE: This define has to be placed below the Adafruit library it comes from as page is read top down!\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);\n\/\/ You will need to create an SFE_BMP180 object, here called \"pressure\":\nSFE_BMP180 pressure;\n\/\/ This custom version of delay() ensures that the tinyGPS object\n\/\/ is being \"fed\". From the TinyGPS++ examples.\nstatic void smartDelay(unsigned long ms)\n{\n  unsigned long start = millis();\n  do\n  {\n    \/\/ If data has come in from the GPS module\n    while (gpsPort.available())\n      tinyGPS.encode(gpsPort.read()); \/\/ Send it to the encode function\n    \/\/ tinyGPS.encode(char) continues to \"load\" the tinyGPS object with new\n    \/\/ data coming in from the GPS module. As full NMEA strings begin to come in\n    \/\/ the tinyGPS library will be able to start parsing them for pertinent info\n  } while (millis() - start &lt; ms);\n}  \/\/ end static void smartDelay\nvoid setup()  {\n    \/\/ OLED SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally\n    if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { \/\/ Address 0x3C for 128x32\n    Serial.println(F(\"SSD1306 allocation failed\"));\n    \/\/ Address 0x3C for 128x32 OLED\n    for(;;); \/\/ Don't proceed, loop forever\n    }\n   \/\/ Initialize the BMP180 (it is important to get calibration values stored on the device).\n   if (pressure.begin())\n     Serial.println(\"BMP180 init success\");\n   else\n    {\n     \/\/ Oops, something went wrong, this is usually a connection problem,\n     \/\/ see the comments at the top of this sketch for the proper connections.\n  Serial.println(\"BMP180 init fail\\n\\n\");\n     while(1); \/\/ Pause forever.\n    }\n  SerialMonitor.begin(9600);\n  gpsPort.begin(GPS_BAUD);\n} \/\/ end setup\nvoid printDHT_OLED()  {\n  \/\/ DHT11 temp\/humidity display section\n  DHT.read11(dht_apin);\n  \/\/ OLED screen page 1\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.clearDisplay();\n  display.print(\"DHT11 humid = \");\n  display.print(DHT.humidity,1);\n  display.println(\"%  \");\n  display.display();\n  display.print(\"DHT11 temp = \");\n  display.print(DHT.temperature,1);\n  display.println(\"C  \");\n  display.display();\n  delay(4000);  \/\/ See the data on OLED for 3 secs\n} \/\/ end printDHT_OLED()\nvoid printGPS_OLED()  {\n  \/\/ OLED screen page 1\n  \/\/ Print latitude, longitude, altitude in feet, course, speed, date, time,\n  \/\/ and the number of visible satellites.\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"GPSLat: \"); display.println(tinyGPS.location.lat(), 6);\n  display.print(\"GPSLong: \"); display.println(tinyGPS.location.lng(), 6);\n  display.print(\"GPSAlt: \"); display.print(tinyGPS.altitude.feet()); display.println(\" ft\");\n  int m = (tinyGPS.altitude.feet()) \/ 3.28084;\n  display.print(\"GPSAlt: \"); display.print(m); display.println(\" m\");\n  display.display();\n  delay(4000);\n  \/\/ OLED screen page 2\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"GPS Date: \"); display.print(tinyGPS.date.day());\n  display.print(\"\/\");\n  display.print(tinyGPS.date.month());\n  display.print(\"\/\");\n  display.println(tinyGPS.date.year());\n  display.print(\"GPS Time: \"); display.print(tinyGPS.time.hour());\n  display.print(\":\");\n  if (tinyGPS.time.minute() &lt; 10) display.print('0');\n  display.print(tinyGPS.time.minute());\n  display.print(\":\");\n  if (tinyGPS.time.second() &lt; 10) display.print('0');\n  display.println(tinyGPS.time.second());\n  display.print(\"GPS Sats: \"); display.println(tinyGPS.satellites.value());\n  display.println();\n  display.display();\n  delay(4000);  \/\/ See the data on OLED\n} \/\/ end printGPS_OLED()\nvoid printBMP_Pressure_OLED() {\n  \/\/ If you want sea-level-compensated pressure, as used in weather reports,\n  \/\/ you will need to know the altitude at which your measurements are taken.\n  \/\/ We're using a constant called ALTITUDE in this sketch -:\n  char status;\n  double T,P,p0,a;\n  \/\/ OLED pressure screen 1\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"LocalSetAlt: \");\n  display.print(ALTITUDE,0);\n  display.println(\" m\");\n  display.print(\"LocalSetAlt: \");\n  display.print(ALTITUDE*3.28084,0); \/\/dec place for feet\n  display.println(\" ft\");\n  display.display();\n  delay(4000);  \/\/ See the data on OLED\n  \/\/ If you want to measure altitude, and not pressure, you will instead need\n  \/\/ to provide a known baseline pressure. This is shown at the end of the sketch.\n  \/\/ You must first get a temperature measurement to perform a pressure reading.\n  \/\/ Start a temperature measurement:\n  \/\/ If request is successful, the number of ms to wait is returned.\n  \/\/ If request is unsuccessful, 0 is returned.\n  status = pressure.startTemperature();\n  if (status != 0)  {\n    \/\/ Wait for the measurement to complete:\n    delay(status);\n    \/\/ Retrieve the completed temperature measurement:\n    \/\/ Note that the measurement is stored in the variable T.\n    \/\/ Function returns 1 if successful, 0 if failure.\n    status = pressure.getTemperature(T);\n    if (status != 0)\n    {\n      \/\/ OLED pressure screen 2\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n      \/\/ Print out the temperature measurements:\n      display.print(\"Temp: \");\n      display.print(T,2);\n      display.println(\" deg C\");\n      display.print(\"Temp: \");\n      display.print(1.8*T+32.0,2); \/\/ from C to degrees F conv\n      display.print(\" deg F\");\n      display.display();\n      delay(4000);  \/\/ See the data on OLED\n      status = pressure.startPressure(3);\n      if (status != 0)\n      {\n        \/\/ Wait for the measurement to complete:\n        delay(status);\n        \/\/ Retrieve the completed pressure measurement:\n        \/\/ Note that the measurement is stored in the variable P.\n        \/\/ Note also that the function requires the previous temperature measurement (T).\n        \/\/ (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)\n        \/\/ Function returns 1 if successful, 0 if failure.\n        status = pressure.getPressure(P,T);\n        if (status != 0)\n        {\n          \/\/ OLED pressure screen 3\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          \/\/ Print out the measurement:\n          display.print(\"Abs Pres: \");\n          display.print(P,2);\n          display.println(\" mb\");\n          display.print(\"Abs Pres: \");\n          display.print(P*0.0295333727,2);\n          display.print(\" in Hg\");\n          display.display();\n          delay(4000);       \/\/ See the data on OLED\n          \/\/ The pressure sensor returns abolute pressure, which varies with altitude.\n          \/\/ To remove the effects of altitude, use the sealevel function and your current altitude.\n          \/\/ This number is commonly used in weather reports.\n          \/\/ Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.\n          \/\/ Result: p0 = sea-level compensated pressure in mb\n        \/\/ OLED pressure screen 4\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          p0 = pressure.sealevel(P,ALTITUDE); \/\/ 84m (Illogan, Cornwall)\n          display.print(\"Sea Pres: \");\n          display.print(p0,2);\n          display.println(\" mb\");\n          display.print(\"Sea Pres: \");\n          display.print(p0*0.0295333727,2);\n          display.print(\" in Hg\");\n          display.display();\n          delay(4000);  \/\/ See the data on OLED\n          \/\/ On the other hand, if you want to determine your altitude from the pressure reading,\n          \/\/ use the altitude function along with a baseline pressure (sea-level or other).\n          \/\/ Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.\n          \/\/ Result: a = altitude in m.\n          \/\/ OLED pressure screen 5\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          a = pressure.altitude(P,p0);\n          display.print(\"Computed Alt: \");\n          display.print(a,0);\n          display.println(\" m\");\n          display.print(\"Computed Alt: \");\n          display.print(a*3.28084,0);\n          display.print(\" ft\");\n          display.display();\n          delay(4000);  \/\/ See the data on OLED\n        }\n        else display.println(\"error pressure \\n\");\n      }\n      else display.println(\"error pressure \\n\");\n    }\n    else display.println(\"error temp \\n\");\n  }\n  else display.println(\"error temp \\n\");\n}  \/\/end void printBMP_Pressure_OLED()\nvoid loop() {\n   \/\/ \"Smart delay\" looks for GPS data while the Arduino's not doing anything else\n  smartDelay(1000);\n   \/\/ print position, altitude, speed, time\/date, and satellites:\n  printGPS_OLED();\n  printBMP_Pressure_OLED();\n  printDHT_OLED();\n} \/\/ end loop<\/pre>\n<p><iframe loading=\"lazy\" title=\"Weather station finished\" width=\"1778\" height=\"1000\" src=\"https:\/\/www.youtube.com\/embed\/ah4vmK13ieA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><br \/>\nFor 2X digits:<\/p>\n<pre class=\"lang:default decode:true \">\/******************************************************************************\n  Steve_GPS_DHT_BMP_OLED.ino based on:\n  TinyGPSPlus_GPS_Shield.ino\n  TinyGPS++ Library Example for the SparkFun GPS Logger Shield\n  By Jim Lindblom @ SparkFun Electronics\n  February 9, 2016\n  https:\/\/stevepedwards.today\/github.com\/sparkfun\/GPS_Shield\n  This example uses SoftwareSerial to communicate with the GPS module on\n  pins 8 and 9. It uses the TinyGPS++ library to parse the NMEA strings sent\n  by the GPS module, and prints interesting GPS information to the serial\n  monitor.\n  After uploading the code, open your serial monitor, set it to 9600 baud, and\n  watch for latitude, longitude, altitude, course, speed, date, time, and the\n  number of visible satellites.\n  Resources:\n  TinyGPS++ Library  - https:\/\/stevepedwards.today\/github.com\/mikalhart\/TinyGPSPlus\/releases\n  SoftwareSerial Library\n  Development\/hardware environment specifics:\n  Arduino IDE 1.6.7\n  GPS Logger Shield v2.0 - Make sure the UART switch is set to SW-UART\n  Arduino Uno, RedBoard, Pro, etc.\n******************************************************************************\/\n\/\/steve_station.ino - uses 46m elevation and daily pressure from https:\/\/www.sueandalan.plus.com\/weewx\/index.html\n#include &lt;TinyGPS++.h&gt; \/\/ Include the TinyGPS++ library\nTinyGPSPlus tinyGPS; \/\/ Create a TinyGPSPlus object\n#include &lt;Adafruit_GFX.h&gt;\n#include &lt;Adafruit_SSD1306.h&gt;\n#include &lt;SFE_BMP180.h&gt;\n#include &lt;Wire.h&gt;   \/\/ I2C bus\n#include \"dht.h\"\n\/\/ If you're using an Arduino Uno, RedBoard, or any board that uses the\n\/\/ 0\/1 UART for programming\/Serial monitor-ing, use SoftwareSerial:\n#include &lt;SoftwareSerial.h&gt;\n#define ARDUINO_GPS_RX 9 \/\/ GPS TX, Arduino RX pin\n#define ARDUINO_GPS_TX 8 \/\/ GPS RX, Arduino TX pin\nSoftwareSerial ssGPS(ARDUINO_GPS_TX, ARDUINO_GPS_RX); \/\/ Create a SoftwareSerial\n\/\/ Set gpsPort to either ssGPS if using SoftwareSerial or Serial1 if using an\n\/\/ Arduino with a dedicated hardware serial port\n#define gpsPort ssGPS  \/\/ Alternatively, use Serial1 on the Leonardo\n\/\/ Define the serial monitor port. On the Uno, and Leonardo this is 'Serial'\n\/\/  on other boards this may be 'SerialUSB'\n#define SerialMonitor Serial\n#define GPS_BAUD 9600 \/\/ GPS module baud rate. GP3906 defaults to 9600.\n#define dht_apin A0 \/\/ Analog Pin sensor is connected to\ndht DHT;\n#define ALTITUDE 46.0 \/\/ Altitude of sensor in meters\n\/\/ OLED screen type parameters\n#define SCREEN_WIDTH 128 \/\/ OLED display width, in pixels\n#define SCREEN_HEIGHT 32 \/\/ OLED display height, in pixels\n\/\/ Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)\n#define OLED_RESET     4 \/\/ Reset pin # (or -1 if sharing Arduino reset pin)\n\/\/ NOTE: This define has to be placed below the Adafruit library it comes from as page is read top down!\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);\n\/\/ You will need to create an SFE_BMP180 object, here called \"pressure\":\nSFE_BMP180 pressure;\n\/\/ This custom version of delay() ensures that the tinyGPS object\n\/\/ is being \"fed\". From the TinyGPS++ examples.\nstatic void smartDelay(unsigned long ms)\n{\n  unsigned long start = millis();\n  do\n  {\n    \/\/ If data has come in from the GPS module\n    while (gpsPort.available())\n      tinyGPS.encode(gpsPort.read()); \/\/ Send it to the encode function\n    \/\/ tinyGPS.encode(char) continues to \"load\" the tinyGPS object with new\n    \/\/ data coming in from the GPS module. As full NMEA strings begin to come in\n    \/\/ the tinyGPS library will be able to start parsing them for pertinent info\n  } while (millis() - start &lt; ms);\n}  \/\/ end static void smartDelay\nvoid setup()  {\n    \/\/ OLED SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally\n    if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { \/\/ Address 0x3C for 128x32\n    Serial.println(F(\"SSD1306 allocation failed\"));\n    \/\/ Address 0x3C for 128x32 OLED\n    for(;;); \/\/ Don't proceed, loop forever\n    }\n   \/\/ Initialize the BMP180 (it is important to get calibration values stored on the device).\n   if (pressure.begin())\n     Serial.println(\"BMP180 init success\");\n   else\n    {\n     \/\/ Oops, something went wrong, this is usually a connection problem,\n     \/\/ see the comments at the top of this sketch for the proper connections.\n  Serial.println(\"BMP180 init fail\\n\\n\");\n     while(1); \/\/ Pause forever.\n    }\n  SerialMonitor.begin(9600);\n  gpsPort.begin(GPS_BAUD);\n} \/\/ end setup\nvoid printDHT_OLED()  {\n  \/\/ DHT11 temp\/humidity display section\n  DHT.read11(dht_apin);\n  \/\/ OLED screen page 1\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.clearDisplay();\n  display.print(\"DHT11 humid = \");\n  display.print(DHT.humidity,1);\n  display.println(\"%  \");\n  display.display();\n  delay(2000);  \/\/ See the data on OLED\n}\n  void printDHTTemp_OLED()  {\n  DHT.read11(dht_apin);\n  display.clearDisplay();\n  display.setTextSize(2);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.clearDisplay();\n  display.print(\"DHT11 temp\");\n  display.print(DHT.temperature,1);\n  display.println(\"C  \");\n  display.display();\n  delay(2000);  \/\/ See the data on OLED for 2 secs\n} \/\/ end printDHT_OLED()\n\/\/ OLED screen page 1 LatLong, Alt\nvoid printGPS_OLED()  {\n  \/\/ Print latitude, longitude, altitude in feet, speed, date, time,\n  \/\/ and the number of visible satellites.\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"GPSLat: \"); display.println(tinyGPS.location.lat(), 6);\n  display.print(\"GPSLong: \"); display.println(tinyGPS.location.lng(), 6);\n  display.print(\"GPSAlt: \"); display.print(tinyGPS.altitude.feet()); display.println(\" ft\");\n  int m = (tinyGPS.altitude.feet()) \/ 3.28046;\n  display.print(\"GPSAlt: \"); display.print(m); display.println(\" m\");\n  display.display();\n  delay(2000);\n}\n  \/\/ OLED screen page 2 Date\n  void printDate_OLED()  {\n  display.clearDisplay();\n  display.setTextSize(2);      \/\/  2:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"GPS Date: \"); display.print(tinyGPS.date.day());\n  display.print(\"\/\");\n  display.print(tinyGPS.date.month());\n  display.print(\"\/\");\n  display.println(tinyGPS.date.year());\n  display.println();\n  display.display();\n  delay(2000);  \/\/ See the data on OLED\n} \/\/ end printDate_OLED()\n  \/\/ OLED screen page 3 Time\n  void printTime_OLED()  {\n  display.clearDisplay();\n  display.setTextSize(2);      \/\/  2:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"GPS UK +1: \"); display.print(tinyGPS.time.hour() +1);\n  display.print(\":\");\n  if (tinyGPS.time.minute() &lt; 10) display.print('0');\n  display.print(tinyGPS.time.minute());\n  display.print(\":\");\n  if (tinyGPS.time.second() &lt; 10) display.print('0');\n  display.println(tinyGPS.time.second());\n  display.println();\n  display.display();\n  delay(3000);  \/\/ See the data on OLED\n} \/\/ end printTime_OLED()\n  \/\/ OLED screen page 4 Sats\n  void printSats_OLED() {\n  display.clearDisplay();\n  display.setTextSize(2);      \/\/  2:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"GPS Sats: \"); display.println(tinyGPS.satellites.value());\n  display.println();\n  display.display();\n  delay(2000);  \/\/ See the data on OLED\n} \/\/ end printSats_OLED()\n\/\/ Pressure\n  void printBMP_Pressure_OLED() {\n  \/\/ If you want sea-level-compensated pressure, as used in weather reports,\n  \/\/ you will need to know the altitude at which your measurements are taken.\n  \/\/ We're using a constant called ALTITUDE in this sketch -:\n  char status;\n  double T,P,p0,a;\n  \/\/ OLED pressure screen 1\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n  display.print(\"LocalSetAlt: \");\n  display.print(ALTITUDE,0);\n  display.println(\" m\");\n  display.print(\"LocalSetAlt: \");\n  display.print(ALTITUDE*3.28046,0); \/\/dec place for feet\n  display.println(\" ft\");\n  display.display();\n  delay(4000);  \/\/ See the data on OLED\n  \/\/ If you want to measure altitude, and not pressure, you will instead need\n  \/\/ to provide a known baseline pressure. This is shown at the end of the sketch.\n  \/\/ You must first get a temperature measurement to perform a pressure reading.\n  \/\/ Start a temperature measurement:\n  \/\/ If request is successful, the number of ms to wait is returned.\n  \/\/ If request is unsuccessful, 0 is returned.\n  status = pressure.startTemperature();\n  if (status != 0)  {\n    \/\/ Wait for the measurement to complete:\n    delay(status);\n    \/\/ Retrieve the completed temperature measurement:\n    \/\/ Note that the measurement is stored in the variable T.\n    \/\/ Function returns 1 if successful, 0 if failure.\n    status = pressure.getTemperature(T);\n    if (status != 0)\n    {\n      \/\/ OLED pressure screen 2\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n      \/\/ Print out the temperature measurements:\n      display.print(\"Temp: \");\n      display.print(T,2);\n      display.println(\" deg C\");\n      display.print(\"Temp: \");\n      display.print(1.8*T+32.0,2); \/\/ from C to degrees F conv\n      display.print(\" deg F\");\n      display.display();\n      delay(4000);  \/\/ See the data on OLED\n      status = pressure.startPressure(3);\n      if (status != 0)\n      {\n        \/\/ Wait for the measurement to complete:\n        delay(status);\n        \/\/ Retrieve the completed pressure measurement:\n        \/\/ Note that the measurement is stored in the variable P.\n        \/\/ Note also that the function requires the previous temperature measurement (T).\n        \/\/ (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)\n        \/\/ Function returns 1 if successful, 0 if failure.\n        status = pressure.getPressure(P,T);\n        if (status != 0)\n        {\n          \/\/ OLED pressure screen 3\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          \/\/ Print out the measurement:\n          display.print(\"Abs Pres: \");\n          display.print(P,2);\n          display.println(\" mb\");\n          display.print(\"Abs Pres: \");\n          display.print(P*0.0295333727,2);\n          display.print(\" in Hg\");\n          display.display();\n          delay(4000);       \/\/ See the data on OLED\n          \/\/ The pressure sensor returns abolute pressure, which varies with altitude.\n          \/\/ To remove the effects of altitude, use the sealevel function and your current altitude.\n          \/\/ This number is commonly used in weather reports.\n          \/\/ Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.\n          \/\/ Result: p0 = sea-level compensated pressure in mb\n        \/\/ OLED pressure screen 4\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          p0 = pressure.sealevel(P,ALTITUDE); \/\/ 46m (Illogan, Cornwall)\n          display.print(\"Sea Pres: \");\n          display.print(p0,2);\n          display.println(\" mb\");\n          display.print(\"Sea Pres: \");\n          display.print(p0*0.0295333727,2);\n          display.print(\" in Hg\");\n          display.display();\n          delay(4000);  \/\/ See the data on OLED\n          \/\/ On the other hand, if you want to determine your altitude from the pressure reading,\n          \/\/ use the altitude function along with a baseline pressure (sea-level or other).\n          \/\/ Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.\n          \/\/ Result: a = altitude in m.course\n          \/\/ OLED pressure screen 5\n  display.clearDisplay();\n  display.setTextSize(1);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          a = pressure.altitude(P,p0);\n          display.print(\"Computed Alt: \");\n          display.print(a,0);\n          display.println(\" m\");\n          display.print(\"Computed Alt: \");\n          display.print(a*3.28046,0);\n          display.print(\" ft\");\n          display.display();\n          delay(4000);  \/\/ See the data on OLED\n        }\n        else display.println(\"error pressure \\n\");\n      }\n      else display.println(\"error pressure \\n\");\n    }\n    else display.println(\"error temp \\n\");\n  }\n  else display.println(\"error temp \\n\");\n}  \/\/end void printBMP_Pressure_OLED()\n  void printBMP_AbsPres_OLED()  {\n  char status;\n  display.print(ALTITUDE,0);\n  double T,P,p0,a;\n  status = pressure.getPressure(P,T);\n  display.clearDisplay();\n  display.setTextSize(2);      \/\/ Normal 1:1 pixel scale\n  display.setTextColor(WHITE); \/\/ Draw white text\n  display.setCursor(0, 0);     \/\/ Start at top-left corner\n  display.cp437(true);         \/\/ Use full 256 char 'Code Page 437' font\n          p0 = pressure.sealevel(P,ALTITUDE); \/\/ 46m Bryanstone\n          display.print(\"Abs Pres: \");\n          display.print(p0,2);\n          display.println(\" mb\");\n          display.display();\n          delay(2000);  \/\/ See the data on OLED\n  }\nvoid loop() {\n   \/\/ \"Smart delay\" looks for GPS data while the Arduino's not doing anything else\n  smartDelay(3000);\n   \/\/print position, altitude, speed, time\/date, and satellites.\n  \/\/printGPS_OLED();\n  printDate_OLED();\n  printTime_OLED();\n  printSats_OLED();\n  printDHTTemp_OLED();\n  \/\/printBMP_AbsPres_OLED();\n  \/\/printBMP_Pressure_OLED();\n  \/\/printDHT_OLED();\n} \/\/ end loop<\/pre>\n<p>&nbsp;<br \/>\nUMTMedia-\u00ae DHT11 Digital Module Humidity Temperature Sensor FREE CABLE Arduino Raspberry PI<br \/>\nSold by: UMTMedia<br \/>\n-\u00a32.25<br \/>\nZerama Durable GPS Mini NEO-7M\/NEO-6M Positioning Module 51 Replacement for Arduino STM32<br \/>\nSold by: zerama<br \/>\n-\u00a37.46<br \/>\nAlftek 0.96inch I2C IIC Serial 128x64 Blue OLED LCD LED Display Module for Arduino<br \/>\nSold by: Alftek Inc<br \/>\n-\u00a32.56<br \/>\nCylewet 3Pcs USB Nano V3.0 ATMEGA328P Module CH340G 5V 16M Micro-controller Board for Arduino (Pack of 3) CLW1060<br \/>\nSold by: cylewet-uk<br \/>\nReturn window closed on 17 Sep 2019<br \/>\n-\u00a39.69<br \/>\nAZDelivery  GY-68 BMP180 Digital Barometric Pressure Temperature and Altitude Sensor Module Board for Arduino<br \/>\nSold by: AZ-Delivery-Shop Product question? Ask Seller<br \/>\nReturn window closed on 13 Sep 2019<br \/>\n-\u00a33.99<br \/>\nAluuminium Box -\u00a35?<br \/>\nTotal : -\u00a325<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Packed in a Neo6 GPS, BMP180, DHT11 and OLED screen controlled by a Nano fixed into female headers for easy component swap out and height gain- shame about my engineering skills, but..it works, and finally used that 6 year old project box..: Nano code: \/****************************************************************************** Steve_GPS_DHT_BMP_OLED.ino based on: TinyGPSPlus_GPS_Shield.ino TinyGPS++ Library Example for the SparkFun <a href=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/weather-station-complete\/\" class=\"more-link\">...<span class=\"screen-reader-text\">  Weather Station Complete<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-9314","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/posts\/9314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/comments?post=9314"}],"version-history":[{"count":0,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/posts\/9314\/revisions"}],"wp:attachment":[{"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/media?parent=9314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/categories?post=9314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/tags?post=9314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}