ADC conversion values



  • Good evening

    Ive been trying to figure out own to properly obtain some values from a gas sensor (MQ131) into my lopy4 over ADC but ive been getting values that are a bit off and i wanted to make sure im doing things right:

    Sensor Vcc is connected to an external 5v psu
    Sensor GND is connected to ground on Lopy4

    First, this sensor output is betwen 0~4,6v so i know that i wont be able to get all values from ADC even at attn of 11

    But even so when measuring sensor output, im getting, for example 0,22v and lopy actually says im getting about 0,33v.

    So my question is: how can i actually measure this sensor output in this configuration?



  • @mrks-tsk The capacitor has to be placed between ADC input and GND. In your diagram at the VBATT side.



  • voltage_divider.JPG

    @robert-hh I have made Expansion Board 3.1 -style voltage divider like this on my breadboard but I'm still a little bit uncertain where to place that little 10nF capacitor. Can you help me?



  • @Alephus Loyp Just scale them properly. You may also take the raw ADC readings and do the conversion yourself. But I would add a voltage divider between you gas sensor and the ADC input, such that the input never gets a value > 3.3V. That divider could for instance constist of a 10k (between ADC Input and GND) and 4.7 K (between ADC input and sensor output) resistor, with an additional 10nF capacitor between ADC input and GND. The scaling factor would then be 1.47 (if you read 1V, the actual output value is 1.47 V).



Pycom on Twitter