problem with simultan analog reading

Hi!
when i read 2 analog inputs simultaneous (i tried with delay up to 0.1s), the measured value jumps around with a difference of +/- 0.1 V.
With just one analog read I get nice and constant values.

How can i Read more than one analog Inputs without getting jumping values?

Martin419: when i read 2 analog inputs simultaneous

Do you mean consecutively? It's not possible to perform two analog reads simultaneously.

sure ... you're right. my code:

// Tempmessung mit LM35

int val_LM35 = 0; int u_LM35 = 0; float LM35_temp = 0;

// Temperaturmessung mit Wasser-NTC

int val_NTC = 0; // Eingangswert int u_NTC = 0; // Spannung float NTC_temp = 0; // Temperatur

void setup() { Serial.begin(9600); analogReference(EXTERNAL); }

void loop() { // Vergleichstemperatur mit LM35 messen... val_LM35 = analogRead(0); u_LM35 = val_LM35*5000.0/1024; LM35_temp = u_LM35/10 ; Serial.print("Temp: "); Serial.println(LM35_temp);

// Temperatur mit NTC messen val_NTC = analogRead(2); u_NTC = val_NTC*5.0/1024;

NTC_temp = + 0.2514 *pow(u_NTC, 6) // Formel mit excel erstellt - 3.7812 *pow(u_NTC, 5) // Fehlerdiagnose sieht excel-file + 22.4840 *pow(u_NTC, 4) - 70.0990 *pow(u_NTC, 3) + 133.2200 *pow(u_NTC, 2) - 196.9600 * u_NTC + 275.8900 ;

// int NTC_temp = NTC_temp; //Für Ausgabe ohne Komma

Serial.print("NTC_temp: "); Serial.println(NTC_temp); Serial.println(" C"); Serial.println("");

delay(1000); }

Try this

// Tempmessung mit LM35

int val_LM35 = 0;
int u_LM35 = 0;
float LM35_temp = 0;

// Temperaturmessung mit Wasser-NTC

int val_NTC = 0; // Eingangswert
int u_NTC = 0;   // Spannung
float NTC_temp = 0; // Temperatur

void setup()
{
  Serial.begin(9600);
  analogReference(EXTERNAL);
}

void loop()
{
// Vergleichstemperatur mit LM35 messen...
  (void) analogRead(0);
  val_LM35 = analogRead(0);
  u_LM35 = val_LM35*5000.0/1024;
  LM35_temp = u_LM35/10 ;
  Serial.print("Temp: ");
  Serial.println(LM35_temp);

// Temperatur mit NTC messen
(void)analogRead(2);
val_NTC = analogRead(2);
u_NTC = val_NTC*5.0/1024;

NTC_temp   =  +   0.2514 *pow(u_NTC, 6)   // Formel mit excel erstellt
              -   3.7812 *pow(u_NTC, 5)   // Fehlerdiagnose sieht excel-file
              +  22.4840 *pow(u_NTC, 4)
              -  70.0990 *pow(u_NTC, 3)
              + 133.2200 *pow(u_NTC, 2)
              - 196.9600 *    u_NTC
              + 275.8900 ;
         
// int NTC_temp = NTC_temp;   //Für Ausgabe ohne Komma

Serial.print("NTC_temp: ");
Serial.println(NTC_temp);
Serial.println(" C");
Serial.println("");


delay(1000);
}
 val_LM35 = analogRead(0);
  u_LM35 = val_LM35*5000.0/1024;
  LM35_temp = u_LM35/10 ;
  Serial.print("Temp: ");
  Serial.println(LM35_temp);
  
// Temperatur mit NTC messen 
val_NTC = analogRead(2);

If you really care about "reading them simultaneously", put those two reads next to each other so they are done closely.

And try to minimize the use of floating point math.

Maybe you meant to sayfloat u_NTC = 0;  // Spannung

This calculation

int u_NTC = 0;   // Spannung
...
val_NTC = analogRead(2);
u_NTC = val_NTC*5.0/1024;

will yield only the values 0,1,2,3 and 4 for u_NTC, with u_NTC declared as int.