Now with New additions - PROBLEM

Hello all,
I have been working on this project for a very long time. Time to get the money for all the additions for my weather station. So much more to do but I am at a loss for room for expansion - It will have a Micro SD card for memory - IN THE WORKS - and soon a 433mhz wireless connection to a additional 4 X 20 display. Am I hoping for too much from a Uno or a "hopefully" nano ?
This project did work very well until I added a variable to the sketch. Now i have the error message that I have exceeded the safe memory space and the project does not run all the time. I need serious help. Do I have to re-write the entire sketch to save space, If I could ?
I do not know why this sketch did work, really good, but now it refuses to run without problems.

OH YES, Another question. If I press the reset the whole project goes south. The current draw from the +5 volt supply goes from the normal 98.5 mA to around 250 mA. But if I remove supply and re-power it all it ok, when the sketch does work normally, Before changes to variables for the SD card.

I am hoping for some help from the experts, cause I am not one of them, yet.

I hope you can read my sketch and make sense out of it. Work in Progress......
Thank you,
Dave

dave_bmp388_DW_0917_Start13_OK.ino (8.09 KB)

I would like to se the wiring diagram contining the hole power situation. Your description makes me interested in the powering.
And, please use code tags when attaching code. I don't like filling up my pc with such code.

Your code will fit in a post. More members will see your code if posted properly. Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code. Your code is hard to follow with the current indenting.

You may benefit from the use of the F macro.

Can’t see the sketch , but , if you have lots of them , print statements can be a real problem .
There is a way to resolve that with :

print( F(“ some words”));

Google Arduino print “f”

Your code will fit in a post. More members will see your code if posted properly. Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code. Your code is hard to follow with the current indenting.

You may benefit from the use of the F macro.

I do not know why it was not posted properly. I did attach my code as stated in the requirements of the forum. I thought the indent would make it more readable to all and it does make it easier for all to read, I thought. I will try toe "Auto format" but I have found this only removes indent and white spaces.
Tell me if I am wrong and I will try to make it better.
I am only trying to do my best.
Dave

OP's code, most useless comments & white space removed.

//    Include starts here ##################################
#include <Wire.h>
#include <DHT.h>; // ERROR, semicolon at end of include <<<<<<<<<<<<<<<<
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BMP3XX.h"
#include "RTClib.h"
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tueday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Was full week day names but had to make them short to fit on LCD 4 x 20
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BMP3XX bmp; // I2C sensor using I2c
//Cosnstants
#define DHTPIN 7     // what pin we're connected to

#define DHTTYPE DHT22       // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE);   // Initialize DHT sensor for normal 16mhz Arduino
//  CHANGE LCD ADDRESS TO CURRENT DISPLAY
LiquidCrystal_I2C lcd(0x27,20,4);
//Variables   Start of Variables ###############################
int chk;
float bmp_temp; //Stores temperature value
float bmp_fahern; // Calculation from C to F
float dht_temp; //Stores temperature value fir DHT22
float dht_hum;  //Stores humidity value for DHT22
float dht_fahern; // Calculation from C to F
float inhg;       // From HPA to INHG
//  Start if Setup  ######################################
void setup()
{
pinMode(LED_BUILTIN,OUTPUT);
//
  dht.begin();
  lcd.init();// initialize the lcd 
  lcd.display();
  lcd.backlight();
// Fake Read to prevent wrong first Data
    dht_hum = dht.readHumidity();
    dht_temp= dht.readTemperature();
  Serial.begin(115200);
//  while (!Serial);
//  Serial.println("BMP388 and DTC22 test");
  // Set up oversampling and filter initialization
  bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
  bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
  bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
  //bmp.setOutputDataRate(BMP3_ODR_50_HZ);
// Serial.println("BtempF, BtempC, BpresM, DtempF, DtempC, Dhum%");
//
}
void loop() 
{
                      digitalWrite(LED_BUILTIN,HIGH);
//Read data and store it to variables hum and temp
                              dht_hum = dht.readHumidity();
                              dht_temp= dht.readTemperature();
                              dht_fahern=(1.80 * dht_temp+32);
                              dht_fahern=(dht_fahern+.005);  
                              bmp_fahern=(1.800 * bmp.temperature+32); // C Degrees to F degrees
                              inhg = (bmp.pressure/100 * 0.02953);
    Serial.println(" --------- ");
                                          Serial.print("BMP Temperature = ");
                                          Serial.print(bmp_fahern); 
                                          Serial.println("  F");
  Serial.print("BMP Temperature = ");
  Serial.print(bmp.temperature);
  Serial.println(" *C");
                                          Serial.print("BMP Pressure    = ");
                                          Serial.print(bmp.pressure / 100.00);
                                          Serial.println(" hPa");
  Serial.print("BMP Pressure    = ");
  Serial.print(bmp.pressure/100 *(0.02953));
  Serial.println ("  inHg");
                                          Serial.println(" ---- ");  //Not for Plotter
    Serial.print("  DHT Temperature = ");  
    Serial.print(dht_fahern);
    Serial.println("  F");  lcd.print("DHT Temperature ");
                                          Serial.print("  DHT Temperature = ");
                                          Serial.print(dht_temp,2);
                                          Serial.println(" C");
          Serial.print("  DHT Humidity    = ");
          Serial.print(dht_hum,2);
          Serial.println(" %");
                                          Serial.println();
                                          Serial.println(" ------------ ");
                                          Serial.println();
// Get time from RTC  =  DateTime now = rtc.now();
//    
DateTime now = rtc.now();
          Serial.print("(");
          Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
          Serial.print(")  ");
              Serial.print(now.month(), DEC);
              Serial.print('/');
                    Serial.print(now.day(), DEC);
                    Serial.print("/");
                        Serial.print(now.year(), DEC);
                        Serial.print("  ");    
                            Serial.print(now.hour(), DEC);
                            Serial.print(':');
                                  Serial.print(now.minute(), DEC);
                                  Serial.print(':');
                                  Serial.print(now.second(), DEC);
                                        Serial.println();            
            Serial.print("  Bar inHg    ");
            Serial.println(bmp.pressure/100 *(0.02953));
               Serial.println(" -------- ");  //   Not for Plotter
//    Start of LCD Printing ########################
  lcd.setCursor(0,0);
  lcd.print("Temp ");
  lcd.print(dht_fahern,2);
  lcd.print(" F C ");
//
    lcd.print(dht_temp,2);
      lcd.setCursor(0,1);
      lcd.print("Hum  ");
      lcd.print(dht_hum,2);
      lcd.print("%");
        lcd.setCursor(11,1);
        lcd.print(" BR ");        
        lcd.print(inhg,2);
        lcd.print("inHg");
          lcd.setCursor(0,2);
          lcd.setCursor(4,2);
          lcd.print("[");
          lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);
          lcd.print("]");
              lcd.setCursor(1,3);
              lcd.print(now.month(), DEC);
               lcd.print('/');
                  lcd.print(now.day(), DEC);
                  lcd.print("/");
                      lcd.print(now.year(), DEC);
                      lcd.print(" ");
                              lcd.print(now.hour(), DEC);
                              lcd.print(':');
                              lcd.print(now.minute(), DEC);
                              lcd.print(':');
                                  if((now.second(), DEC), DEC < 9);
                                  lcd.setCursor(17,3);
                                  lcd.print(now.second(), DEC);                                  
                                      lcd.print(" ");
//  End of LCD Print ###################################
    digitalWrite(LED_BUILTIN,LOW);  // Turn off LED now finsishe reading
  delay(10000);
}

#include <DHT.h>; // ERROR, semicolon at end of include

JCA34F:
OP's code, most useless comments & white space removed.

Well done, but didn't manage to fix the whacko formatting! :grinning:

Here.

// Include starts here ##################################
#include <Wire.h>
#include <DHT.h>; // ERROR, semicolon at end of include <<<<<<<<<<<<<<<<
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BMP3XX.h"
#include "RTClib.h"
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tueday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Was full week day names but had to make them short to fit on LCD 4 x 20
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BMP3XX bmp; // I2C sensor using I2c
//Cosnstants
#define DHTPIN 7// what pin we're connected to

#define DHTTYPE DHT22 // DHT 22(AM2302)
DHT dht(DHTPIN, DHTTYPE);// Initialize DHT sensor for normal 16mhz Arduino
//CHANGE LCD ADDRESS TO CURRENT DISPLAY
LiquidCrystal_I2C lcd(0x27, 20, 4);
//VariablesStart of Variables ###############################
int chk;
float bmp_temp; //Stores temperature value
float bmp_fahern; // Calculation from C to F
float dht_temp; //Stores temperature value fir DHT22
float dht_hum;//Stores humidity value for DHT22
float dht_fahern; // Calculation from C to F
float inhg; // From HPA to INHG
//Start if Setup######################################
void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  //
  dht.begin();
  lcd.init();// initialize the lcd
  lcd.display();
  lcd.backlight();
  // Fake Read to prevent wrong first Data
  dht_hum = dht.readHumidity();
  dht_temp = dht.readTemperature();
  Serial.begin(115200);
  //while (!Serial);
  //Serial.println("BMP388 and DTC22 test");
  // Set up oversampling and filter initialization
  bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
  bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
  bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
  //bmp.setOutputDataRate(BMP3_ODR_50_HZ);
  // Serial.println("BtempF, BtempC, BpresM, DtempF, DtempC, Dhum%");
  //
}
void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  //Read data and store it to variables hum and temp
  dht_hum = dht.readHumidity();
  dht_temp = dht.readTemperature();
  dht_fahern = (1.80 * dht_temp + 32);
  dht_fahern = (dht_fahern + .005);
  bmp_fahern = (1.800 * bmp.temperature + 32); // C Degrees to F degrees
  inhg = (bmp.pressure / 100 * 0.02953);
  Serial.println(" --------- ");
  Serial.print("BMP Temperature = ");
  Serial.print(bmp_fahern);
  Serial.println("F");
  Serial.print("BMP Temperature = ");
  Serial.print(bmp.temperature);
  Serial.println(" *C");
  Serial.print("BMP Pressure = ");
  Serial.print(bmp.pressure / 100.00);
  Serial.println(" hPa");
  Serial.print("BMP Pressure = ");
  Serial.print(bmp.pressure / 100 * (0.02953));
  Serial.println ("inHg");
  Serial.println(" ---- ");//Not for Plotter
  Serial.print("DHT Temperature = ");
  Serial.print(dht_fahern);
  Serial.println("F"); lcd.print("DHT Temperature ");
  Serial.print("DHT Temperature = ");
  Serial.print(dht_temp, 2);
  Serial.println(" C");
  Serial.print("DHT Humidity = ");
  Serial.print(dht_hum, 2);
  Serial.println(" %");
  Serial.println();
  Serial.println(" ------------ ");
  Serial.println();
  // Get time from RTC=DateTime now = rtc.now();
  //
  DateTime now = rtc.now();
  Serial.print("(");
  Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
  Serial.print(")");
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print("/");
  Serial.print(now.year(), DEC);
  Serial.print("");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();
  Serial.print("Bar inHg ");
  Serial.println(bmp.pressure / 100 * (0.02953));
  Serial.println(" -------- ");//Not for Plotter
  // Start of LCD Printing ########################
  lcd.setCursor(0, 0);
  lcd.print("Temp ");
  lcd.print(dht_fahern, 2);
  lcd.print(" F C ");
  //
  lcd.print(dht_temp, 2);
  lcd.setCursor(0, 1);
  lcd.print("Hum");
  lcd.print(dht_hum, 2);
  lcd.print("%");
  lcd.setCursor(11, 1);
  lcd.print(" BR ");
  lcd.print(inhg, 2);
  lcd.print("inHg");
  lcd.setCursor(0, 2);
  lcd.setCursor(4, 2);
  lcd.print("[");
  lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);
  lcd.print("]");
  lcd.setCursor(1, 3);
  lcd.print(now.month(), DEC);
  lcd.print('/');
  lcd.print(now.day(), DEC);
  lcd.print("/");
  lcd.print(now.year(), DEC);
  lcd.print(" ");
  lcd.print(now.hour(), DEC);
  lcd.print(':');
  lcd.print(now.minute(), DEC);
  lcd.print(':');
  if ((now.second(), DEC), DEC < 9);
  lcd.setCursor(17, 3);
  lcd.print(now.second(), DEC);
  lcd.print(" ");
  //End of LCD Print ###################################
  digitalWrite(LED_BUILTIN, LOW); // Turn off LED now finsishe reading
  delay(10000);
}

No, I didn't do it manually. :slight_smile:

Not sure what the line

 if ((now.second(), DEC), DEC < 9);

Is supposed to do?

Hello Paul,
The statement if ((now.second(), DEC), DEC < 9);
Does some formatting on the LCD for me. Not that important though. It almost works the way I wanted it to work, almost, but needs more work.
Thanks
Dave