LabVIEW Based Home Air Quality Index Measurement Using Arduino

by alaminashik in Design > Software

3268 Views, 41 Favorites, 0 Comments

LabVIEW Based Home Air Quality Index Measurement Using Arduino

cover.png

In this project, I will be making a simple air quality measurement device with readily available sensors. For data acquisition and processing LabVIEW by NI is used. The Arduino receives data from the sensors and these values are sent to the computer using a USB port. I have used two of each sensor that can help reduce errors. I have provided the LabVIEW interface and Arduino code so that you don't have to start from scratch!

Note that these sensors are not very accurate, this project can be further improved with better and more accurate sensors!

Supplies

Priliminary sensors.jpg
labview logo.jpg

Tools needed:

2 x MQ9 LPG gas sensor LINK

2 x MQ135 smoke sensor LINK

2 x GP2Y1010AU0F optical dust sensor LINK

1 x Arduino UNO LINK

2 x 220uF capacitors LINK

2 x 150-ohm resistors LINK

1 x Breadboard LINK

Breadboard connecting wires LINK

LabVIEW 2020 or the latest

Install LabVIEW

labview ss.jpg

The heart of this project is the LabVIEW software. According to NI, "LabVIEW is systems engineering software for applications that require testing, measurement, and control with rapid access to hardware and data insights". It shows the live data along with creating an excel file to store those data. If you are new to the LabVIEW interface I would suggest you read this article from Circuit Digest about the basics of LabVIEW.

You can get the installation file for LabVIEW from getintopc.com

The LabVIEW communicates with Arduino via serial port, so you do not need to install any module to connect with Arduino such as LINX.

Schematic

circuit diagram.jpg

The red wire represents the VCC connections

The black wire represents the GND connections

The Yellow wire represents the signal connections

The blue wires are part of sensors

Build the Circuit

arduino circuit.jpg

Build the circuit on a breadboard as shown in the picture. The connections are made using jumper wires, it is also possible to create the circuit on a Vero board to make the whole setup more compact and ensure proper connection.

Upload the Arduino Code

arduino code 1.jpg
arduino code 2.jpg

I have added the Arduino code below, download the file and you can directly upload it to the board. Sufficient comments are given on the code for better understanding.

Open Arduino Serial Monitor

arduino output.jpg
SERIAL-MONITOR-BUTTON.jpg

If you have connected and uploaded everything correctly then you should be able to open the serial monitor and see the data from the sensors. The data are serially arranged with a space in between which is crucial for LabVIEW data extractions.

From the left, we have data from dust sensor(a), dust sensor(b), mq91(a) sensor, mq91(b) sensor, mq135(a) sensor & mq135(b) sensor. The data refreshes every 1 second.

NB: For accurate measurement keep the MQ sensors powered for at least 10 minutes. The higher the better.

Open the LabVIEW Program

labview ss main.jpg

If you have come to this step, then congrats! you're almost complete.

Download the LabVIEW file given below and open it directly. You should be able to see a screen as shown in the picture.

If you are unable to open the program then you might have an older version of LabVIEW.

Download link: LINK

Understanding LabVIEW Backend

labview backend.png

If you open the LabVIEW program you will be able to see the backend. It can be quite hard to understand if you are completely new.

The basic is that Arduino constantly sends data to a serial port. We select that serial port on LabVIEW and the "serial read" option enables the data to be read. The data now contains a string of numbers only, so it is separated into an array of numbers using a delimiter. This is why the space between each value was necessary for step 5.

Each of these values is displayed using a waveform display.

The loop on the right side is for storing and creating an excel file. All the data along with date/time are fed into one excel file.

Run the Setup

working labview ss.jpg
run ss.jpg

With the Arduino connected to the computer, select the appropriate port under 'DAQ' where the Arduino is connected. Then set a sample number, this is basically the number of data taken and stored in the excel file. Before running the program change the sample intervals under the 'time' section. you can give a value from 1-10 seconds.

Set an excel file name and location where the excel file is to be stored, no excel file will be saved.

NB: after setting the name of the excel file give an extension also e.g. experiment.xls

Results!

results ss.jpg

And you are done!

Hope this was helpful :)