Code: Select all
def MQResistanceCalculation(self, raw_adc):
return float(self.RL_VALUE*(1023.0-raw_adc)/float(raw_adc));
The thing is, as far as I understand, the ADC works according to this equation:
Code: Select all
Resolution of ADC / System Voltage = ADC Reading / Analog Voltage Measured
Furthermore, to get the value of RS in a gas according to the second above-mentioned tutorial, we follow this equation:
Code: Select all
RS = [(VC x RL) / VRL] - RL
The Schema of this design is:
Code: Select all
MQx Sensor -> Logic Level Converter -> MCP3008 -> RPi
I'm sure I'm missing something, or maybe I'm mixing up things.
Any help is very much appreciated.