Lm35 with acs712 curernt sensor

Hi, I want take output data same time from these sensor(Lm35 and acs712). But if i would connect pin to arduino. Lm35 temperature value will change incorrectly. I cared thats:

LM35 must NEVER share his ground wire with another component.

LM35 ground wire should be connected directly on the nearest ground connection from analog inputs.

also i try take power from some battery for acs712, but when i put the acs712 output pin to arduino., again Lm35 sensor values were wrong. What must i do ?

If ı can say the ardunuo that;
for example
close A1 and A5 pins;
open A1 and take data;
after few a sec,
close A1 and open A5 pins;
Take data from A5;
i think it is maybe work.

The code which i used:

int val;
int tempPin = A1;
const int analogIn = A5;
int mVperAmp = 66; // use 100 for 20A Module and 66 for 30A Module
unsigned int RawValue = 0; // can hold upto 64 10-bit A/D readings
int ACSoffset = 2500;
double Voltage = 0;
double Amps = 0;
double a;

void setup()
void loop()
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
a = cel;

for (int x = 0; x < 64; x++) // 64 analogue readings for averaging
RawValue = RawValue + analogRead(analogIn); // add each A/D reading to a total
Voltage = ((RawValue / 64) / 1023.0) * 5000; // Gets you mV
Amps = ((Voltage - ACSoffset) / mVperAmp);

Serial.print(“Raw Value = " ); // shows pre-scaled value
Serial.print(RawValue / 64);
Serial.print(”\t mV = “); // shows the voltage measured
Serial.print(Voltage, 3); // the ‘3’ after voltage allows you to display 3 digits after decimal point
Serial.print(”\t Amps = "); // shows the voltage measured
Serial.println(Amps, 3); // the ‘3’ after voltage allows you to display 3 digits after decimal point
Serial.print(“TEMPRATURE = “);

RawValue = 0; // reset value


The LM35 is a sensor with a voltage output, and the ACS712 is a sensor with a ratio output. You never will get stable values from the LM35, unless you switch Aref every time from default to 1.1volt. I never got that to work smoothly. My advice: dump the LM35, and get a digital DS18B20. Leo..

So many thanks for your advice, i get a digital temp sensor and now i am getting stable output from these sensor.