Air quality sensor

Good evening everyone! I have built a device with an Arduino Yun a grove dust sensor and a grove base shield. I have edited the suggested code from grove seed for serial monitoring so as to send my data via an ethernet cable in to google forms. The problem is that the device switches off every 12 hours. Do you have any suggestions on what can i do or what is causing that? Thanks in advance! George Markantonis

Hi George Markantonis

I did a 24 - hour test with the following code.[list]

  • int pin = 8;

    unsigned long duration;

    unsigned long starttime;

    unsigned long sampletime_ms = 10000;//sampe 10s ;

    unsigned long lowpulseoccupancy = 0;

    float ratio = 0;

    float concentration = 0;



    void setup()

    {

    Serial.begin(9600);

    pinMode(pin,INPUT);

    starttime = millis();//get the current time;

    }



    void loop()

    {

    duration = pulseIn(pin, LOW);

    lowpulseoccupancy = lowpulseoccupancy+duration;



    if ((millis()-starttime) > sampletime_ms)//if the sampel time == 30s

    {

    ratio = lowpulseoccupancy/(sampletime_ms10.0); // Integer percentage 0=>100

    concentration = 1.1
    pow(ratio,3)-3.8pow(ratio,2)+520ratio+0.62; // using spec sheet curve

    Serial.print(lowpulseoccupancy);

    Serial.print(",");

    Serial.print(ratio);

    Serial.print(",");

    Serial.println(concentration);

    lowpulseoccupancy = 0;

    starttime = millis();

    Serial.print(“system run time : “);

    Serial.print(starttime/1000);

    Serial.println(” s”);



    }

    }
  • [/list] I didn’t find out what you said. Please put your code up. We’re doing a test to see if you can find out what you say.

    Thank you very much. I will try to upload the code as soon as possible.

    Wow that seems like a very nice device. Heating and Cooling Markham Appreciate your work.