Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Diana Khalipina
Published © LGPL

Eye Care Kit

Get continuous info about luminosity, temperature and humidity level in the room and turns on leds every hour for 5min to relax eyes.

IntermediateFull instructions provided1 hour1,848
Eye Care Kit

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
LED (generic)
LED (generic)
×6
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
Photo resistor
Photo resistor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×7
Switch Sealing Boot, Button Operators
Switch Sealing Boot, Button Operators
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit diagram for eye care kit

Code

Eye care kit

Arduino
#include <SoftwareSerial.h>
#include <cactus_io_AM2302.h>

#define AM2302_PIN 8

const int pinPhoto = A0;
int raw = 0;
AM2302 dht(AM2302_PIN);
int LED_RED = 13;
const int buttonPin = 2;
int buttonState = 0;
unsigned long timing;
uint32_t period5 = 5 * 60000L;
uint32_t period55 = 55 * 60000L;

const int L1 = 3; 
const int L2 = 4; 
const int L3 = 5; 
const int L4 = 6;
const int L5 = 7;

void setup() {
  Serial.begin(9600);
  dht.begin();
  pinMode( pinPhoto, INPUT );
  pinMode(buttonPin, INPUT);

pinMode(LED_RED, OUTPUT);
 pinMode(L1, OUTPUT); 
    pinMode(L2, OUTPUT); 
    pinMode(L3, OUTPUT); 
    pinMode(L4, OUTPUT);
    pinMode(L5, OUTPUT);
}

void loop() {
  dht.readHumidity();
  dht.readTemperature();
  raw = analogRead(pinPhoto);
   buttonState = digitalRead(buttonPin);

  if (isnan(dht.humidity) || isnan(dht.temperature_C)) {
    return;
  }
digitalWrite(LED_RED, HIGH);
   digitalWrite(L1, HIGH);
    digitalWrite(L2, HIGH);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, HIGH);
    
     Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);
    delay(500);
    
    if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  
 if (buttonState == HIGH) {
  for( uint32_t tStart = millis();  (millis()-tStart) < period55;  ){
  timing = millis(); 
  
 digitalWrite(L1, HIGH);
 digitalWrite(L2, HIGH);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, HIGH);

    Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);
    
      if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  delay(500);
 }
 
  for( uint32_t tStart = millis();  (millis()-tStart) < period5;  ){
  timing = millis(); 
  
   Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);
        if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
   if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  
 digitalWrite(L1, LOW);
    digitalWrite(L2, HIGH);
    digitalWrite(L3, LOW);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, LOW);

    delay(500);

 digitalWrite(L1, HIGH);
 digitalWrite(L2, LOW);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, LOW);
    digitalWrite(L5, HIGH);
    
    delay(500);
    
 }

 for( uint32_t tStart = millis();  (millis()-tStart) < period55;  ){
  timing = millis(); 
  
 digitalWrite(L1, HIGH);
 digitalWrite(L2, HIGH);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, HIGH);

    Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);
    
      if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  delay(500);
 }
 
 for( uint32_t tStart = millis();  (millis()-tStart) < period5;  ){
  timing = millis(); 
  
   Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);

      if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  
 digitalWrite(L1, LOW);
    digitalWrite(L2, HIGH);
    digitalWrite(L3, LOW);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, LOW);

    delay(500);

 digitalWrite(L1, HIGH);
 digitalWrite(L2, LOW);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, LOW);
    digitalWrite(L5, HIGH);
    
    delay(500);
    
 }

 for( uint32_t tStart = millis();  (millis()-tStart) < period55;  ){
  timing = millis(); 
  
 digitalWrite(L1, HIGH);
 digitalWrite(L2, HIGH);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, HIGH);

    Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);
    
      if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  delay(500);
 }

 for( uint32_t tStart = millis();  (millis()-tStart) < period5;  ){
  timing = millis(); 
  
   Serial.print("Luminoscity:"); Serial.print(raw); Serial.print(" "); Serial.print("Temperature,C°:"); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print("Humidity,%:"); Serial.println(dht.humidity);

      if ((raw <= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw <= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  if ((raw >= 500) || (dht.humidity <= 80.00)){
    digitalWrite(LED_RED, LOW);
  }
  
 if ((raw >= 500) || (dht.humidity >= 80.00)){
    digitalWrite(LED_RED, HIGH);
  }
  
 digitalWrite(L1, LOW);
    digitalWrite(L2, HIGH);
    digitalWrite(L3, LOW);
    digitalWrite(L4, HIGH);
    digitalWrite(L5, LOW);

    delay(500);

 digitalWrite(L1, HIGH);
 digitalWrite(L2, LOW);
    digitalWrite(L3, HIGH);
    digitalWrite(L4, LOW);
    digitalWrite(L5, HIGH);
    
    delay(500);
    
 }
 }
}

Credits

Diana Khalipina
23 projects • 94 followers
Integrating Web Accessibility in Healthcare Tech | Web Developer & Bioengineering Specialist in Paris | MSc in Biomedical Engineering

Comments