Hi, some time ago I published a video on how
to use gas sensors with Arduino
and I’m still getting questions about it.
People ask me how to calibrate the sensor
and get the readings in parts per million,
that is ppm units.
Today I’ll try to give you some answers,
but I will focus on the MQ-2 gas sensor.
If you haven’t seen the original video,
it’s a good idea to watch it first.
You can jump to it by simply clicking the
card in the top right corner or using the
link from the description.
Let’s see what we can do with the MQ-2.
This little guy can detect LPG, i-butane,
carbon monoxide, smoke and a few others.
If you hook it up to an Arduino and use my
sketch from the original video, you’ll get
values ranging from 0 to 1023.
The higher the value, the higher gas concentration
it depicts.
The problem is – it doesn’t represent
any standard unit
and cannot be converted easily.
There are 2 solutions I can think of.
One of them involves a calibration kit, which
consists of a gas tank, a regulator, a flow
meter, a dryer tube and more.
This special equipment may cost hundreds of
dollars or more and it requires some knowledge
to use it, but if you calibrate your sensor
properly, the readings will be as precise
as you can possibly get.
Let’s assume you don’t want to invest
such amounts of money and time to calibrate
a one dollar sensor.
There is quite an easy method to do it by
using a piece of Arduino code produced and
shared for free by a company called Sandbox
Electronics.
Let’s see how we can make it work.
First, you need an MQ-2 and the Arduino setup
from my previous video.
If my sketch works properly, you can go to
this Sandbox Electronics page and copy-paste
the sample code section to your Arduino IDE.
Now you can change the load resistance value
in the code, which represents the load resistor
on your board.
During my tests I was getting the best results
with resistors close to 5kohm.
The last step is to upload the code to your
Arduino.
When you open the Serial Monitor, you will
see the sensor is calibrating for about 25
seconds and during this period it should be
exposed to clean air.
After that the sensor it’s displaying the
readings for LPG, carbon monoxide and smoke,
all in ppm units.
That’s all there is to it.
This approach is quick, easy and free, but
be aware that your readings are calculated
approximately, so they won’t be as accurate.
To make the values more consistent, you can
preheat your sensor, which means leave it
on connected to the circuit for at least 24
hours.
It’s a one time process, so you don’t
have to repeat it later.
Go ahead and try this calibration method yourself.
If you like this tutorial or find it useful,
please share it, so more people can watch it.
Consider subscribing, so you won’t miss
my new videos.
Thanks for watching and see you next time.
