Märkt: TGS8822

Calibrating a Figaro TGS822 sensor, by drawing…

After consulting with the boys and girls at chemicalforums.com about how to produce an ethanol gas with a 300 ppm without having to buy a lot of fancy gear and thus finding out that it was more difficult then I initially thought I have reluctantly decided that I don’t think I will be able to pull it of. There for I have decided to work with what I got. What I got is air and a datasheet.

The data sheet provided by Figaro for the TGS822 only goes down to 50ppm, however the graph looks pretty logarithmic linear to me so I decided to add the 10-50ppm part my self making a bold assumption that it will be logarithmic linear in that interval as well.

From the data sheet we get the relation between RL and RS which is a voltage divider circuit.

Rs_vs_RlFrom the graph in the data sheet we can also see that the resistance of the sensor in air is RS (air) = R0 * 19.

If we combine these two facts we can express R0 as a relation of RS (air) and the value of RS (air) can be deduced by reading the voltage of the sensor and using the voltage divider formula.

RS (air) / 19 = R0 in my case RS (air) = 78kΩ. => R0 = 4105Ω

When we have R0 we can make a table to relate resistance (RS) to ppm by reading the scaling factor of RS/R0 from the graph for different gas concentrations.

Rs in air = 78000 Ro = 4105,26315789474
ppm Scaling factor Rs = Ro * Scaling factor
0 19 78000
10 15 61578,947368421
10 10 41052,6315789474
20 9 36947,3684210526
20 7 28736,8421052632
30 6 24631,5789473684
30 5,7 23400
40 4,7 19294,7368421053
50 4 16421,0526315789
60 3,5 14368,4210526316
70 3,2 13136,8421052632
80 3 12315,7894736842
90 2,7 11084,2105263158
100 2,5 10263,1578947368
150 2 8210,5263157895
200 1,6 6568,4210526316
300 1,2 4926,3157894737
400 0,9 3694,7368421053
500 0,75 3078,9473684211
600 0,67 2750,5263157895
700 0,58 2381,052631579
800 0,52 2134,7368421053
900 0,47 1929,4736842105
1000 0,4 1642,1052631579
2000 0,2 821,0526315789
3000 0,15 615,7894736842
4000 0,1 410,5263157895

The TGS822 sensor is affected by both temperatures and humidity and it should be complemented with a thermistor and hygrometer so that it is possible to compensate for temperature and humidity. I don’t have any thermistor or hygrometer yet but if we use the ”calculate R0 from RS (air)” every time we start the sensor then perhaps we will also compensate for temperature and humidity, this is something further experimenting will tell.


Hi, I’m Ketosense


During the weekend I have managed to put together a first very early prototype of my ”Ketosense”. It does register when a person is blowing in to the ”gas chamber” where the sensor is located and something that feels encouraging is that my wife gets significantly higher readings then me. Since I’m still a carbohydrate junky and she is not that is exactly what we want. However we do have some hurdles to cross before this thing is useful.


  • Calibrate the sensor
  • Determine sensor characteristics for gas concentrations between 0-50 ppm
  • Build a better moth piece

Calibrating the sensor

Calibrating the sensor is the major thing that needs to be done. In the sensor data sheet there is stated exactly how the resistance of the sensor behaves at different gas concentrations but everything relates to one calibration point, the sensor resistance Rs = Ro at 300 ppm of ethanol. Based on this value we can calculate the relation between sensor resistance and gas concentration for all other gas concentrations. Further in the data sheet it is stated that Rs at 300 ppm of ethanol is between 1-10 kΩ and that is quite a wide range and I don’t want to make a generalization of 5k before I even tried to calibrate it. Right now I don’t rely have a clue how to create a 300 ppm ethanol gas mix but hey, thats just another problem to solve.

Sensor characteristics for gas concentrations between 0-50 ppm

The datasheet for the TGS822 doesn’t have any data for how the sensor behaves at low gas concentrations between 0-50 ppm. In the graph displaying the Rs/Ro relation it looks like the function for the sensor resistance follows a Log-linear model so if I can determine the Ro (Rs at 300 ppm ethanol) of my sensor and also have the Rs for < 10 ppm of gas, which I presume is the ethanol content of normal room air, then I should be able to deduce some info for how the sensor should behave in that range as well.

Moth piece

I quickly understood that to get a good reading you needed to give the sensor some time to take the reading. This means we have to trap the gas around the sensor in some sort of chamber for a while to get a good reading. Right now I have a plastic cup with a tube and some tape over the opening and it does the job. However it is actually to air tight and I have to remove the tape from the opening to vent out the gas after getting a reading for the sensor to be able to reset it self. Another issue with the cup design is the condensation. Breath has quite a high moisture level and after just a few readings with this moth piece you start so see condensation on the inside of the cup and readings from the same person are different from time to time which they obviously shouldn’t be. Both humidity and temperature affects the sensor resistance so I am thinking of getting a humidity/temperature and add that so I can compensate for those factors but I believe that a better design of the moth piece can be just as or even more effective.

Measured sensor characteristics MQ-3 and TGS822

The 48 hour burn in of both sensors has now been completed and I have been able to do some initial measurements of the sensors characteristics. So far both the sensors does seem to react to acetone but that is not rely surprising. The sensor resistance range (Rs) does vary a lot between them, the TGS822 has a span of 300Ω – 78 kΩ while the MQ-3 has a more narrow resistance span of 22.6 – 1.5 kΩ. Since I am interested in low concentrations of gas I want to have as wide range as possible and have therefor selected to go on working with the TGS822 sensor first.

One aspect of the sensors that makes the them a bit annoying to work with is that they have a warmup period of 3-5 minutes before the resistance has stabilized it self and they also take quite a long time to return back to the initial value after a measurement has been done. The time it takes for the sensor to reset is related to how high the gas concentration was.IMG_3363

Figaro TGS822

  • Rs = 78 kΩ, 22 degrees C, 20% Humidity, normal air.
  • Rs = 300 kΩ when blowing into the sensor.
  • Rs = 300 kΩ after ail polish remover puff.

A good value for voltage divider resistor with the TGS822 should be 10k. A 10k resistor would give an output to the Arduino of just above 0.5 V at no gas detection up to a full 5 V for high gas concentrations.

Reset time, Resistance in kΩ/time after acetone puff.

  • 32 kΩ after 7 minutes
  • 41 kΩ after 10 minutes
  • 51 kΩ after 13 minutes
  • 54 kΩ after 15 minutes
  • 58.4 kΩ after 18 minutes
  • 62 kΩ after 21 minutes

MQ-3 sensor

  • Rs = 22.6 kΩ, 22 degrees C, 20% Humidity, normal air.
  • Rs = 15 kΩ when blowing into the sensor.
  • Rs = 1.05 kΩ after ail polish remover puff.

Reset time, Resistance in kΩ/time after acetone puff.

  • 10.5 kΩ after 8 minutes
  • 14.5 kΩ after 16 minutes
  • 17.9 kΩ after 26 minutes
  • 18.9 kΩ after 31 minutes

Blowing at the sensor with clean air did not seem to have any effect on the reset time.

The sensors has arrived

Yesterday the sensors I had ordered arrived, I had ordered the Figaro TGS822 and the MQ-3 from Hanwei Electronics. Since this type of sensors require a burn-in of 24-48 hours I wired them and applied some power. I had a suspicion that the sensors were actually going to be identical in function but perhaps I was wrong since they do actually use different amounts of current. The TGS822 sensor draws 117 mA while the MQ-3 draws 102 mA. It might just be that different individuals use different amount of current, further experimenting will tell if they also measure differently.

One thing that I didn’t expect was that the pins of the sensors are placed along the side of the round sensor following the curvature. This makes it impossible to stick them into a breadboard, since the pins will not line up with the holes in the breadboard, so I had to solder some wires to the connectors.