ShapedAna
Published © GPL3+

Maximo

Maximo is a multi-purpose project made for ensuring security in homes and has other special features.

IntermediateWork in progress138
Maximo

Things used in this project

Story

Read more

Schematics

Schematic Of Maximo

I used a version powered with external power supply. But this Diagram is the internal one. If there is any mistake, please notify me.

Code

Maximo

Arduino
Upload it to Arduino Uno board.
/*

 
 The circuit:
 LCD RS pin to digital pin 12
 LCD Enable pin to digital pin 11
 LCD D4 pin to digital pin 5
 LCD D5 pin to digital pin 4
 LCD D6 pin to digital pin 3
 LCD D7 pin to digital pin 2
 LCD R/W pin to ground
 10K potentiometer:
 ends to +5V and ground
 wiper to LCD VO pin (pin 3)
 10K poterntiometer on pin A0
 
 
 */

// include the library code:
#include <LiquidCrystal.h>


const int rs = 5, en = 6, d4 =7, d5 = 8, d6 = 9, d7 = 10;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);


byte groot[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b01110,
  0b00000,
};
byte celsius[8] = {
  0b10100,
  0b10100,
  0b11100,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
};
byte happy[8] = {
  0b00000,
  0b01010,
  0000000,
  0b10001,
  0b11111,
  0b00000,
  0b00000,
  0b00000,
};
byte sad[8] = {
  0b00000,
  0b01010,
  0000000,
  0b00000,
  0b11111,
  0b10001,
  0b00000,
  0b00000,
};

const int temPin = A0;
const int xpin = A1;
const int ypin = A2;
const int switch1 = A3;
const int switch2 = A4;
const int switch3 = A5;
const int trigPin = 3;
const int echoPin = 4;
const int yellowLed = 11;
const int blueLed =12;
const int greenLed = 13;
const int buzzer = 2;
int swtch1;
int swtch2;
int swtch3;
long duration;
int distance;
float temperature;
int xaxis;
int yaxis;

void setup() {
  pinMode(temPin, INPUT);
  pinMode(xpin, INPUT);
  pinMode(ypin, INPUT);
  pinMode(switch1, INPUT_PULLUP);
  pinMode(switch2, INPUT_PULLUP);
  pinMode(switch3, INPUT_PULLUP);
  pinMode(echoPin, INPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(yellowLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  lcd.begin(16, 2);
  lcd.createChar(0, groot);
  lcd.createChar(1, celsius);
  lcd.createChar(2, happy);
  lcd.setCursor(0, 0);
  lcd.clear();
  delay(1000);
  lcd.setCursor(8, 0);
  lcd.write(byte(0));
  lcd.setCursor(0, 1);
  lcd.write("0101010101010101");
  delay(5000);
  lcd.clear();
  lcd.write("Loading");
  lcd.setCursor(0, 1);
  lcd.write("Commands...");
  delay(5000);
  lcd.clear();
  Serial.begin(9600);

}

void loop() {
  temperature = (5.0 * analogRead(temPin) * 100.0) / 1024;
  swtch1 = digitalRead(switch1);
  swtch2 = digitalRead(switch2);
  swtch3 = digitalRead(switch3);
  xaxis = analogRead(xpin);
  yaxis = analogRead(ypin);

  Serial.print(swtch1);
  Serial.print("  ");
  Serial.print(swtch2);
  Serial.print("  ");
  Serial.println(swtch3);

  if (swtch1 == 0 && swtch == 1 && swtch3 == 1) {
    lcd.clear();
    lcd.print("Maximo.");
    lcd.setCursor(0, 1);
    lcd.print(temperature);
    delay(500);
    if (temperature > 31) {
      lcd.clear();
      lcd.print("Maximo.");
      digitalWrite(yellowLed, HIGH);
      digitalWrite(blueLed, LOW);
      digitalWrite(buzzer, LOW);
      digitalWrite(greenLed, LOW);
      lcd.setCursor(13, 0);
      lcd.print("Hot");
      lcd.setCursor(0, 1);
      lcd.print(temperature);
    }
    else if (temperature < 26) {
      lcd.clear();
      lcd.print("Maximo.");
      digitalWrite(yellowLed, LOW);
      digitalWrite(blueLed, HIGH);
      digitalWrite(buzzer, LOW);
      digitalWrite(greenLed, LOW);
      lcd.setCursor(12, 0);
      lcd.print("Cold");
      lcd.setCursor(0, 1);
      lcd.print(temperature);
    }
  }
  else if (swtch1 == 1 && swtch == 0 && swtch3 == 1) {
    lcd.clear();
    lcd.print("Secure.");
    lcd.setCursor(14, 1);
    lcd.print(distance);
    delay(500);
    digitalWrite(yellowLed, LOW);
    digitalWrite(blueLed, LOW);
    digitalWrite(buzzer, LOW);
    digitalWrite(greenLed, HIGH);
    lcd.setCursor(1, 1);
    lcd.print("Safe");
    if (distance < 10) {
      lcd.clear();
      lcd.print("Secure");
      lcd.setCursor(1, 1);
      lcd.print("Danger");
      lcd.setCursor(13, 1);
      lcd.print(distance);
      digitalWrite(yellowLed, HIGH);
      digitalWrite(buzzer, HIGH);
      digitalWrite(greenLed, LOW);
      digitalWrite(blueled, HIGH);
      digitalWrite(buzzer, HIGH);
      delay(100);
      digitalWrite(blueled, LOW);
      digitalWrite(buzzer, LOW);
      delay(100);

    }
    else {
      lcd.clear();
      lcd.print("Secure.");
      digitalWrite(yellowLed, LOW);
      digitalWrite(blueLed, LOW);
      digitalWrite(buzzer, LOW);
      digitalWrite(greenLed, HIGH);
      lcd.setCursor(13, 1);
      lcd.print(distance);
    }
  }
  else if (swtch1 == 1 && swtch == 1 && swtch3 == 0) {
    lcd.clear();
    lcd.print("Special.");
    lcd.setCursor(0, 1);
    lcd.print(xaxis);
    lcd.setCursor(12, 0);
    lcd.print(yaxis);
    lcd.setCursor(11, 1);
    lcd.print(temperature);
    delay(500);
    digitalWrite(yellowLed, HIGH);
    digitalWrite(blueLed, LOW);
    digitalWrite(buzzer, LOW);
    digitalWrite(greenLed, LOW);
  }
  else if (swtch1 == 0 && swtch == 0 && swtch3 == 0) {
    digitalWrite(yellowLed, LOW);
    digitalWrite(blueLed, LOW);
    digitalWrite(buzzer, LOW);
    digitalWrite(greenLed, LOW);
    lcd.clear();
    lcd.print("Standby");
  }
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = duration * 0.034 / 2;



}

Credits

ShapedAna

ShapedAna

0 projects • 0 followers

Comments