Microcontroller-Based Air Quality Mapper

Raul Alvarez Torrico’s Air Quality Mapper is a portable device designed to track levels of CO2 and CO gasses for constructing “Smog Maps” to determine the healthiest routes. Featuring a Renesas RDKRL78G13 development board, the Mapper receives location data from its GPS module, takes readings of the CO2 and CO concentrations along a specific route, and stores the data in an SD card. With the aid of PC utility software, you can upload the data to a web server and see maps of gas concentrations in a web browser.

air q

The portable data logger prototype

In his Circuit Cellar 293 article (December 2014), Torrico notes:

My design, the Air Quality Mapper, is a data-logging, online visualization system comprising a portable data logger and a webserver for the purpose of measuring and visualizing readings of the quality of air in given areas. You take readings over a given route and then upload the data to the server, which in turn serves a webpage containing a graphical representation of all readings using Google Maps technology.

The webpage displaying CO2 measurements acquired in a session

The webpage displaying CO2 measurements acquired in a session

The data logging system features a few key components: a Renesas YRDKRL78G13 development board,  a Polstar PMB-648 GPS module, an SD card, and gas sensors.

The portable data logger hardware prototype is based on the Renesas YRDKRL78G13 development board, which contains a Renesas R5F100LEA 16-bit microcontroller with 64 KB of program memory, 4 KB of data flash memory, and 4 KB of RAM, running from a 12-MHz external crystal…

Air Quality Mapper system

Air Quality Mapper system

The board itself is a bit large for a portable or hand-held device (5,100 x 5,100 mils); but on the other hand, it includes the four basic peripherals I needed for the prototype: a graphic LCD, an SD card slot, six LEDs, and three push buttons for the user interface. The board also includes other elements that could become very handy when developing an improved version of the portable device: a three-axis accelerometer, a temperature sensor, ambient light sensor, a 512-KB serial EEPROM, a small audio speaker, and various connection headers (not to mention other peripherals less appealing for this project: an audio mic, infrared emitter and detector, a FET, and a TRIAC, among other things). The board includes a Renesas USB debugger, which makes it a great entry-level prototyping board for Renesas RL78/G13 microcontrollers.

For the GPS module, I used a Polstar PMB-648 with 20 parallel satellite-tracking channels. It’s advertised as a low-power device with built-in rechargeable battery for backup memory and RTC backup. It supports the NMEA0183 v2.2 data protocol, it includes a serial port interface, and it has a position accuracy 2DRMS of approximately 5 m and velocity accuracy of 0.1 m per second without selective availability imposed. It has an acquisition time of 42 s from a cold start and 1 s from a hot start. It also includes a built-in patch antenna and a 3.3- to 5-V power supply input.

The GPS module provides NMEA0183 V2.2 GGA, GSV, GSA, and RMC formatted data streams via its UART port. A stream comes out every second containing, among other things, latitude, longitude, a timestamp, and date information. In the system, this module connects to the R5F100LEA microcontroller’s UART0 port at 38,400 bps and sources the 3.3-VDC power from the YRDKRL78G13 board.

For the CO2 sensor, I used a Hanwei Electronics Co. MG-811 sensor, which has an electrolyte that in the presence of heat reacts in proportion to the CO2 concentration present in air. The sensor has an internal heating element that needs to be powered with 6 VDC or 6 VAC. For small CO2 concentrations, the sensor outputs a higher voltage, and for high concentrations the output voltage decreases. Because I didn’t have proper calibration instrumentation at hand for this type of sensor, I made a very simple calibration process just by exposing the sensor to a “clean air” environment outside the city. I took an average of various readings in a 15-minute period to define a 400-PPM concentration, which is generally defined as the average for a clean air environment. Not an optimal calibration method of course, but I thought it was acceptable to get some meaningful data for prototyping purposes. For a proper calibration of the sensor, I would’ve needed another CO2 sensing system already calibrated with a high degree of accuracy and a set up in a controllable environment (e.g., a laboratory) in order to generate and measure the amount of CO2.

This sensor provides an output voltage between 30 and 50 mV. And due to their high output impedance, the signal must be properly conditioned with an op-amp. So, I used a Microchip Technology MCP6022 instrumentation amplifier in a noninverting configuration with a gain of 9.2.

You can read the complete article in Circuit Cellar 293 (December 2014).