Arduino Environmental Data Collection Device

by swanjeng1205 in Circuits > Arduino

83 Views, 0 Favorites, 0 Comments

Arduino Environmental Data Collection Device

20251112_193831.jpg

When I was an elementary school student, I often saw the AQI of different cities on TV. In my school, there was a flag showing the AQI level. However, they both have drawbacks. AQI data on TV usually comes from measuring stations which are far away from the place where we're living. The data source of the AQI flag is the same. In addition, the flag is not real-time updated.


This year, Arduino was on the life science and technology class schedule. In fact, I have been familiar with Arduino for several years. I really love it. When I was scrolling through hundreds of Arduino projects, I saw the PMSA003 sensor. The sensor can measure PM2.5 level, and AQI level can be calculated using the measured data.


In this project, I chose Arduino Uno R4 WiFi because of its WiFi capability and the LED matrix.

Supplies

Arduino Uno R4 WiFi x1

PMSA003 x1

DHT22 x1

BME280 x1

SD card module x1

pushbutton x1

breadboard x1

jumper wires

small box x1

Build the Device

wiring.png

The table above is the wiring.

Prepare the Micro SD Card

The micro SD card should be formatted in FAT32. After formatting, create a .txt file in the root directory.

Program the Arduino

The Arduino code is here. Below is everything changeable in configuration.h.

#define fileName "LOG3.txt" // the file in SD card
#define ssid "SSID" // Internet access for NTP and real-time data veiwing
#define pass "PASS"
#define interval 30000 // collection interval (ms)

After Uploading

Press the button to start collecting temperature, humidity, pm1.0, pm2.5, pm10, and air pressure data to the file in the microSD card. If the LED matrix doesn't show "ON", just press the button again.

During data collection, you can view the real time data on your web browser. The Arduino's IP will be shown on Serial Monitor. If the Arduino is connected to your phone AP, the IP can be seen somewhere in your phone's AP settings. The place varies and depends on your phone's brand.


After the data collection, you can copy the file in your SD card to the same path as the Python files.

If you don't have an SD card reader, you can use the programs here. The Arduino sketch should be uploaded before the Python code runs.

The programs will transfer the data in the micro SD card to a file in the path of the Python program, and then the data file in the micro SD card will be cleared for the next data collection.

Before running the Python program, please make sure that the Serial Monitor in Arduino IDE is closed.

Here are some data visualizing examples.