TMP36 inconsistent reading - Interference?

Dear all,

I have an ATmega328 (3.3V, 8Mhz) connected in the following way to a temperature sensor and an ADC:

TMP36: Pin A1

MCP3008:
   _____ 
1 |° M  | 16  Vdd       -> 5V
2 |  C  | 15  Vref      -> 5V
3 |  P  | 14  AGND      -> GND
4 |  3  | 13  CLK       -> D13
5 |  0  | 12  Dout MISO -> D12
6 |  0  | 11  Din MOSI  -> D11
7 |  8  | 10  CS/SHDN   -------> D10 
8 |_____| 9   DGND      -> GND

in addition, MCP3008 pin 1 is connected to ground via a 10k resistor and to one leg of a moisture sensor and the other one connected to pin D7.

I calculate temperature as:

  int reading = analogRead(sensorTempPin);

  float voltage = reading * 3.3; //5 for 5V, 3.3 for 3.3V
  voltage /= 1024.0; 
  
  float temperatureC = (voltage - 0.5) * 100 ;

Pin D7 is configured as OUTPUT and is HIGH only when reading (read_adc(int channel)) from ADC pins and than set to LOW again.

I tested everything on my Uno and than ported to the ATmega, but running it I discovered that readings of TMP36 are not corrects in particular:

  • If the MCP3008 pin 1 is directly connected to the GND than the reading is the same as without the MCP3008.
  • If not readings of the TMP36 are higher 1 or 2 °C more than readings done as standalone.

It seems that the voltage measured on the TMP36 is influenced by ADC+D7.

Do you have any suggestions?
Thank you,
dk

EDIT: On A0 there is a LDR connected as well of which I read the value after the TMP36 and before the ADC values. But this seems not to affect the TMP36 readings.