Car Mini Info Screen

Hi guys noob here;

A while ago I decided to get rid of my cars only electronic display showing clock (old 4-digit 7-segment) and make a new and updated one. I worked hard on it but I reached my limit with code being in that state. My info panel gets stuck constantly and the data I am trying to pull from various sensors seems to be not working. Please take a look and help me to be a better arduino user. Any help would be greatly appreciated, I am open for all types of suggestions.

#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Smoothed.h>
#include <virtuabotixRTC.h>


#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET -1        // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);



#define ic A1
#define anaButon 5
#define upButon 4
#define downButon 3
#define voltajV A0

#define Page_Count 6
int lastPage;
int currentPage = 0;

virtuabotixRTC myRTC(7, 8, 9);


Smoothed<float> voltaj_olcum;
Smoothed<float> voltaj_olcum_2;
Smoothed<float> ic_olcum;
Smoothed<float> dis_olcum;
float I1;
float D1;

int ic_sic;
int dis_sic;
int t_ic;
float R1 = 10000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

//Tarih ayarları

int saat = 7;
int dakika = 25;

const unsigned char celica[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x0f, 0x80, 0x1f, 0xe0, 0x06, 0x00, 0x03, 0x00, 0x03, 0xe0, 0x00, 0xe0, 0x00, 0x00,
  0x00, 0x00, 0x1f, 0x80, 0x1f, 0xe0, 0x06, 0x00, 0x03, 0x00, 0x07, 0xe0, 0x00, 0xe0, 0x00, 0x00,
  0x00, 0x00, 0x39, 0x80, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x0e, 0x60, 0x00, 0xe0, 0x00, 0x00,
  0x00, 0x00, 0x70, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x01, 0xb0, 0x00, 0x00,
  0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x18, 0x00, 0x01, 0xb0, 0x00, 0x00,
  0x00, 0x00, 0xe0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x38, 0x00, 0x01, 0xb0, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x01, 0x30, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x18, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x1f, 0xc0, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x18, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x1f, 0xc0, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x18, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x06, 0x1c, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x07, 0xfc, 0x00, 0x00,
  0x00, 0x00, 0xc0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x30, 0x00, 0x07, 0xfc, 0x00, 0x00,
  0x00, 0x00, 0xe0, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x38, 0x00, 0x06, 0x0c, 0x00, 0x00,
  0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x18, 0x00, 0x0c, 0x0e, 0x00, 0x00,
  0x00, 0x00, 0x70, 0x00, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x0c, 0x06, 0x00, 0x00,
  0x00, 0x00, 0x38, 0xc0, 0x18, 0x00, 0x06, 0x00, 0x03, 0x00, 0x0e, 0x30, 0x0c, 0x06, 0x00, 0x00,
  0x00, 0x00, 0x3f, 0xc0, 0x1f, 0xe0, 0x07, 0xf8, 0x03, 0x00, 0x0f, 0xf0, 0x1c, 0x06, 0x00, 0x00,
  0x00, 0x00, 0x0f, 0x80, 0x1f, 0xe0, 0x07, 0xf8, 0x03, 0x00, 0x03, 0xe0, 0x1c, 0x07, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char silouhette[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0xf0, 0x0e, 0x70, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0xff, 0xf1, 0x82, 0x3e, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0xff, 0xf1, 0xe1, 0x0f, 0xc0, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x3f, 0xff, 0xf1, 0xf8, 0x80, 0xf8, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xff, 0xff, 0xf1, 0xfc, 0x60, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7f, 0xff, 0xf1, 0xf0, 0x7c, 0x00, 0x40, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x7f, 0xfc, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xf0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x80, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x0f, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xfe, 0x08, 0x00,
  0x00, 0x00, 0x01, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xfe, 0x78, 0x00,
  0x00, 0x00, 0x3f, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xfe, 0x08, 0x00,
  0x00, 0x00, 0x1f, 0xfc, 0x3f, 0xf3, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xfe, 0x00, 0x00,
  0x00, 0x0f, 0x1f, 0xe0, 0x07, 0xf3, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xfc, 0x00, 0xff, 0xf8, 0x00,
  0x00, 0x00, 0x1f, 0x80, 0x01, 0xf3, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xf0, 0x00, 0x3f, 0xf8, 0x00,
  0x00, 0x20, 0x7f, 0x03, 0xc0, 0xf3, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe0, 0x78, 0x1f, 0xf8, 0x00,
  0x00, 0x0f, 0xfe, 0x0f, 0xf0, 0x73, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xc1, 0xfe, 0x0f, 0xfe, 0x00,
  0x00, 0x0f, 0xfe, 0x1f, 0xf8, 0x71, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xc3, 0xff, 0x0f, 0xfe, 0x00,
  0x00, 0x4f, 0xfc, 0x3f, 0xfc, 0x31, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xc7, 0xff, 0x87, 0xfe, 0x00,
  0x00, 0x3f, 0xfc, 0x7f, 0xfe, 0x39, 0xff, 0xff, 0xff, 0xf8, 0xff, 0x8f, 0xff, 0xc7, 0xfe, 0x00,
  0x00, 0x3f, 0xfc, 0x7f, 0xfe, 0x19, 0xff, 0xff, 0xff, 0xf9, 0xff, 0x8f, 0xff, 0xc7, 0x80, 0x00
};

const unsigned char termometre[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00,
  0x0b, 0x80, 0x08, 0x00, 0x08, 0x00, 0x0b, 0x80, 0x08, 0x00, 0x08, 0x00, 0x0b, 0x80, 0x08, 0x00,
  0x08, 0x00, 0x0b, 0x80, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x1c, 0x00, 0x3e, 0x00, 0x3e, 0x00,
  0x3e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char guc[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00,
  0x0c, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0x18, 0x00, 0x18, 0x00, 0x3c, 0x00, 0x3f, 0xc0, 0x7f, 0x80,
  0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x0c, 0x00,
  0x0c, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char kabin[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x38, 0x00, 0x3c, 0x00,
  0x36, 0x00, 0x93, 0x00, 0x81, 0x80, 0x99, 0x80, 0xb8, 0xc0, 0xe0, 0xc0, 0x60, 0x40, 0x3c, 0x40,
  0x3e, 0x40, 0x60, 0x40, 0xe0, 0xc0, 0xf0, 0xc0, 0x98, 0x80, 0x81, 0x80, 0x83, 0x00, 0x06, 0x00,
  0x1c, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char saatimge[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
  0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00,
  0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

int currentMillis = 0;
int previousMillis = 0;

void setup() {

  pinMode(ic, INPUT);
  pinMode(voltajV, INPUT);
  pinMode(anaButon, INPUT_PULLUP);
  pinMode(upButon, INPUT_PULLUP);
  pinMode(downButon, INPUT_PULLUP);

  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
  display.setTextColor(WHITE, BLACK);
  display.setFont();
  display.setRotation(0);

  voltaj_olcum.begin(SMOOTHED_AVERAGE, 10);
  ic_olcum.begin(SMOOTHED_EXPONENTIAL, 4);
  dis_olcum.begin(SMOOTHED_EXPONENTIAL, 4);
  sensors.begin();

  myRTC.setDS1302Time(0, dakika, saat, 0, 0, 0, 0);
  delay(1000);

  display.clearDisplay();
  acilis();
}

void loop() {


  int ana = digitalRead(anaButon);
  int yukari = digitalRead(upButon);
  int asagi = digitalRead(downButon);

  if (ana == LOW) {
    currentPage = (currentPage + 1) % Page_Count;
    display.clearDisplay();
    Serial.println("touch");
    delay(50);
    executeCurrentFunction();
    delay(50);
  }

  if (yukari == LOW) {
    saat = saat + 1;
    if (saat > 23)
      saat = 0;
    Serial.print("yukarı");
    delay(50);
  }

  if (asagi == LOW) {
    dakika = dakika + 1;
    if (dakika > 59)
      dakika = 0;
    Serial.print("asagi");
    delay(50);
  }
}

void executeCurrentFunction() {
  switch (currentPage) {
    case 0:
      zaman();
      break;
    case 1:
      zaman_temp();
      break;
    case 2:
      dis_sicaklik();
      break;
    case 3:
      ic_sicaklik();
      break;
    case 4:
      duble_temp();
      break;
    case 5:
      voltaj();
      break;
  }
}


void zaman() {
  RTCSaat();
  display.drawBitmap(0, 0, saatimge, 11, 32, 1);
  display.setCursor(24, 8);
  display.setTextSize(3);
  if (myRTC.hours <= 9) {
    display.print("0");
    display.print(myRTC.hours);
  } else display.print(myRTC.hours);
  display.print(":");
  if (myRTC.minutes <= 9) {
    display.print("0");
    display.print(myRTC.minutes);
  } else
    display.print(myRTC.minutes);
  display.display();
  lastPage = 0;
  delay(50);
}

void ic_sicaklik() {

  temp_ic();
  display.clearDisplay();
  display.drawBitmap(0, 0, kabin, 11, 32, 1);
  display.setCursor(28, 8);
  display.setTextSize(3);
  display.print(I1, 1);
  display.print(" C");
  display.display();
  lastPage = 3;
  delay(50);
}

double temp_ic() {

  double ic_sic = analogRead(ic);
  ic_sic = log(10000.0 * ((1024.0 / ic - 1.0)));
  ic_sic = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * ic_sic * ic_sic)) * ic_sic);
  ic_sic = ic_sic - 273.15;
  ic_olcum.add(ic_sic);
  I1 = ic_olcum.get();
}

void dis_sicaklik() {

  temp_dis();
  display.drawBitmap(0, 0, termometre, 11, 32, 1);
  display.setTextSize(3);
  display.setCursor(28, 8);
  display.setTextSize(3);
  display.print(D1, 1);
  display.print(" C");
  display.display();
  lastPage = 2;
  delay(50);
}

void temp_dis() {

  sensors.requestTemperatures();
  dis_sic = sensors.getTempCByIndex(0);
  dis_olcum.add(dis_sic);
  D1 = dis_olcum.get();
}

void voltaj() {

  float voltaj_giris = analogRead(voltajV);
  float Vcalc = (5.0 / 1024) * voltaj_giris;
  Vcalc = Vcalc * 2.995;

  voltaj_olcum.add(Vcalc);
  float V1 = voltaj_olcum.get();

  display.drawBitmap(0, 0, guc, 11, 32, 1);
  display.setTextSize(3);
  display.setCursor(20, 8);
  display.print(V1, 1);
  display.setCursor(110, 8);
  display.print(" V");
  display.display();
  lastPage = 5;
  delay(100);
}

void zaman_temp() {

  temp_dis();
  RTCSaat();
  display.drawBitmap(0, 0, saatimge, 11, 32, 1);
  display.drawBitmap(64, 0, termometre, 11, 32, 1);
  display.setTextSize(2);
  display.setCursor(16, 10);
  if (myRTC.hours < 10) { display.print("0"); }
  display.print(myRTC.hours);
  if (myRTC.minutes < 10) { display.print("0"); }
  display.print(myRTC.minutes);

  display.setCursor(80, 10);
  display.print(dis_sic);
  //display.print("C");
  display.display();
  lastPage = 1;
}

void duble_temp() {

  temp_ic();
  temp_dis();
  display.drawBitmap(0, 0, kabin, 11, 32, 1);
  display.drawBitmap(64, 0, termometre, 11, 32, 1);
  display.setTextSize(2);
  display.setCursor(16, 10);
  display.print(I1);
  //display.print("C");
  display.setCursor(80, 10);
  display.print(D1);
  //display.print("C");
  display.display();
  lastPage = 4;
}

void RTCSaat() {
  myRTC.updateTime();
  currentMillis = millis();

  if (currentMillis - previousMillis >= 2000) {
    currentMillis = 0;
    myRTC.updateTime();
  }
}

void acilis() {

  for (int xLoc = 128; xLoc >= 0; (xLoc = xLoc - 32)) {
    display.drawBitmap(xLoc, 0, silouhette, 128, 32, 1);
    display.display();
    delay(35);
    display.clearDisplay();
    // display.fillScreen(BLACK);
    delay(5);
  }
  delay(750);
  display.drawBitmap(0, 0, celica, 128, 32, 1);
  display.display();
  delay(750);
  display.clearDisplay();
  currentPage = lastPage;
  executeCurrentFunction();
}

My goal in this project is to have 6 separate screens
1- clock
2- clock/ exterior temp
3- exterior temp
4- interior temp
5- exterior/interior temp
6- voltage feed from battery

I also want to use a DS 1302 module to keep track of time and adjust the time using only two buttons. Button 1 will increase the hour component whereas Button 2 will increase the minute.

Please read and regard How to get the best out of this forum - Using Arduino / Introductory Tutorials - Arduino Forum

Please post schematics.

You might be running out of memory. What board are you using?

This is the result from a Nano compile:

Sketch uses 22824 bytes (74%) of program storage space. Maximum is 30720 bytes.
Global variables use 681 bytes (33%) of dynamic memory, leaving 1367 bytes for local variables. Maximum is 2048 bytes.

I am using Uno variant and considering the OLED display on Adafruit library devouring almost 1 MB, there is still memory.

Sorry I really don't have one otherwise would have attached it.

Save 30 bytes of dynamic memory by using the (F...) macro. Replace:

  display.print("C");
  Serial.print("C");

with

  display.print(F("C"));
  Serial.print(F("C"));
1 Like

You are in for an interesting ride in electronics. Post an annotated schematic of what you built and give technical details for each of the sensors. How do you plan on protecting the electronics you install? Here is some reading when you have a hard time sleeping but read it before going to far.

There is many good application notes such as AN2689 by ST on automotive electronics. reading it will help you a lot.
https://www.st.com/resource/en/application_note/cd00181783-protection-of-automotive-electronics-from-electrical-hazards-guidelines-for-design-and-component-selection-stmicroelectronics.pdf
Also take a look at these: Distilled Automotive Electronics Design | Analog Devices and
Transient Voltage Suppression in Automotive Applications
AEC-100 https://media.monolithicpower.com/mps_cms_document/w/e/Webinar_-_Fundamentals_of_AEC-
Understanding Automotive Electronics, An Engineering Perspective by William B. Ribbens
(PDF) .Understanding Automotive Electronics, Seventh Edition An Engineering Perspective by William Ribbens | Roman Perez - Academia.edu

Then make it! You didn't throw the components in a sack and just shake.
Pen and paper usually works fine.

1 Like

Thank you all for your interest in the project. I sketched something very basic to depict the actual system. I don't have it with me now but I will add image of the actual box, cables and screen parts as soon as possible.

1 Like

I missed something in the sketch. DS18B20 was attached to A2 pin before but I changed it to D2.

I will look into those sources thank you. In general I design circuits separate from the car wiring and I add a voltage regulator for my systems because car battery combined with alternator supplies "dirty electricity" fluctuating between 12 and 14.5 volts. I also use optocouplers wherever I need arduino to get data from car sensors directly.

You have not read the links I posted. I design for transients well over 100V. The older cars were much worse then today's. How about reverse battery or 24V double battery jump to name a few. I have seen transient results where 7805s were blown apart but the OEM modules kept on working.

You will probably be OK, you are designing for 1, I did it for millions where no failures were allowed. They meet or exceeded all of the links I supplied.

No I didn't read them just yet. I am trying to find my way with high school electrical knowledge :slight_smile: I currently use LM2596 to regulate and lower the voltage and always use on cable fuses because just in case. My car is 92 model I believe it is on the boundary of old and really old cars.

You will probably be OK, you are designing for 1, I did it for millions where no failures were allowed. They meet or exceeded all of the links I supplied.

You are exactly right. You are a pro dealing with advanced design whereas I am a car enthusiast and it is just easier for me to replace a module rather than studying an entire curriculum :grinning:

You are absolutely correct. Wd did miss the most important part and that is to "have fun and enjoy"!

1 Like

If you ain't fryin' you ain't tryin'. : )

Truly, I use this same idea with success in another endeavo(u)r:
"If you are going to *mess up, do it at 100%." (as long as no one gets hurt)

I had my fair share of frying thing :smiley:

Guys thank you for all the help and support. Is there any suggestions to improve my code? It gets stuck of its own volition -sometimes at the start sometimes after working for 30 minutes- and I have not been able to solve that issue.

A slowing of code activity could be memory becoming full. Try making a version of your code that only writes to Serial Monitor, and not the OLED (removing the library, too).

I really need that screen to work otherwise the whole project becomes pointless. I have over 1 MB memory after compiling the code. I scroll an image at the beginning as an opening gesture, do you think it causes extra load on memory? I also tried to divide running codes according to cases so that they don't need to work unless summoned.

I understand you will not try my suggestions.

I could try and I am confident algorithm will work in that way but then it would not be very useful to me :slight_smile: