Homemade small PM2.5 environmental detection system, the actual measurement effect is quite good

Publisher:WiseThinkerLatest update time:2021-12-16 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I have been unable to go out due to the epidemic during this period. Looking at the constantly changing data on the large screen of the air detection system opposite my house, I suddenly had an idea: could I make a PM2.5 testing system myself? I just had to do it when I thought about it.


As usual, without further ado, here are the pictures:


Physical picture 1

insert image description here

Physical picture 2

insert image description here
insert image description here

The actual measurement accuracy and precision are still acceptable.


The reference code of PM2.5 detection system is as follows:

host

#include

#include "delay.h"

#include "LCD12864.h"

#include "PM2_5.h"

#include "BMP180.h"

#include "DHT11.h"

#define uint unsigned int

#define uchar unsigned char


sbit waring=P1^3;

void main()

{

lcd_init();

Init_BMP085();

Init_PM2_5();


    while(1)

    {

    bmp085Convert();

    RH();

    

    lcd_pos(0,0);

    display_string("pm2.5:");

    if(read_pm()>5)

    display_num(read_pm());

    else

    display_num(5);

    display_string("ug/m3");

    display_string(" ");


    lcd_pos(1,0);

    display_string("T:");

    display_num(temperature/10);

    display_string(".");

    display_num(temperature%10);

    display_string("'C");

    display_string(" ");

     

    display_string("H:");

    display_num(RHdataH);

    display_string("%");


    lcd_pos(2,0);

    display_string("pre:");

    display_num(pressure/1000);

display_string(".");

    display_num(pressure%1000);

    display_string("kpa");


    lcd_pos(3,0);

    display_string("smo:");

    if(read_pm()>200)

    {

            display_string("High");        

            waring=0;

    }

    else

    {

            display_string("low");

            display_string(" ");

            warning=1;

    }

    display_string("Al:");        

    display_num(Altitude);

    display_string("m");

    display_string(" ");

    delay_ms(200);

    }


}


PM2.5

#include

#define uint unsigned int

#define uchar unsigned char

#define K_PM 820

void senddata(uchar dat);

uint read_pm();

uchar cal[7]={0};

// cal[0]: starting bit 0xAA

// cal[1]:Vout(H)

// cal[2]:Vout(L)

// cal[3]:Vref(H)

// cal[4]:Vref(L)

// cal[5]: check digit

// cal[6]: end bit 0xFF


uchar buf;

uchar sum;

int i=0;

float Vo;

void Init_PM2_5()

{

SCON=0x50;

PCON=0x00;


    TMOD=0x20;

    EA=1;

    ES=1;

    TL1=0xF4;

    TH1=0xF4;

    TR1=1;        


}


uint read_pm()

{

return (uint)(K_PM*Vo);

}


void serial() interrupt 4

{

ES=0;

RI=0;

buf=SBUF;

senddata(buf);

ES=1;

}


void senddata(uchar dat)

{

if(dat0xAA)

{

i=0;

cal[i]=dat;

}

else

{

i=i+1;

cal[i]=dat;

if(i6)

{

sum=cal[1]+cal[2]+cal[3]+cal[4];

if(sum==cal[5]&&cal[6]==0xFF)

{

// for(i=0;i<=6;i++)

// {

// SBUF=cal[i];

// while(!TI);

//TI=0;

// }

Vo=(cal[1]256+cal[2])/1024.05;

// SBUF=cal[1];

// while(!TI);

//TI=0;

//

//

// SBUF=cal[2];

// while(!TI);

//TI=0;


                    }

            }

    }


}


Due to limited space, I can only write this much.

Reference address:Homemade small PM2.5 environmental detection system, the actual measurement effect is quite good

Previous article:Semiconductor refrigeration refrigerator made of single chip microcomputer
Next article:Design of anti-theft system based on single chip microcomputer + human infrared sensor

Recommended ReadingLatest update time:2024-11-16 15:26

Using Virtex-5LXT to meet the challenges of serial backplane interface design
The use of serial technology in high-end system design has accounted for a large proportion. In a recent questionnaire survey conducted by EE Times magazine, 92% of the respondents said that they had started designing serial I/O systems in 2006, while only 6% were engaged in serial design in 2005. The prevalenc
[Embedded]
Using Virtex-5LXT to meet the challenges of serial backplane interface design
With the rapid development of 5G and electric vehicle markets, will SOI wafers be out of stock?
5G wireless communications require higher frequencies to achieve faster network speeds. Compared with traditional gallium arsenide (GaAs) and silicon-on-sapphire (SOS) technologies, RF-SOI can provide excellent RF performance and lower costs at the same time. Based on the above advantages, as one of the key componen
[Automotive Electronics]
With the rapid development of 5G and electric vehicle markets, will SOI wafers be out of stock?
OnePlus Nord N10 5G decrypted: Snapdragon 690 processor + 90Hz refresh rate
The OnePlus Nord N10 5G is expected to be priced lower than the original Nord and is expected to launch in the US on October 26 alongside the OnePlus Nord N100. OnePlus Nord N10 5G exposed: Snapdragon 690 processor + 90Hz refresh rate The OnePlus Nord N10 5G is equipped with a 6.49-inch FHD+ display with a refresh r
[Mobile phone portable]
Keil 5 uses JLink to connect to a running CPU
environment: Target CPU: STM32F429 Connection tool: JLink V9 Connection method:SWO Debugging tool: Keil MDK 5.20 scenes to be used: The target board is running, but there is a bug and needs to be debugged, but there is no online debug. So you need to use a debugger to attach to the running board without
[Microcontroller]
Keil 5 uses JLink to connect to a running CPU
Xiaomi Mi Band 5 appearance: colorful oval screen with four colors to choose from
       On June 11, the fifth-generation Xiaomi Mi Band will be officially released. Today, the official released its appearance photo with the slogan "Reignite Power".   Xiaomi Smart Life official Weibo said: "Xiaomi Mi Band 5 is coming! Behind every growth, we push ourselves to the extreme and challenge countless imp
[Mobile phone portable]
4W/5V switching regulator circuit diagram of T0P100 device
  The figure shows a 4W/5V switching voltage regulator circuit. This circuit uses the TOPSwitch series T0P100 device. The TOPSwitch (Three Terminal Offline PWM Switch) series device is a three-terminal PWM switching power supply. Its feature is that the PWM controller and MOSFET power switch tube in the high-frequency
[Power Management]
4W/5V switching regulator circuit diagram of T0P100 device
How far is the power grid from using 5G?
5G network slicing technology can provide customized communication services for different departments and business needs of the power grid. Recently, the Ministry of Industry and Information Technology issued 5G (fifth-generation communication technology) commercial licenses to four operators including Chin
[New Energy]
Operators say self-developed equipment may make it "easy" for the Indian mobile phone market to upgrade to the 5G era
Earlier, Mobile World Live reported that Reliance Industries Chairman Mukesh Ambani outlined his bold vision for the mobile division, announcing that Jio Platforms engineers have designed and developed a complete 5G system from scratch, ready for testing once spectrum becomes available, with field deployment expected
[Mobile phone portable]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号