Uno/Nano LCD arduino-weather-station-2, DHT11, BMP80

Print Friendly, PDF & Email

Local weather station (Perranporth) using a Vantage Pro2:

http://www.sueandalan.plus.com/weewx/index.html
OK! According to:
https://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 Uno A0 (analogue serial) pin.
4. Power and Pin
DHT11’s power supply is 3-5.5V DC. 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.
DHT11 solo check code – yes the old one was dead..!
20:51:48.882 -> Current humidity = 45.00% temperature = 24.00C
An uncalibrated old analogue gauge reads 25 deg.


BMP180 Datasheet V2.5
Supply voltage VDD ripple max. 50mVpp 1.8 2.5 3.6 V 1.62 2.5 3.6
BMP180 I2C interface Pins SCL, SDA to Uno pins SCL, SDA and 3.6V DC MAX !! power.
BMP180 solo check code – I added my height of 84m ASL for local ref! I’m not in Colorado..unfortunately:


21:48:51.293 -> provided altitude: 84 meters, 276 feet
21:48:51.326 -> temperature: 25.81 deg C, 78.46 deg F
21:48:51.392 -> absolute pressure: 1011.75 mb, 29.88 inHg
21:48:51.425 -> relative (sea-level) pressure: 1021.89 mb, 30.18 inHg
21:48:51.491 -> computed altitude: 84 meters, 276 feet

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..?:


22:41:47.279 -> Current humidity = 47.00% temperature = 24.00C
22:41:52.306 ->
22:41:52.306 -> provided altitude: 1655 meters, 5430 feet
22:41:52.339 -> temperature: 24.87 deg C, 76.77 deg F
22:41:52.372 -> absolute pressure: 1012.28 mb, 29.90 inHg
22:41:52.438 -> relative (sea-level) pressure: 1236.34 mb, 36.51 inHg
22:41:52.471 -> computed altitude: 1655 meters, 5430 feet
All 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
Serial.print((9.0/5.0)*T+32.0,2); Nope.
…let’s see..? Heavy breathing on the DHT11 gets humidity and temp raised, but no decimal point values showing.
You 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:
3.6 Calculating absolute altitude
With the measured pressure p and the pressure at sea level p 0 e.g. 1013.25hPa, the altitude in meters can be calculated with the international barometric formula:

Two Sensors
Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire library.
As 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  1021.5 mb?
// On the other hand, if you want to determine your altitude from the pressure reading,
// use the altitude function along with a baseline pressure (sea-level or other).
// Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.
// Result: a = altitude in m.
a = pressure.altitude(P,1021.5);
Serial.print(“computed altitude: “);
Serial.print(a,0);
Serial.print(” meters, “);
Serial.print(a*3.28084,0);
Serial.println(” feet”);
Still not accurate even when it knows my altitude and local pressure..? The temperature is exactly the same as my analogue gauge.
01:33:37.919 -> Current humidity = 54.00% temperature = 23.00C
01:33:42.912 ->
01:33:42.912 -> provided altitude: 84 meters, 276 feet
01:33:42.945 -> temperature: 23.81 deg C, 74.86 deg F
01:33:42.978 -> absolute pressure: 1012.88 mb, 29.91 inHg
01:33:43.011 -> relative (sea-level) pressure: 1023.02 mb, 30.21 inHg
01:33:43.077 -> computed altitude: 71 meters, 234 feet
Before 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:
Any Arduino pins labeled: SDA SCL
Uno, Redboard, Pro:              A4 A5
Mega2560, Due: 20 21
Leonardo: 2 3

Yep, 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.
01:22:34.602 -> provided altitude: 1655 meters, 5430 feet
01:22:34.635 -> temperature: 24.21 deg C, 75.57 deg F
01:22:34.668 -> absolute pressure: 1012.88 mb, 29.91 inHg
01:22:34.701 -> relative (sea-level) pressure: 1237.06 mb, 36.53 inHg
01:22:34.768 -> computed altitude: 1655 meters, 5430 feet
01:22:39.798 ->
01:22:39.798 -> Current humidity = 53.00% temperature = 23.00C
Checking the new Nano’s work with LCDs on the gps LCD clock setup last Post – yep:

Now 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..!