I have also followed your guidelines here and have read both recommended threads when reading from two sensors here and here. I believe I am following all the recommend suggestions.
I have tried inserting a resistor as well.
So, here's the read code. The code comments explain the process.
Code: Select all
# read sensor nine times with a 10 ms delay
for i in range(9):
self.analogreadings.append(self.mcp.ReadADC(self.adcnum))
time.sleep(0.01)
# sort and grab the median value to remove outliers
self.analogreadings.sort()
self.adc = self.analogreadings[4]
Code: Select all
Read Ambient Temperature (TMP36)
Write Ambient Temperature (TMP36) in F to COSM
Analog Readings: [211, 212, 214, 214, 214, 215, 218, 219, 219]
Median Analog Reading: 214
Volts: 0.6896484375
Millivolts: 689.6484375
Temp C: 18.96484375
Temp F: 66.13671875
Read Ambient Temperature (TMP36)
Write Ambient Temperature (TMP36) in F to COSM
Analog Readings: [211, 212, 213, 214, 215, 215, 217, 218, 218]
Median Analog Reading: 215
Volts: 0.69287109375
Millivolts: 692.87109375
Temp C: 19.287109375
Temp F: 66.716796875
Read Ambient Temperature (TMP36)
Write Ambient Temperature (TMP36) in F to COSM
Analog Readings: [211, 213, 213, 214, 214, 215, 217, 218, 218]
Median Analog Reading: 214
Volts: 0.6896484375
Millivolts: 689.6484375
Temp C: 18.96484375
Temp F: 66.13671875
Here is a snippet from the log when both sensors are running.
Code: Select all
Read Beer Temperature (ENV-TMP)
Write Beer Temperature (ENV-TMP) in F to COSM
Analog Readings: [250, 251, 251, 251, 251, 251, 251, 252, 252]
Median Analog Reading: 251
Volts: 0.80888671875
Millivolts: 808.88671875
Temp C: 20.9022
Temp F: 69.62396
Read Ambient Temperature (TMP36)
Write Ambient Temperature (TMP36) in F to COSM
Analog Readings: [180, 183, 185, 185, one eighty six, 189, 199, 201, 202] # apparently that number is considered spam???
Median Analog Reading: one eighty six
Volts: 0.5994140625
Millivolts: 599.4140625
Temp C: 9.94140625
Temp F: 49.89453125 # dropped 15 degrees!!!!!
Any suggestions?