Introduction: EAL Garage Controle View

DK: Her vil jeg via Arduino lave et system der kan vise mig informationer om min garages status. Jeg vil ved hjælp af de tre LED dioder kunne se om: 1: Døren er låst eller åben. 2: Porten er oppe eller nede. 3: Om der er vand i kælderen.

GB: Here, via Arduino, I will make a system that will show me information about the status of my garage. By using the three LED diodes, I would like to see if: 1: The door is locked or open. 2: The roll-up door is up or down. 3: If there is water in the basement.

Step 1: Status System for Garage.

DK: Her ses boksen med de tre LED status lamper.

GB: Here is the box with the three LED status lights.

Step 2: DK: Her Ses at Døren Er Låst. GB: Here's the Door Locked.

DK: Jeg er her fri for at gå ud og manuelt kontrollere om døren er låst.

GB: I'm free to go out and manually check if the door is locked.

Step 3: DK: Komponenter Anvendt (komponentliste) GB: Components Used (component List)

DK:

Arduino Tilt Sensor

Arduino Magnetic Sensor

Funduino Water Sensor

Arduino Mega

Fireledet telefonkabel

Elbokse (samlekasser)

Aluplade

Kabelbindere

Spændeskiver (vægte)

Hængsel

Kabelholdere

Magnet

Lys dioder, 2 røde 1 blå

En gammel oplader til en mus, anvendes som strømforsyning

GB:

Arduino Tilt Sensor

Arduino Magnetic Sensor

Funduino Water Sensor

Arduino Mega

Telephonecable

Elboxes

Aluminum plate

Cable binders

Washers (weights)

Hinge

Cable holders

Magnet

Light diodes, 2 red 1 blue

An old charger for a mouse is used as power supply

Step 4: DK: Ledningsdiagram GB: Wire Diagram

DK: Ledningernes farve fra hver sensor går igen på den tilhørende LED pære der repræsentere sensoren.

GB: The color of the cables from each sensor goes back to the belonging LED bulb that represents the sensor.

Step 5: DK: Kodningen. GB: the Code.

#define Vand_Sensor 8 // Funduino Vand sensor Digital indgang Pin 8, water sensor digital input Pin 8
#define LED 9 //lampe til vandsensor, blaa diode Pin 9, light indicator for water sensor
// Portene bestemmes
//Port, kviksoelvskontakt
const int buttonPin = 2;     // digital input Pin 2, aaben eller lukket port ,open or closed roll-up door
const int ledPin =  13;      // digital output til roed diode Pin 13, digital output to red LED Pin 13
//Doer, magnetfoeler
const int analogInPin = A5;  // Analog input som magnetkontakten er forbundet til Pin A5, laast eller aaben doer, connector to the magnetic sensor, unlocked or locked door
const int analogOutPin = 10; // Analog output til roed diode Pin 10, analog output for red LED Pin 10
int sensorValue = 0;        // Diffinere om magnetsensoren er aktiv eller ej, for laast eller aaben doer, tells if magnetic sensor is active or not, unlocked or locked 
int buttonState = 0;         // Diffinere om kviksoelvskontakten er taendt eller slukket, tells if tilt sensor is active or not
void setup() { //ind og udgange bestemmes, diffinition of in and outputs
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT); 
  
  pinMode(9, OUTPUT); //signal til blaa LED lampe for alarm ved vand i kaelder, signal for blue LED, water in basement alarm
  pinMode(10, OUTPUT); //signal til roed LED lampe for laast eller aaben doer, signal for red LED, unlocked or locked door
  
   pinMode(Vand_Sensor, INPUT); // Vandsensor fungere som Input, water sensor acts like an input
   pinMode(LED, OUTPUT); //  LED fungere som Output, LED acts like an output
}
// programmet
void loop() {
  // status på kviksoelvskontakten laeses: Status on tilt sensor:
  buttonState = digitalRead(buttonPin);
 // Status på magnetsensoren laeses: Status on magnetic sensor:
  sensorValue = analogRead(analogInPin);
  //den analoge vaerdi bestemmes, hvis vaerdien er hoejere end 200 aktiveres analog udgang, the value of the analog is diffined, if value is higher than 200 analog output activetes
 
  if (sensorValue <200)
  {
    digitalWrite(analogOutPin, HIGH);
  }
  else
  {
     digitalWrite(analogOutPin, LOW);
  }
  // vent 2 millisekunder foer naeste loop, 
  // for at analog-to-digital converter laeser den rigtige vaerdi, wait 2 millisecunds before next loop so analog to digital converter has time to read the right value
  delay(2);
  // tjek om magnetsensor er aktiveret, hvis ja, aktiver LED output til HIGH. If magnetic sensor is activated, activetes LED output to HIGH
  
  if (buttonState == LOW) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
 
   //Vandsensoren vil skifte til LOW naar vand registreres, Water sensor will change to LOW if water is detected
   
   if( digitalRead(Vand_Sensor) == HIGH) {
      digitalWrite(LED,HIGH);
      delay(200);
      digitalWrite(LED,LOW);
      delay(200);
   }else {
      digitalWrite(LED,LOW);
   }   }

Step 6: DK: Billeder Fra Projektet. GB: Pictures From the Project.

Step 7: DK: Ind Og Udgange. GB: in and Outputs

A5 Magnet sensor signal in (analog)

D2 Tilt sensor signal in (digital)

D8 Water sensor in (digital)

D9 Water sensor out (digital)

D10 Magnet sensor out (digital)

D13 Tiltsensor signal out (digital)

Step 8: DK: Film Om Mit ARDUINO Projekt. GB: Movie About My ARDUINO Project.