1 minute read
Using a Gas Sensor with an Arduino
196 Hacking Electronics
Using a Gas Sensor with an Arduino
In soldering the three leads onto the methane sensor, we have also made something that we can easily attach directly to an Arduino (Figure 8-6).
Connect the positive supply connection from the sensor to 5V on the Arduino, GND on the sensor to GND on the Arduino, and the output of the sensor to A3.
Since this sensor can use up to 200 mA, you must power it from the real 5V and GND connections on the Arduino and not use the trick of powering it from a digital output.
The following sketch (“methane”) prints the readings from the sensor into the Serial Monitor. Again, note that if you breathe on the sensor, the reading will increase.
Figure 8-4 Breadboard layout for the gas detector
Figure 8-5 The gas detector