Introduction: DIY a Formaldehyde Detector

About: Empowering Creation for Future Innovators; Our mission is to form a community with easy access to whether hardware, software and ideas that allow makers and younger generation to achieve their goals and realiz…

HCOH (Formaldehyde) is colorless, poisonous, high water-soluble, high alcohol-soluble and high ether-soluble gas with an obnoxious odor. It is widely used in decoration, such as adhesives, carpeting, decorative paneling and so on. HCOH is a prominent factor in sick-building syndrome as its emissions (accelerated by heat and moisture) irritate eyes and mucous membranes in nose and throat, and cause headache and dizziness. It is widely used in decoration, such as adhesives, carpeting, decorative paneling and so on.

My brotherhave just decorated a new house as the marriage house couple of days ago and he cannot wait for long, for the wedding date is fixed in 1st-Oct. There are many things to check and purify air, kinds of plants and tools. The last time I saw him, he was buying a formaldehyde detector on line, but he complained the inaccuracy of the detector yesterday. As a maker, how could I miss this chance to DIY a simple HCOH detector?

The common solution to measure HCHO in air is the reagent or colorimetric card. But the solution will occupy much time, and used only once. And the result is not very accurate and you just know probably. VOC gas sensor is second-generation solution. it can detect HCHO roughly, because this sensor only expresses the whole concentration of VOC gas, not just HCHO only. There are three kinds of HCOH detectors in the main market, semiconductor sensor, resistance heating and test paper.

Step 1: Components in Need

Step 2: Circuit Diagram 1-DAC

Switch to DAC, connection diagram is shown as above.

Caution: In the DAC mode, the measurement accuracy would be influenced by master ADC bit number, reference voltage accuracy. So please charge the main controller with the high precision power supply or the internal reference voltage.

Step 3: Circuit Diagram2-UART

Switch to UART, connection diagram is shown as above.

Wiring Diagram2

Comparing two modes, I’d love to recommend UART for its better precision.

Step 4: Sketch

Gravity: I2C 16x2 Arduino LCD with RGB Backlight Display is the combination of 16 million colors, and I chose 4 colors (Green,Red,Yellow,Purple) to represent the distinguish between different HCOH concentration.

The screen display is Green when the HCOH concentration is in a secure range (the indoor air HCOH is lower than 0.08mg/m3 or 0.06ppm)

The screen display is Yellow when the HCOH concentration exceeds a secure range (the indoor air HCOH is higher than 0.06ppm and lower than 0.2ppm), which suggests that you need to take measures to remove HCOH.

The screen display is Red when the HCOH concentration over-exceeds a secure range (the indoor air HCOH is higher than 0.2ppm and lower than 4ppm), which means that you’d better leave it empty for half a year.

The screen display is Red&Purple when the HCOH concentration more than 4ppm (the maximum HCOH measuring range is 5ppm).

Step 5: Application Situation

In the 21st century, we meet both harms and benefits. Only when we pay enough attention to health can we age day by day. It is necessary to detect HCOH concentration is many environments, such as bookcase, automobile room, conference room, especially in the newly decorated house.

  • Bookcase
  • Automobile room
  • Conference room
  • Shelves
  • Windowsill
  • Office

Besides these private environments, HCOH detection is also in need in public. For example, building materials, furniture… It can never be too much to mention the damage caused by HCOH, HCOH detectors of civilian values are valued by the public. To satisfy requirements of public, I designed this small, light and cost effective HCOH detector. You can download documents attached in the end page.

Step 6: Programming Code


#define SensorAnalogPin A2 //this pin read the analog voltage from the HCHO sensor
#define VREF 5.0 //voltage on AREF pin #include "DFRobot_RGBLCD.h" DFRobot_RGBLCD lcd(16, 2);

void setup() { Serial.begin(9600); lcd.init(); lcd.setRGB(0, 0,255); lcd.setCursor(1, 0 ); lcd.print("HCHO:"); }

void loop() { Serial.print(analogReadPPM()); Serial.println("ppm"); delay(1000); lcd.setCursor(6,1); lcd.print(analogReadPPM()); lcd.print("ppm"); lcd.setCursor(6,0); lcd.print(analogReadPPM()*1.34); lcd.print("mg/m3"); if(analogReadPPM()<0.06) { lcd.setRGB(0, 255, 0); } else if(analogReadPPM()<0.2) { lcd.setRGB(250, 128, 10); } else if(analogReadPPM()<4) { lcd.setRGB(255, 0, 0); } else { lcd.setRGB(255, 0, 0); delay(250); lcd.setRGB(0, 0, 0); } delay(100); }

float analogReadPPM() { float analogVoltage = analogRead(SensorAnalogPin) / 1024.0 * VREF; float ppm = 3.125 * analogVoltage - 1.25; //linear relationship(0.4V for 0 ppm and 2V for 5ppm) if(ppm<0) ppm=0; else if(ppm>5) ppm = 5; return ppm; }


#include #include #include "DFRobot_RGBLCD.h" DFRobot_RGBLCD lcd(16, 2); #define SensorSerialPin 10 //this pin read the uart signal from the HCHO sensor SoftwareSerial sensorSerial(SensorSerialPin,SensorSerialPin); DFRobotHCHOSensor hchoSensor(&sensorSerial);

void setup() { sensorSerial.begin(9600); //the baudrate of HCHO is 9600 sensorSerial.listen(); Serial.begin(9600); lcd.init(); lcd.setRGB(0, 0,255); lcd.setCursor(1, 0 ); lcd.print("HCHO:"); lcd.setCursor(1, 1 ); }

void loop() { if(hchoSensor.available()>0) { // delay(1000); Serial.print(hchoSensor.uartReadPPM()); Serial.println("ppm"); lcd.setCursor(6,1); lcd.print(hchoSensor.uartReadPPM()); lcd.print("ppm"); lcd.setCursor(6,0); lcd.print(hchoSensor.uartReadPPM()*1.34); lcd.print("mg/m3"); if(hchoSensor.uartReadPPM()<0.06) { lcd.setRGB(0, 255, 0); } else if(hchoSensor.uartReadPPM()<0.2) { lcd.setRGB(250, 128, 10); } else if(hchoSensor.uartReadPPM()<4) { lcd.setRGB(255, 0, 0); } else { lcd.setRGB(255, 0, 0); delay(500); lcd.setRGB(255, 0, 255); } delay(100); } }

3D printing files and 3D image HCOH Detection.rar

fixed library files.rar