Vishwas Navada
Published © CC BY-NC-SA

Jeeva - AI Based Smart Assist for Elderly

A smart wearable device which can be trained to detect variations in walking which can also control home appliances thereby helping elders.

IntermediateFull instructions providedOver 2 days250
Jeeva - AI Based Smart Assist for Elderly

Things used in this project

Story

Read more

Code

Home automation

C/C++
This takes input from raspberry pi serial port at 38400 baudrate
#include<LiquidCrystal.h>
String voice;
int
tv = 2, //Connect tv To Pin #2
fan = 3, //Connect fan To Pin #3
light = 4, //Connect light To Pin #4
heater = 5, //Connect heater To Pin #5
ac = 6; //Connect AC to Pin #6

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void allon() {
  digitalWrite(tv, LOW);
  digitalWrite(fan, LOW);
  digitalWrite(light, LOW);
  digitalWrite(heater, LOW);
  digitalWrite(ac, LOW);
}
void alloff() {
  digitalWrite(tv, HIGH);
  digitalWrite(fan, HIGH);
  digitalWrite(light, HIGH);
  digitalWrite(heater, HIGH);
  digitalWrite(ac, HIGH);
}

void setup() {
  Serial.begin(38400);


  // rtc.adjust(DateTime(2017, 10, 14, 00, 46, 00));
  lcd.begin(16, 2); // 16x2 LCD
  lcd.clear(); // blank the display
  pinMode(tv, OUTPUT);
  pinMode(fan, OUTPUT);
  pinMode(light, OUTPUT);
  pinMode(heater, OUTPUT);
  pinMode(ac, OUTPUT);
  digitalWrite(tv, HIGH);
  digitalWrite(fan, HIGH);
  digitalWrite(light, HIGH);
  digitalWrite(heater, HIGH);
  digitalWrite(ac, HIGH);
}

void loop() {
  ;
  lcd.setCursor(0, 0);
  lcd.print("Hi, Jarvis Here");



  while (Serial.available()) { //Check if there is an available byte to read
    delay(10); //Delay added to make thing stable
    char c = Serial.read(); //Conduct a serial read
    if (c == '#') {
      break; //Exit the loop when the # is detected after the word
    }
    voice += c; //Shorthand for voice = voice + c
  }
  if (voice.length() > 0) {
    Serial.println(voice);

    if (voice == "*switch on all") {
      allon(); //Turn Off All Pins (Call Function)
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Switched ON all");
    }
    else if (voice == "*switch off all") {
      alloff(); //Turn On  All Pins (Call Function)
      lcd.clear();
      lcd.setCursor(0, 1);
      lcd.print("Switched off all");
    }


    else if (voice == "*TV on") {
      digitalWrite(tv, LOW);
      lcd.clear();
      lcd.setCursor(0, 1);
      lcd.print("Switched ON  TV");
    }
    else if (voice == "*fan on") {
      digitalWrite(fan, LOW);
      lcd.clear();
      lcd.setCursor(0, 1);
      lcd.print("Switched ON fan");
    }
    else if (voice == "*lights on") {
      digitalWrite(light, LOW);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Lights ON");
    }
    else if (voice == "*heater on") {
      digitalWrite(heater, LOW);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Heater ON");
    }
    else if (voice == "*AC on") {
      digitalWrite(ac, LOW);
      lcd.clear();
      lcd.setCursor(0, 1);
      lcd.print("Switched ON AC");

    }

    else if (voice == "*TV off") {
      digitalWrite(tv, HIGH);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Switched OFF TV");
    }
    else if (voice == "*fan off") {
      digitalWrite(fan, HIGH);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Switched OFF Fan");
    }
    else if (voice == "*lights off") {
      digitalWrite(light, HIGH);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Lights OFF");
    }
    else if (voice == "*heater off") {
      digitalWrite(heater, HIGH);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Heater OFF ");
    }
    else if (voice == "*AC off") {
      digitalWrite(ac, HIGH);
      lcd.clear();
      lcd.setCursor(0, 1);

      lcd.print("Switched OFF AC");
    }

    voice = ""; //Reset the variable after initiating
  }
}

Credits

Vishwas Navada

Vishwas Navada

10 projects • 30 followers
Full stack hardware engineer.

Comments