Project tutorial

Control of room conditions for healthy work © GPL3+

Provide continuous info about room temperature, humidity, CO2 and luminoscity levels and turn on leds at the end of the work to relax eyes

  • 5 views
  • 0 comments
  • 0 respects

Components and supplies

Apps and online services

About this project

Environmental conditions in which one work play as an important role as motivation and time. The following parameters were accounted in this project:

  • Perfect room temperature lies between 18 and 22 °C (according to WHO organisation);
  • Optimal humidity level for health and eye comfort is minimum 40%;
  • Concentration of CO2 should be smaller than 1, 000ppm;
  • Level of the luminosity for eye comfort should be >500KΩ.

LDC screen continuously shows an info about all the parameters and if a value of any parameter goes out of reccomended range, then the screen becomes red. As well, for the eye comfort at the end of the work there is a possibility to press a touch sensor which activates rainbow leds.

  • SCHEMATICS To make this project work, firstly I connected sensors with Arduino, like it is represented on the photo below and on the schematics at the end of the project description:

  • CODE Then I wrote a code for Adruino to get the data from the sensors. But I didn't want just to receive the data, I wanted to be able to show separatedly the graphs of each parameter's value change and save them for futher analysis. To do this I used Vittascience platform (link to the project: https://fr.vittascience.com/arduino/?link=5ebf7216b3cb5).

In addition to the link I added C++ code for Arduino, which can be found at the end of the project description.

  • DATA Then I tried to use the kit and get the data about parameters of the room.

That's how a working Arduino with sensors looks like:

When the work is done, one can touch the touch sensor and the rainbow leds will start shining. The colors will change each other authomaticallly.

To analyse and save the data Vittascience platform is very useful, that's how I got my data:

I really hope that my project will help everyone to increase productivity and work everyday in healthy conditions.

Code

Code for arduinoArduino
#include <Wire.h>
#include <DHT.h>
#include <Adafruit_SGP30.h>
#include <rgb_lcd.h>
#include "Adafruit_NeoPixel.h"

#define LED_COUNT_NP2         30

DHT dht(A0, DHT11);
Adafruit_SGP30 sgp30;
rgb_lcd lcdRgb;
Adafruit_NeoPixel Neopixel_2(LED_COUNT_NP2, 2, NEO_GRB + NEO_KHZ800);

void serial_setupConnection(int baudrate) {
  Serial.begin(baudrate);
  while (!Serial) {
    Serial.println("En attente de l'ouverture du port série...");
    delay(1000);
  }
  Serial.println("Port série activé. Baudrate: " + String(baudrate));
}

uint16_t sgp30_readCO2() {
  if (!sgp30.IAQmeasure()) {
    Serial.println("Measurement failed");
    return 0;
  }
  else return sgp30.eCO2;
}

void showAllNeopixel(Adafruit_NeoPixel neoPx, uint8_t ledCount, uint8_t r, uint8_t g, uint8_t b) {
  for (int i=0; i<ledCount; i++) {
    neoPx.setPixelColor(i, neoPx.Color(r, g, b));
  }
  neoPx.show();
  delay(5);
}

void rainbow(Adafruit_NeoPixel neoPx, uint8_t ledCount) {
  uint8_t R = 255;
  uint8_t G = 50;
  uint8_t B = 50;
  for (G; G<254; G=G+5) showAllNeopixel(neoPx, ledCount, R, G, B);
  for (R; R>49; R=R-5) showAllNeopixel(neoPx, ledCount, R, G, B);
  for (B; B<254; B=B+5) showAllNeopixel(neoPx, ledCount, R, G, B);
  for (G; G>49; G=G-5) showAllNeopixel(neoPx, ledCount, R, G, B);
  for (R; R<254; R=R+5) showAllNeopixel(neoPx, ledCount, R, G, B);
  for (B; B>49; B=B-5) showAllNeopixel(neoPx, ledCount, R, G, B);
}


void setup() {
  serial_setupConnection(9600);
  dht.begin();
  while (!sgp30.begin()) {
    Serial.println("En attente du capteur SGP30...");
    delay(1000);
  }
  pinMode(A1, INPUT);
  lcdRgb.begin(16, 2);
  pinMode(3, INPUT);
  Neopixel_2.begin();
}

void loop() {
  Serial.print("@Graph:");
  Serial.print("Temperature:");
  Serial.print(dht.readTemperature());
  Serial.print("|");
  Serial.print("Humidity:");
  Serial.print(dht.readHumidity());
  Serial.print("|");
  Serial.print("CO2:");
  Serial.print(sgp30_readCO2());
  Serial.print("|");
  Serial.print("Light:");
  Serial.print(analogRead(A1));
  Serial.print("|");
  Serial.print("\n");
  delay(50);
  lcdRgb.setCursor(0, 0);
  lcdRgb.print(String(dht.readTemperature()));
  lcdRgb.setCursor(0, 1);
  lcdRgb.print(String(dht.readHumidity()));
  if (dht.readTemperature() >= 22.01) {
    lcdRgb.setRGB(255, 0, 0);
  } else if (dht.readHumidity() <= 40.01) {
    lcdRgb.setRGB(255, 0, 0);
  } else if (dht.readTemperature() <= 18.01) {
    lcdRgb.setRGB(255, 0, 0);
  }
  lcdRgb.setRGB(255, 255, 255);
  delay(2000);
  lcdRgb.setCursor(0, 0);
  lcdRgb.print(String(sgp30_readCO2()));
  lcdRgb.setCursor(0, 1);
  lcdRgb.print(String(analogRead(A1)));
  if (sgp30_readCO2() >= 100000.01) {
    lcdRgb.setRGB(255, 0, 0);
  } else if (analogRead(A1) <= 50.01) {
    lcdRgb.setRGB(255, 0, 0);
  }
  if (digitalRead(3) == true) {
    rainbow(Neopixel_2, LED_COUNT_NP2);
  }
  delay(2000);
  lcdRgb.setRGB(255, 255, 255);
}

Schematics

Schematics for arduino
Hackster roomcond ijny0urh8a

Comments

Similar projects you might like

Health Kit: Humidity and Temperature Control

Project tutorial by Diana Khalipina

  • 10,975 views
  • 2 comments
  • 51 respects

Touchless faucet with door control system for COVID-19

Project tutorial by Rucksikaa Raajkumar

  • 488 views
  • 0 comments
  • 9 respects

Servo Control with TV Remote Control

Project showcase by eldo85

  • 15,669 views
  • 7 comments
  • 40 respects

Control an LED with the Remote Control

Project showcase by Nicholas_N

  • 16,721 views
  • 8 comments
  • 21 respects

Control Your Computer With A Remote Control

Project tutorial by Arduino_Scuola

  • 9,348 views
  • 1 comment
  • 10 respects
Add projectSign up / Login