Public Lab Research note

Log Simple Air Sensor data to SD card

by imvec | December 17, 2019 21:59 17 Dec 21:59 | #21786 | #21786

What we want to do

Logging Simple Air Sensor to SD card so the device can be attached to a Kite or left on the ground for 24 hours close to a polluting area and data later analyzed.

Our attempt and results

We have modified the original Arduino code to incorporate the Openlog datalogger to the device, a tiny lightweight datalogger easy to program and storing data on a micro SD card.

We have also modified the sampling rate to 10 seconds (10000 miliseconds) so the device will measure 6 times every minute. If you want to change this rate modify line 86 of code: delay(10000).

We have also modified the code to store data on CSV format. The original code prints data with this format:

Concentration Units (standard)

PM 1.0: 308 PM 2.5: 529 PM 10: 665

Concentration Units (environmental)

PM 1.0: 205 PM 2.5: 352 PM 10: 443

Particles > 0.3um / 0.1L air:48522

Particles > 0.5um / 0.1L air:15278

Particles > 1.0um / 0.1L air:3990

Particles > 2.5um / 0.1L air:468

Particles > 5.0um / 0.1L air:127

Particles > 10.0 um / 0.1L air:103

We have simplified it for further use with spreadsheets and graphs. For this purpouse we have erased the description of every single value getting this:



Three first values are the Standard Concentration Units.

Next three values are the Environmental Concentration Units.

Last six values of the line are the um / 0.1L air.

This way data can be imported to a spreadsheet and then processed and visualizad using graphics.

Hook up

Plug the six pins on the Openlog as follow:

Openlog → Arduino




VCC → 3.3v




To program the Arduino with the code download it, plug the board with the USB cable and unplug the RX pin on the Arduino. This is mandatory or you will get an error message from the Arduino IDE.

Download the code here →

Logging data

Connect the device once. Let a blue led light up on the logger and then turn off.

Extract the SD card and insert it on your computer. You'll find a CONFIG.txt you have to edit. Open it up with a text editor and change 9600 for 115200. Save the file and pug again on the Openlog,

Now you are ready to use the logger.

It creates a single document for every log session.

Questions and next steps

Attach a Real Time Clock to timestamp every measurement.

I did this Help out by offering feedback!

People who did this (0)

None yet. Be the first to post one!


Login to comment.