{"id":8144,"date":"2019-08-17T01:49:53","date_gmt":"2019-08-17T00:49:53","guid":{"rendered":"https:\/\/stevepedwards.today\/quad\/Electronics\/?p=8144"},"modified":"2022-11-18T23:17:00","modified_gmt":"2022-11-18T23:17:00","slug":"nano-lcd-arduino-weather-station-2-dht11-bmp80","status":"publish","type":"post","link":"https:\/\/stevepedwards.today\/ElectronicsStuff\/nano-lcd-arduino-weather-station-2-dht11-bmp80\/","title":{"rendered":"Uno\/Nano LCD arduino-weather-station-2, DHT11, BMP80"},"content":{"rendered":"<p>Local weather station (Perranporth) using a Vantage Pro2:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-8323\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/Vantage-Pro2.jpg\" alt=\"\" width=\"296\" height=\"222\" \/><br \/>\n<a href=\"https:\/\/www.sueandalan.plus.com\/weewx\/index.html\">https:\/\/www.sueandalan.plus.com\/weewx\/index.html<\/a><br \/>\nOK! According to:<br \/>\n<a href=\"https:\/\/stevepedwards.today\/routecalculator.co.uk\/elevation\">https:\/\/stevepedwards.today\/routecalculator.co.uk\/elevation<\/a><br \/>\nmy address elevation IS the same as my phone App states, so can be added to the BMP180 code later, as my local ref. -<br \/>\n<span style=\"color: #ff0000;\">Altitude: 84 m. (276 ft)<\/span><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8313\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/AltMe.png\" alt=\"\" width=\"270\" height=\"480\" \/><br \/>\nBut first, check the sensors work!:<br \/>\n<a href=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/DHT11-Datasheet.pdf\">DHT11-Datasheet<\/a><\/p>\n<p>DHT middle pin out to Uno A0 (<span style=\"color: #ff0000;\">analogue serial<\/span>) pin.<br \/>\n4. Power and Pin<br \/>\nDHT11's power supply is <span style=\"color: #ff0000;\">3-5.5V DC<\/span>. When power is supplied to the sensor, do not send any instruction to the sensor in within one second in order to pass the unstable status. One capacitor valued 100nF can be added between VDD and GND for power filtering.<br \/>\nDHT11 solo check code - yes the old one was dead..!<br \/>\n<span style=\"color: #ff0000;\">20:51:48.882 -&gt; Current humidity = 45.00% temperature = 24.00C<\/span><br \/>\nAn uncalibrated old analogue gauge reads 25 deg.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-8290\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/DHT11-temp-768x1024.jpg\" alt=\"\" width=\"768\" height=\"1024\" \/><\/p>\n<pre class=\"lang:default decode:true\">#include \"dht.h\"\r\n#define dht_apin A0 \/\/ Analog Pin sensor is connected to\r\ndht DHT;\r\nvoid setup(){\r\n  Serial.begin(9600);\r\n  delay(500);\/\/Delay to let system boot\r\n  Serial.println(\"DHT11 Humidity &amp; temperature Sensor\\n\\n\");\r\n  delay(1000);\/\/Wait before accessing Sensor\r\n}\/\/end \"setup()\"\r\nvoid loop(){\r\n  \/\/Start of Program\r\n    DHT.read11(dht_apin);\r\n    Serial.print(\"Current humidity = \");\r\n    Serial.print(DHT.humidity);\r\n    Serial.print(\"%  \");\r\n    Serial.print(\"temperature = \");\r\n    Serial.print(DHT.temperature);\r\n    Serial.println(\"C  \");\r\n    delay(5000);\/\/Wait 5 seconds before accessing sensor again.\r\n  \/\/Fastest should be once every two seconds.\r\n}\/\/ end loop()<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-8298 size-full\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/DHT11tempshum-1.png\" alt=\"\" width=\"840\" height=\"473\" \/><br \/>\n<a href=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/BMP180-Datasheet-V2.5.pdf\">BMP180 Datasheet V2.5<\/a><br \/>\n<span style=\"color: #0000ff;\"><em>Supply voltage VDD ripple max. 50mVpp 1.8 2.5 <span style=\"color: #ff0000;\">3.6 V<\/span> 1.62 2.5 3.6<\/em><\/span><br \/>\nBMP180 <span style=\"color: #ff0000;\">I2C<\/span> interface Pins SCL, SDA to Uno pins SCL, SDA and <span style=\"color: #ff0000;\">3.6V DC MAX<\/span> !! power.<br \/>\nBMP180 solo check code - I added my height of 84m ASL for local ref! I'm not in Colorado..unfortunately:<\/p>\n<pre class=\"lang:default decode:true\">\/* SFE_BMP180 library example sketch\r\nThis sketch shows how to use the SFE_BMP180 library to read the\r\nBosch BMP180 barometric pressure sensor.\r\nhttps:\/\/www.sparkfun.com\/products\/11824\r\nLike most pressure sensors, the BMP180 measures absolute pressure.\r\nThis is the actual ambient pressure seen by the device, which will\r\nvary with both altitude and weather.\r\nBefore taking a pressure reading you must take a temparture reading.\r\nThis is done with startTemperature() and getTemperature().\r\nThe result is in degrees C.\r\nOnce you have a temperature reading, you can take a pressure reading.\r\nThis is done with startPressure() and getPressure().\r\nThe result is in millibar (mb) aka hectopascals (hPa).\r\nIf you'll be monitoring weather patterns, you will probably want to\r\nremove the effects of altitude. This will produce readings that can\r\nbe compared to the published pressure readings from other locations.\r\nTo do this, use the sealevel() function. You will need to provide\r\nthe known altitude at which the pressure was measured.\r\nIf you want to measure altitude, you will need to know the pressure\r\nat a baseline altitude. This can be average sealevel pressure, or\r\na previous pressure reading at your altitude, in which case\r\nsubsequent altitude readings will be + or - the initial baseline.\r\nThis is done with the altitude() function.\r\nHardware connections:\r\n- (GND) to GND\r\n+ (VDD) to 3.3V\r\n(WARNING: do not connect + to 5V or the sensor will be damaged!)\r\nYou will also need to connect the I2C pins (SCL and SDA) to your\r\nArduino. The pins are different on different Arduinos:\r\nAny Arduino pins labeled:  SDA  SCL\r\nUno, Redboard, Pro:        A4   A5\r\nMega2560, Due:             20   21\r\nLeonardo:                   2    3\r\nLeave the IO (VDDIO) pin unconnected. This pin is for connecting\r\nthe BMP180 to systems with lower logic levels such as 1.8V\r\nHave fun! -Your friends at SparkFun.\r\nThe SFE_BMP180 library uses floating-point equations developed by the\r\nWeather Station Data Logger project: https:\/\/stevepedwards.today\/wmrx00.sourceforge.net\/\r\nOur example code uses the \"beerware\" license. You can do anything\r\nyou like with this code. No really, anything. If you find it useful,\r\nbuy me a beer someday.\r\nV10 Mike Grusin, SparkFun Electronics 10\/24\/2013\r\nV1.1.2 Updates for Arduino 1.6.4 5\/2015\r\n*\/\r\n\/\/ Your sketch must #include this library, and the Wire library.\r\n\/\/ (Wire is a standard library included with Arduino.):\r\n#include &lt;SFE_BMP180.h&gt;\r\n#include &lt;Wire.h&gt;\r\n\/\/ You will need to create an SFE_BMP180 object, here called \"pressure\":\r\nSFE_BMP180 pressure;\r\n#define ALTITUDE <span style=\"color: #ff0000;\">84.0<\/span> \/\/ Altitude of SparkFun's HQ in Boulder, CO. in meters...<span style=\"color: #ff0000;\">Not me!<\/span>\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  Serial.println(\"REBOOT\");\r\n  \/\/ Initialize the sensor (it is important to get calibration values stored on the device).\r\n  if (pressure.begin())\r\n    Serial.println(\"BMP180 init success\");\r\n  else\r\n  {\r\n    \/\/ Oops, something went wrong, this is usually a connection problem,\r\n    \/\/ see the comments at the top of this sketch for the proper connections.\r\n    Serial.println(\"BMP180 init fail\\n\\n\");\r\n    while(1); \/\/ Pause forever.\r\n  }\r\n}\r\nvoid loop()\r\n{\r\n  char status;\r\n  double T,P,p0,a;\r\n  \/\/ Loop here getting pressure readings every 10 seconds.\r\n  \/\/ If you want sea-level-compensated pressure, as used in weather reports,\r\n  \/\/ you will need to know the altitude at which your measurements are taken.\r\n  \/\/ We're using a constant called ALTITUDE in this sketch:\r\n  Serial.println();\r\n  Serial.print(\"provided altitude: \");\r\n  Serial.print(ALTITUDE,0);\r\n  Serial.print(\" meters, \");\r\n  Serial.print(ALTITUDE*3.28084,0);\r\n  Serial.println(\" feet\");\r\n  \/\/ If you want to measure altitude, and not pressure, you will instead need\r\n  \/\/ to provide a known baseline pressure. This is shown at the end of the sketch.\r\n  \/\/ You must first get a temperature measurement to perform a pressure reading.\r\n  \/\/ Start a temperature measurement:\r\n  \/\/ If request is successful, the number of ms to wait is returned.\r\n  \/\/ If request is unsuccessful, 0 is returned.\r\n  status = pressure.startTemperature();\r\n  if (status != 0)\r\n  {\r\n    \/\/ Wait for the measurement to complete:\r\n    delay(status);\r\n    \/\/ Retrieve the completed temperature measurement:\r\n    \/\/ Note that the measurement is stored in the variable T.\r\n    \/\/ Function returns 1 if successful, 0 if failure.\r\n    status = pressure.getTemperature(T);\r\n    if (status != 0)\r\n    {\r\n      \/\/ Print out the measurement:\r\n      Serial.print(\"temperature: \");\r\n      Serial.print(T,2);\r\n      Serial.print(\" deg C, \");\r\n      Serial.print((9.0\/5.0)*T+32.0,2);\r\n      Serial.println(\" deg F\");\r\n      \/\/ Start a pressure measurement:\r\n      \/\/ The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).\r\n      \/\/ If request is successful, the number of ms to wait is returned.\r\n      \/\/ If request is unsuccessful, 0 is returned.\r\n      status = pressure.startPressure(3);\r\n      if (status != 0)\r\n      {\r\n        \/\/ Wait for the measurement to complete:\r\n        delay(status);\r\n        \/\/ Retrieve the completed pressure measurement:\r\n        \/\/ Note that the measurement is stored in the variable P.\r\n        \/\/ Note also that the function requires the previous temperature measurement (T).\r\n        \/\/ (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)\r\n        \/\/ Function returns 1 if successful, 0 if failure.\r\n        status = pressure.getPressure(P,T);\r\n        if (status != 0)\r\n        {\r\n          \/\/ Print out the measurement:\r\n          Serial.print(\"absolute pressure: \");\r\n          Serial.print(P,2);\r\n          Serial.print(\" mb, \");\r\n          Serial.print(P*0.0295333727,2);\r\n          Serial.println(\" inHg\");\r\n          \/\/ The pressure sensor returns abolute pressure, which varies with altitude.\r\n          \/\/ To remove the effects of altitude, use the sealevel function and your current altitude.\r\n          \/\/ This number is commonly used in weather reports.\r\n          \/\/ Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.\r\n          \/\/ Result: p0 = sea-level compensated pressure in mb\r\n          p0 = pressure.sealevel(P,ALTITUDE); \/\/ we're at 1655 meters (Boulder, CO)\r\n          Serial.print(\"relative (sea-level) pressure: \");\r\n          Serial.print(p0,2);\r\n          Serial.print(\" mb, \");\r\n          Serial.print(p0*0.0295333727,2);\r\n          Serial.println(\" inHg\");\r\n          \/\/ On the other hand, if you want to determine your altitude from the pressure reading,\r\n          \/\/ use the altitude function along with a baseline pressure (sea-level or other).\r\n          \/\/ Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.\r\n          \/\/ Result: a = altitude in m.\r\n          a = pressure.altitude(P,p0);\r\n          Serial.print(\"computed altitude: \");\r\n          Serial.print(a,0);\r\n          Serial.print(\" meters, \");\r\n          Serial.print(a*3.28084,0);\r\n          Serial.println(\" feet\");\r\n        }\r\n        else Serial.println(\"error retrieving pressure measurement\\n\");\r\n      }\r\n      else Serial.println(\"error starting pressure measurement\\n\");\r\n    }\r\n    else Serial.println(\"error retrieving temperature measurement\\n\");\r\n  }\r\n  else Serial.println(\"error starting temperature measurement\\n\");\r\n  delay(5000);  \/\/ Pause for 5 seconds.\r\n}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-8292\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/BMP180ser-1024x576.png\" alt=\"\" width=\"840\" height=\"473\" \/><br \/>\n<span style=\"color: #ff0000;\">21:48:51.293 -&gt; provided altitude: 84 meters, 276 feet<\/span><br \/>\n<span style=\"color: #ff0000;\">21:48:51.326 -&gt; temperature: 25.81 deg C, 78.46 deg F<\/span><br \/>\n<span style=\"color: #ff0000;\">21:48:51.392 -&gt; absolute pressure: 1011.75 mb, 29.88 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">21:48:51.425 -&gt; relative (sea-level) pressure: 1021.89 mb, 30.18 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">21:48:51.491 -&gt; computed altitude: 84 meters, 276 feet <\/span><\/p>\n<p>Combining the 2 sensors code from original zip files, for SerialMon output first for Temp comparisons between both sensors - easier to add parts from DHT11 code to BMP180..?:<\/p>\n<pre class=\"lang:default decode:true \">\/* SFE_BMP180 library example sketch\r\nThis sketch shows how to use the SFE_BMP180 library to read the\r\nBosch BMP180 barometric pressure sensor.\r\nhttps:\/\/www.sparkfun.com\/products\/11824\r\nLike most pressure sensors, the BMP180 measures absolute pressure.\r\nThis is the actual ambient pressure seen by the device, which will\r\nvary with both altitude and weather.\r\nBefore taking a pressure reading you must take a temparture reading.\r\nThis is done with startTemperature() and getTemperature().\r\nThe result is in degrees C.\r\nOnce you have a temperature reading, you can take a pressure reading.\r\nThis is done with startPressure() and getPressure().\r\nThe result is in millibar (mb) aka hectopascals (hPa).\r\nIf you'll be monitoring weather patterns, you will probably want to\r\nremove the effects of altitude. This will produce readings that can\r\nbe compared to the published pressure readings from other locations.\r\nTo do this, use the sealevel() function. You will need to provide\r\nthe known altitude at which the pressure was measured.\r\nIf you want to measure altitude, you will need to know the pressure\r\nat a baseline altitude. This can be average sealevel pressure, or\r\na previous pressure reading at your altitude, in which case\r\nsubsequent altitude readings will be + or - the initial baseline.\r\nThis is done with the altitude() function.\r\nHardware connections:\r\n- (GND) to GND\r\n+ (VDD) to 3.3V\r\n(WARNING: do not connect + to 5V or the sensor will be damaged!)\r\nYou will also need to connect the I2C pins (SCL and SDA) to your\r\nArduino. The pins are different on different Arduinos:\r\nAny Arduino pins labeled:  SDA  SCL\r\nUno, Redboard, Pro:        A4   A5\r\nMega2560, Due:             20   21\r\nLeonardo:                   2    3\r\nLeave the IO (VDDIO) pin unconnected. This pin is for connecting\r\nthe BMP180 to systems with lower logic levels such as 1.8V\r\nHave fun! -Your friends at SparkFun.\r\nThe SFE_BMP180 library uses floating-point equations developed by the\r\nWeather Station Data Logger project: https:\/\/stevepedwards.today\/wmrx00.sourceforge.net\/\r\nOur example code uses the \"beerware\" license. You can do anything\r\nyou like with this code. No really, anything. If you find it useful,\r\nbuy me a beer someday.\r\nV10 Mike Grusin, SparkFun Electronics 10\/24\/2013\r\nV1.1.2 Updates for Arduino 1.6.4 5\/2015\r\n*\/\r\n\/\/ Your sketch must #include this library, and the Wire library.\r\n\/\/ (Wire is a standard library included with Arduino.):\r\n#include &lt;SFE_BMP180.h&gt;\r\n#include &lt;Wire.h&gt;\r\n#include \"dht.h\"\r\n#define dht_apin A0 \/\/ Analog Pin sensor is connected to\r\ndht DHT;\r\n\/\/ You will need to create an SFE_BMP180 object, here called \"pressure\":\r\nSFE_BMP180 pressure;\r\n#define ALTITUDE 1655.0 \/\/ Altitude of SparkFun's HQ in Boulder, CO. in meters\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  delay(500);\/\/Delay to let system boot\r\n  Serial.println(\"DHT11 Humidity &amp; temperature Sensor\\n\\n\");\r\n  delay(1000);\/\/Wait before accessing Sensor\r\n  Serial.println();\r\n  Serial.println(\"REBOOT\");\r\n  \/\/ Initialize the sensor (it is important to get calibration values stored on the device).\r\n  if (pressure.begin())\r\n    Serial.println(\"BMP180 init success\");\r\n  else\r\n  {\r\n    \/\/ Oops, something went wrong, this is usually a connection problem,\r\n    \/\/ see the comments at the top of this sketch for the proper connections.\r\n    Serial.println(\"BMP180 init fail\\n\\n\");\r\n    while(1); \/\/ Pause forever.\r\n  }\r\n}\r\nvoid loop()\r\n{\r\n  char status;\r\n  double T,P,p0,a;\r\n            \/\/Start of Program\r\n    DHT.read11(dht_apin);\r\n    Serial.println();\r\n    Serial.print(\"Current humidity = \");\r\n    Serial.print(DHT.humidity);\r\n    Serial.print(\"%  \");\r\n    Serial.print(\"temperature = \");\r\n    Serial.print(DHT.temperature);\r\n    Serial.println(\"C  \");\r\n    delay(5000);\/\/Wait 5 seconds before accessing sensor again.\r\n  \/\/Fastest should be once every two seconds.\r\n  \/\/ Loop here getting pressure readings every 10 seconds.\r\n  \/\/ If you want sea-level-compensated pressure, as used in weather reports,\r\n  \/\/ you will need to know the altitude at which your measurements are taken.\r\n  \/\/ We're using a constant called ALTITUDE in this sketch:\r\n  Serial.println();\r\n  Serial.print(\"provided altitude: \");\r\n  Serial.print(ALTITUDE,0);\r\n  Serial.print(\" meters, \");\r\n  Serial.print(ALTITUDE*3.28084,0);\r\n  Serial.println(\" feet\");\r\n  \/\/ If you want to measure altitude, and not pressure, you will instead need\r\n  \/\/ to provide a known baseline pressure. This is shown at the end of the sketch.\r\n  \/\/ You must first get a temperature measurement to perform a pressure reading.\r\n  \/\/ Start a temperature measurement:\r\n  \/\/ If request is successful, the number of ms to wait is returned.\r\n  \/\/ If request is unsuccessful, 0 is returned.\r\n  status = pressure.startTemperature();\r\n  if (status != 0)\r\n  {\r\n    \/\/ Wait for the measurement to complete:\r\n    delay(status);\r\n    \/\/ Retrieve the completed temperature measurement:\r\n    \/\/ Note that the measurement is stored in the variable T.\r\n    \/\/ Function returns 1 if successful, 0 if failure.\r\n    status = pressure.getTemperature(T);\r\n    if (status != 0)\r\n    {\r\n      \/\/ Print out the measurement:\r\n      Serial.print(\"temperature: \");\r\n      Serial.print(T,2);\r\n      Serial.print(\" deg C, \");\r\n      Serial.print((9.0\/5.0)*T+32.0,2);\r\n      Serial.println(\" deg F\");\r\n      \/\/ Start a pressure measurement:\r\n      \/\/ The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).\r\n      \/\/ If request is successful, the number of ms to wait is returned.\r\n      \/\/ If request is unsuccessful, 0 is returned.\r\n      status = pressure.startPressure(3);\r\n      if (status != 0)\r\n      {\r\n        \/\/ Wait for the measurement to complete:\r\n        delay(status);\r\n        \/\/ Retrieve the completed pressure measurement:\r\n        \/\/ Note that the measurement is stored in the variable P.\r\n        \/\/ Note also that the function requires the previous temperature measurement (T).\r\n        \/\/ (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)\r\n        \/\/ Function returns 1 if successful, 0 if failure.\r\n        status = pressure.getPressure(P,T);\r\n        if (status != 0)\r\n        {\r\n          \/\/ Print out the measurement:\r\n          Serial.print(\"absolute pressure: \");\r\n          Serial.print(P,2);\r\n          Serial.print(\" mb, \");\r\n          Serial.print(P*0.0295333727,2);\r\n          Serial.println(\" inHg\");\r\n          \/\/ The pressure sensor returns abolute pressure, which varies with altitude.\r\n          \/\/ To remove the effects of altitude, use the sealevel function and your current altitude.\r\n          \/\/ This number is commonly used in weather reports.\r\n          \/\/ Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.\r\n          \/\/ Result: p0 = sea-level compensated pressure in mb\r\n          p0 = pressure.sealevel(P,ALTITUDE); \/\/ we're at 1655 meters (Boulder, CO)\r\n          Serial.print(\"relative (sea-level) pressure: \");\r\n          Serial.print(p0,2);\r\n          Serial.print(\" mb, \");\r\n          Serial.print(p0*0.0295333727,2);\r\n          Serial.println(\" inHg\");\r\n          \/\/ On the other hand, if you want to determine your altitude from the pressure reading,\r\n          \/\/ use the altitude function along with a baseline pressure (sea-level or other).\r\n          \/\/ Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.\r\n          \/\/ Result: a = altitude in m.\r\n          a = pressure.altitude(P,p0);\r\n          Serial.print(\"computed altitude: \");\r\n          Serial.print(a,0);\r\n          Serial.print(\" meters, \");\r\n          Serial.print(a*3.28084,0);\r\n          Serial.println(\" feet\");\r\n        }\r\n        else Serial.println(\"error retrieving pressure measurement\\n\");\r\n      }\r\n      else Serial.println(\"error starting pressure measurement\\n\");\r\n    }\r\n    else Serial.println(\"error retrieving temperature measurement\\n\");\r\n  }\r\n  else Serial.println(\"error starting temperature measurement\\n\");\r\n  delay(5000);  \/\/ Pause for 5 seconds.\r\n}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-8307\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/DHT11_BMP180SERIAL-1024x704.png\" alt=\"\" width=\"840\" height=\"578\" \/><br \/>\n<span style=\"color: #ff0000;\">22:41:47.279 -&gt; Current humidity = 47.00% temperature = 24.00C <\/span><br \/>\n<span style=\"color: #ff0000;\">22:41:52.306 -&gt; <\/span><br \/>\n<span style=\"color: #ff0000;\">22:41:52.306 -&gt; provided altitude: 1655 meters, 5430 feet<\/span><br \/>\n<span style=\"color: #ff0000;\">22:41:52.339 -&gt; temperature: 24.87 deg C, 76.77 deg F<\/span><br \/>\n<span style=\"color: #ff0000;\">22:41:52.372 -&gt; absolute pressure: 1012.28 mb, 29.90 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">22:41:52.438 -&gt; relative (sea-level) pressure: 1236.34 mb, 36.51 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">22:41:52.471 -&gt; computed altitude: 1655 meters, 5430 feet <\/span><br \/>\nAll good! Note temp diffs between sensors of possibly rounded down values or library constants - 0.87 deg diff. Is this as there is no decimal place code in the DHT11 example? It's not showing any decimals where the bmp180 code does<br \/>\n<em>Serial.print((9.0\/5.0)*T+32.0,<span style=\"color: #ff0000;\">2<\/span>);<\/em> Nope.<br \/>\n...let's see..? Heavy breathing on the DHT11 gets humidity and temp raised, but no decimal point values showing.<br \/>\nYou can see from the Datasheet the bmp180 unit can determine absolute temp and pressure, the values of which have been attempted in the code, but obviously incorrectly as the figures are way off local weather station data:<br \/>\n<span style=\"color: #3366ff;\"><em> 3.6 Calculating absolute altitude<\/em><\/span><br \/>\n<span style=\"color: #3366ff;\"><em>With the measured pressure p and the pressure at sea level p 0 e.g. 1013.25hPa, the altitude in <\/em><\/span><span style=\"color: #3366ff;\"><em>meters can be calculated with the international barometric formula:<\/em><\/span><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8320\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/bmpcalc.png\" alt=\"\" width=\"915\" height=\"715\" \/><br \/>\n<strong>Two Sensors<\/strong><br \/>\n<span style=\"color: #0000ff;\"><em>Analog-\u00a0<strong>pin 4 (SDA) and pin 5 (SCA)<\/strong>-\u00a0also used for TWI communication-\u00a0<strong>using Wire library.<\/strong><\/em><\/span><br \/>\nAs I have run this code with my local altitude added on the bmp180 already, can I get a close Alt value from the sensor by giving it local pressure data of-\u00a0 1021.5 mb?<br \/>\n<em><span style=\"color: #0000ff;\">\/\/ On the other hand, if you want to determine your altitude from the pressure reading,<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">\/\/ use the altitude function along with a baseline pressure (sea-level or other).<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">\/\/ Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">\/\/ Result: a = altitude in m.<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">a = pressure.altitude(P,<span style=\"color: #ff0000;\">1021.<\/span>5);<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Serial.print(\"computed altitude: \");<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Serial.print(a,0);<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Serial.print(\" meters, \");<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Serial.print(a*3.28084,0);<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Serial.println(\" feet\");<\/span><\/em><br \/>\nStill not accurate even when it knows my altitude and local pressure..? The temperature is exactly the same as my analogue gauge.<br \/>\n<span style=\"color: #ff0000;\">01:33:37.919 -&gt; Current humidity = 54.00% temperature = 23.00C<\/span><br \/>\n<span style=\"color: #ff0000;\">01:33:42.912 -&gt; <\/span><br \/>\n<em><strong><span style=\"color: #ff0000;\">01:33:42.912 -&gt; provided altitude: 84 meters, 276 feet<\/span><\/strong><\/em><br \/>\n<span style=\"color: #ff0000;\">01:33:42.945 -&gt; temperature: 23.81 deg C, 74.86 deg F<\/span><br \/>\n<span style=\"color: #ff0000;\">01:33:42.978 -&gt; absolute pressure: 1012.88 mb, 29.91 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">01:33:43.011 -&gt; relative (sea-level) pressure: 1023.02 mb, 30.21 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\"><em>01:33:43.077 -&gt; <\/em><strong><em>computed altitude: 71 meters, 234 feet<\/em> <\/strong><\/span><br \/>\nBefore adding LCD setup and code, let's port it to a Nano...only 5 wires, where Uno SDA\/SCL lines move to Nano pins 4\/5 as we're using the Wire.h lib, and no changed code as the code info states:<br \/>\n<em><span style=\"color: #0000ff;\">Any Arduino pins labeled: SDA SCL<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Uno, Redboard, Pro:-\u00a0 -\u00a0 -\u00a0 -\u00a0 -\u00a0 -\u00a0 -\u00a0 <span style=\"color: #ff0000;\">A4 A5<\/span><\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Mega2560, Due: 20 21<\/span><\/em><br \/>\n<em><span style=\"color: #0000ff;\">Leonardo: 2 3<\/span><\/em><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-8350\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/nanopins-1024x768.jpg\" alt=\"\" width=\"840\" height=\"630\" \/><br \/>\nYep, old Nano works fine too. But, 3 new arrivals did not at first, with a flashing red L light - they have the old bootloader! Change under Tools\/Processor.<br \/>\n<span style=\"color: #ff0000;\">01:22:34.602 -&gt; provided altitude: 1655 meters, 5430 feet<\/span><br \/>\n<span style=\"color: #ff0000;\">01:22:34.635 -&gt; temperature: 24.21 deg C, 75.57 deg F<\/span><br \/>\n<span style=\"color: #ff0000;\">01:22:34.668 -&gt; absolute pressure: 1012.88 mb, 29.91 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">01:22:34.701 -&gt; relative (sea-level) pressure: 1237.06 mb, 36.53 inHg<\/span><br \/>\n<span style=\"color: #ff0000;\">01:22:34.768 -&gt; computed altitude: 1655 meters, 5430 feet<\/span><br \/>\n<span style=\"color: #ff0000;\">01:22:39.798 -&gt; <\/span><br \/>\n<span style=\"color: #ff0000;\">01:22:39.798 -&gt; Current humidity = 53.00% temperature = 23.00C<\/span><br \/>\nChecking the new Nano's work with LCDs on the gps LCD clock setup last Post - yep:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-8332\" src=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-content\/uploads\/2019\/08\/newnanolcd-1024x768.jpg\" alt=\"\" width=\"840\" height=\"630\" \/><br \/>\nNow I'm in a position to add these sensors to the GPS LCD clock in the next Post as it is only 3 more wires that are free on the Nano..!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Local weather station (Perranporth) using a Vantage Pro2: https:\/\/www.sueandalan.plus.com\/weewx\/index.html OK! According to: https:\/\/stevepedwards.today\/routecalculator.co.uk\/elevation my address elevation IS the same as my phone App states, so can be added to the BMP180 code later, as my local ref. - Altitude: 84 m. (276 ft) But first, check the sensors work!: DHT11-Datasheet DHT middle pin out to <a href=\"https:\/\/stevepedwards.today\/ElectronicsStuff\/nano-lcd-arduino-weather-station-2-dht11-bmp80\/\" class=\"more-link\">...<span class=\"screen-reader-text\">  Uno\/Nano LCD arduino-weather-station-2, DHT11, BMP80<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"gallery","meta":{"footnotes":""},"categories":[5,2],"tags":[],"class_list":["post-8144","post","type-post","status-publish","format-gallery","hentry","category-tech-studies","category-uncategorized","post_format-post-format-gallery"],"_links":{"self":[{"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/posts\/8144","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=8144"}],"version-history":[{"count":2,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/posts\/8144\/revisions"}],"predecessor-version":[{"id":9864,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/posts\/8144\/revisions\/9864"}],"wp:attachment":[{"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/media?parent=8144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/categories?post=8144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stevepedwards.today\/ElectronicsStuff\/wp-json\/wp\/v2\/tags?post=8144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}