Detecting a gas
In order to show a simple ADC usage (with a little help of a PWM source), we will see how we can detect a dangerous gas using an analogue sensor that is shown here:
Note
The devices can be purchased at or http://www.cosino.io/product/mq-2-gas-sensor by surfing the Internet.
We can get the datasheet of each GAS sensor at http://gas-sensor.ru/pdf/combustible-gas-sensor.pdf.
This sensor acts as a variable resistor according to the gas concentration, so they can be easily read with a normal ADC. Looking carefully at the datasheet of the gas sensor, we can see exactly how this sensors varies its internal resistance according to the gas concentration (in reality, it depends on environment humidity and temperature too; but for an indoor functioning, we can consider these values as constants). so if we put it in series with a resistor and apply a constant voltage, we can get an output voltage that is proportional to the actual gas concentration.
In the following diagram, there is...