Indoor TVOC Monitor with Raspberry PI

Indoor TVOC Monitor with Raspberry PI

July 08, 2021


Do you spend about 70 percent of your daily life indoor like me?

Do you pay attention to the air quality of the room? If the TVOC level is too high indoor, it will be bad for your health.

So, in this project, we will make an indoor TVOC monitor with Raspberry Pi, with voice broadcast to remind us: Hey, time to open the window!angry

1. What is TVOC?

TVOC means Total Volatile Organic Compounds. Volatile organic compounds are organic chemicals that become a gas at room temperature. There are many kinds of VOCs and they can be at the same time present. Some VOCs are bad for the health, they will cause the eye and nose irritation, shortness of breath, headaches, and so on. Higher concentrations may cause physical irritation even damage. Most people are not affected by short-term exposure to the low levels of VOCs found in homes. But for your health, it suggests to avoid the exposure at high VOC levels.

VOC’s come from many sources, even yourself can be a polluter! The Cleansers, disinfectants; Pesticides, air fresheners, construction materials, new furniture and so on are the VOC sources. They may increase the indoor concentration of VOC’s due to off-gassing that may cause serious threats to your well-being. To stayed the room in low levels, try to open the window frequently for changing the Air.

2. How to Measure TVOC Value?

The VOCs are no color, no taste, and it required a specified sensor for measuring them. As previous project showed, the SGP30 is an air quality sensor for measuring the VOC and eCO2. Using the SGP30 senor is the best option that I have been familiar with it. To make SGP30 work, it is required to set up the I2C bus in the configuration.

3. TVOC Monitor Based on Raspberry Pi

I made a sketch for this project. For getting the TVOC reading, the SGP30 sensor was connected with raspberry Pi via I2C. For controlling and computing, I used the Raspberry platform instead of the single-chip that Raspberry has more strong computing ability. Besides, I had to prepare the speak and the audio coding part for voice reminder. The Raspberry Pi has to convert the text to audio what the speaker play. I also had to prepare an LCD to display the TVOC reading. I spent a long time looking for a platform that is suitable for this project.

Raspberry Pi Embedded System Development Platform is designed for designed by Makerfabs, it is based on Raspberry Pi Zero W to develop. The mainboard of the kit has a 3.2 inch SPI display with touch for display something, and it has an audio coding part with WM8960 and a speaker for the audio output. Besides, the mainboard also provides many kinds of ports, such as UART, I2C, ADC, GPIO, that are very suitable for this embedded project. The kit also provides the SGP30 module that was no need to prepare the sensor again.
I have an idea about displaying the TVOC measuring, that is showing the SGP30 reading history. The history of the SGP30 reading can help us to find the cause of the TVOC changing.

3.1 Connect SGP30 with Raspberry Pi

Connect the SGP30 sensor with the I2C port of the main board via cable.

3.2 Program

The code is available and you can obtain it from Github.
1. For working with the SGP30 sensor, Raspberry Pi Zero has to install the specified library for driving the SGP3O. Use the following command to install.
sudo pip3 install pimoroni-sgp30
sudo pip3 install smbus2
2. Get the TVOC measuring.
sgp30 = SGP30()
result = sgp30.get_air_quality()

co2 = result.equivalent_co2
tvoc = result.total_voc
3. Display the historical values of the SGP30 on the LCD, these values would be composed of a historical line.
4. There is a function in about TTS which converts the text to audio via the internet.
def request_tts(TEXT,Result_name):

3.3 See the Result

Running the program, the TVOC reminder can work. Place it on the desk in the living room, kitchen or official. When you open the air freshener or cleanser that something will increase many VOCs, the TVOC reminder will remind you the TVOC is too high, and you have to open the window for changing the air. When the TVOC concentration is at a low level, the TVOC reminder also will remind you the level is normal.

Check the video:

If you have further questions about this Indoor TVOC monitor on Raspberry PI, or need PCBA Manufacturing Service, please feel free to contact

Contact us