What I am going to do for my Project is an automated lock or smart lock (smart lamp) that can be wireless opened it by a smart device from a long distance but also control it with a physical switch. So I am going to do this because it gives a solution to a problem i experienced while working for a company. When was the time for eating and returned to the building i had to wait a long time to someone opening me the door turning an electric lock with just a physical switch because they were eating and the physical switch was just too far for them. Also with the clients  someone had to open the door to touch the physical switch and opened the door and i think it does not have to be like this. So that are the reasons why i am going to do this optomized project and i want to presented it in Expo Ing.

How Am I going to do this project?

To succeed for this project I am going to do a system control programming 2 microcontrollers (A microcontroller is a integrated circuit device who controls outputs like the lock in fuction of inputs in this case the switches) in languague C with open source software called Arduino where these controllers are going to read the inputs between the smart device and the physical switch and decide whether of those can open or close the electric lock. Therefore I am going to follow this diagram i designed:

xor-automatico

moc3011

At first I am going to build this circuit i designed where it has the physical switch that utilizes Altern Current of 127 Volts of AC and the microcontroller utilizes Direct Current of 5 VCD so the diagram converts the altern current of 127VAC to direct current of 5 volts to one controller while the other microcontroller is reading the state of the smart device sending the value to the other controller that has the physical switch connected.

The smart device can be a cellphone so i will design an app that can talk with one controller using a wireless interface or module. The module i will be using is a bluetooth module HC05:

hc05

For the communication between the HC05 and the cellphone i need to design the app for it and the language i will be using is the graphic language in the environment of app inventor.

head

App Inventor is a free open source tool software developed by Google Labs in 2011 to create apps Android. After of a short period of time, the development of this software goes with Massachusetts Institute of Technology (MIT). Using the web browser you can create Android apps  in a visual and easy way thanks to the basic tools. In App Inventor it starts designing the app through the app in a graphic environment. This kind of environment involves a program language based on visual language in Java Blocks like one called Scratch. The libraries of these blocks have been developed by the MIT and it is free use. In these blocks we found functions, sentences and elements very common in this kind of visual programming language. Thanks to this we can create apps Android in a fast and easy way with no having knowledge in Java. Once the design finish with the blocks of the app, you can download it and install it in an Android device o well we can taste whether an emulator that provides the software or using an Android Device.

appinventor-diagrama-1

app

app-language-blocks

app-language-blocks2

One controller leads with the smart device and the other controller decides whether any of the inputs can turn on or off the electric lock. This controller is also programed with the languague C and works as a logic circuit XOR where the truth table is here:

xor

This is what the second controller is working on. He reads the states of the inputs with 4 if sentences and decides in which condition turn the lock on or off.

You can find the code for GitHub:

Languague C to the microcontrollers

Code of the first microcontroller:
void setup() {
// put your setup code here, to run once:
//DECLARACIÓN Y CONFIGURACIONES DE PUERTOS DE ENTRADAS Y SALIDAS O VARIABLES O COMUNICACIÓN SERIAL
pinMode(2,INPUT);
pinMode(3,OUTPUT);
Serial.begin(9600);
digitalWrite(3,LOW);

}

void loop() {
// put your main code here, to run repeatedly:

char dato=Serial.read();

if(digitalRead(2)==LOW && dato==’a’)
{digitalWrite(3,LOW);}

if(digitalRead(2)==LOW && dato==’b’)
{digitalWrite(3,HIGH);}

if(digitalRead(2)==HIGH && dato==’a’)
{digitalWrite(3,HIGH);}

if(digitalRead(2)==HIGH && dato==’b’)
{digitalWrite(3,LOW);}

}

Code of the second microcontroller:

void setup() {
// put your setup code here, to run once:

pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,OUTPUT);
digitalWrite(4,LOW);
}

void loop() {
// put your main code here, to run repeatedly:

if(digitalRead(2)==LOW && digitalRead(3)==LOW)
{digitalWrite(4,LOW);}

if(digitalRead(2)==LOW && digitalRead(3)==HIGH)
{digitalWrite(4,HIGH);}

if(digitalRead(2)==HIGH && digitalRead(3)==LOW)
{digitalWrite(4,HIGH);}

if(digitalRead(2)==HIGH && digitalRead(3)==HIGH)
{digitalWrite(4,LOW);}

}

 

 

Anuncio publicitario

8 comentarios en “My Project For the Course TC1017 and Expo Ing

Deja una respuesta

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Salir /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s