I've been trying to follow through the maths in the intefaces/MCP3008/AQSensor.py file (Which is a made all the easier by a total lack of comments in the code), and it looks like the TGS2600 "Air Quality" resistance is not being calculated correctly.
If I am following everything correctly, its a voltage divider, and the code solves for the unknown resistance. The problem is that it is solving for a 10kohm resistor instead of a 22kohm resistor.
it looks like line 72 in Upload.py needs to be changed from airSensor = AQSensor.AQSensor(adc,AQADC,22000) to airSensor = AQSensor.AQSensor(adc,AQADC,pullup=22000)
Last Edit: Apr 22, 2013 4:46:30 GMT -5 by nocturnal
No, this will not fix the problem if you TGS2600 is constantly giving a reading of 5151.52, it will just change the way the resistance is calculated, it does not change the reading itself. So it will still be stuck, it will just report a different, stuck, resistance.
I don't know. My sensors internal resistance is only about 2kohm, which is way outside the 10kohm-90kom range specified in the datasheet. I'm currently pestering the ebay seller for a replacement, which will undoubtedly only take 3 weeks to arrive.
In theory you could replace the 22kohm resistor with a different one, but if the sensor is operating outside the range specified in the datasheet, you probably shouldn't trust it to give you sane results.
So I checked my sensor's internal resistance and its about 15K - within specs - but just. So I played arround with pen and paper and I figured that if the internal resistance was 15K (R1)and I was starting with 5v (Vin)then if I used a 5.1k R2 (resister to ground) then Vout should be around 1.25. So I swapped out the 22k resister with 5.1k
I also changed line 75 in Upload.py to: airSensor = AQSensor.AQSensor(adc,AQADC,pullup=5100)
well- its not working exactly according to my math Vout (V to ADC) is about 1.9V (which should be ok) and my "air quality" is reading 7670.60
Does this seem reasonable to you?? Or am I making "stuff" up here
Enter in any 3 of the 4, and it will calculate the 4th one for you. Your numbers don't seem to far out (though its still outside of the 10-90kohm range). Try blowing some smoke at it and see what happens.
The lower resistor value also means your running the sensor at over 15mw, (about 18mw if my math and the datasheet are right), which is another not good thing.