Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad

Proyecto Final basado en microcontrolador Arduino Nano, Apuntes de Microcontroladores

Es el reporte realizado para proyecto final donde se evidencia el conocimiento aplicado para la resolución de una problemática mediante el uso de microcontroladores

Tipo: Apuntes

2020/2021

Subido el 08/08/2021

jose-adrian-macias-martinez
jose-adrian-macias-martinez 🇲🇽

1 documento

1 / 12

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
1
pf3
pf4
pf5
pf8
pf9
pfa

Vista previa parcial del texto

¡Descarga Proyecto Final basado en microcontrolador Arduino Nano y más Apuntes en PDF de Microcontroladores solo en Docsity!

SPECIFICATIONS

Apagador de luz de habitación touchless, se activará con un sensor ultrasónico que detecta la distancia de la mano, y enciende la luz, y al detectar de nuevo se apaga, además de que se puede conectar con Bluetooth a un celular y controlarse desde una aplicación.

WHAT IS THE SYSTEM ABOUT?

The circuit is constructed based on the microcontroller Arduino Nano. The objective is to turn on and turn off the lamp of a room in your house but without touching something. There are two ways to control the lamp of a room, the first one is an ultrasonic sensor that detects your hand when it’s at least 10 cm near the sensor, and this turns on or turns off the lamp. The second way is with an app in your cell phone, it must be connected to the system through Bluetooth, when you open the app in your cell phone, it shows two buttons to control the lamp, and some other buttons to connect your cellphone to the system.

SOURCE CODE

The source code of the microcontroller is showed then. #include <Wire.h> const int trigPin = 7; // define pin TRIGGER of ultrasonic sensor const int echoPin = 6; // define pin ECHO of ultrasonic sensor long duration; int distance; int lastDistance = 0; int state = 0; int led_1 = 13; // define digital output connected to the relay char value; //Variable to indicate an order received from BT void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led_1, OUTPUT);

if (value == 'B'||distance<=10 && state == 1) //if the data is an B, or if the distance from the sensor is less than 10cm, and the lamp is on. { digitalWrite(led_1, LOW); //turn off LED 1 state=0; //this variable shows that the lamp is off delay(500); } } }

DIAGRAMS OF CONNECTION OF THE SYSTEM

The diagram of the connection was made in the software Fritzing. This is because it has a lot of libraries and components to create schematic diagrams. In the following picture you can find a screenshot of that diagram.

The diagram shows the connection of all the components to the Arduino Nano. The first one is the Bluetooth module, it has four pins, two for the energy (Vcc and GND), the pin Rx of the module is connected to the Tx pin, and the Tx pin of the module HC-05 is connected to the Rx pin. The ultrasonic sensor HC-SR04 has four pins, two pins for the energy (Vcc and GND), and then the pin Echo and Trigger, connected to the pin 6 and 7 in order. Finally the relay module has three pins, two of them for the energy (Vcc and GND) where the Vcc can be connected to the 3.3v output of the Arduino, and the input of the module, connected to pin 13 as a digital output of the Arduino. Finally the lamp, one of the lines is connected to two pins of the relay module, one is connected to the Common pin and the other one to the NC pin.

TIPS TO INSTALL THE “TOUCH-LESS SENSOR” SYSTEM

Tips for using the system The only tip for the user is to be careful with the distance between your hand and the sensor, because the range of distance for the sensor to be activated is between 3cm and 10cm. Another tip is to be careful with the time that you spend your hand in front of the sensor, because if you let your hand too much time the light will blink. Tips for how to implement the system You need to prove all the components before install it, personally I prove the sensor first, I made a code to measure the distance and verify that the range was comfortable to the user, then I prove only the bluetooth module, and try to create an app friendly with the user and easy to understand and to use it. Tips for how to install the system Is very difficult to have a problem with the installation of the system because it’s divided in two parts, one of control, and the other one of power. It makes it harder to have a short circuit, but you can’t forget you’re working with a considerable voltage, so you have to isolate all the wires correctly to prevent any failure of the system.

PIN

RXD

UART_RXD,

Bluetooth serial

signal receiving

PIN

Connect with the MCU’s

(Microcontroller and etc) TXD

PIN.

KEY

Mode switch

input

If it is input low level or connect

to the air, the module is at paired

or communication mode. If it is

input high level, the module will

enter to AT mode.

REAL APPLICATION

Since March of 2020, Mexico live in a very difficult situation because of the Pandemic caused by the coronavirus SARS-COV2. This virus is very contagious. The virus can be contracted by the air if you don’t use a face mask. But it can be contracted too by touching contaminated objects, this is why the government incite the population to decontaminate the objects of common use, such as hardware in your house. The TOUCH-LESS SWITCH is a system that you can install in you house, or in your office. This device allows you to turn on and turn off the lamp of a room without touching anything, this keeps your hands free of bacteria and dirt. It works with an ultrasonic sensor that measure the distance between the emisor and an object in front. The system is programmed to work with a range of distance between 10 cm and 3 cm. It makes the work of using this more comfortable. TOUCH-LESS SWITCH has the option of being controlled by your cell phone, this is through an application that you can install in a cell phone with Android OS. The app shows on your screen some buttons, one of them gives you the option to connect with the system through your Bluetooth connectivity, the second has the function to disconnect the communication. There are two big buttons that control the lamp as a common switch.

The bigger advantage is that you don’t need to touch the switch to control the lamp of a room, it allows you to keep your hands clean for more time. Another advantage is that you can control the lamp of the room with your cellphone with a simple app. This system can be the beginning of turn your home into a smart house.

VIDEO

There is a video explaining the whole project and showing the functioning of the system implemented in a personal room. There is the link to see that video on Youtube: https://www.youtube.com/watch?v=H5K030MbyIs Final Project of Microcontrollers

TOTAL PROJECT COST

Then is showed a chart of the materials needed to make this system if you want to recreate it. For this time, the cost of the installation is nothing, because I installed this system in my personal room for my personal use, but if I have to install the system for another person, the cost of the installation plus the total price of the component is around $1’000.

COMPONENT AMOUNT PRICE DESCRIPTION

Arduino Nano 1 $140 Arduino Nano is a board to develop

projects of programming and

automation.

HC-05 1 $160 Bluetooth module to control the

Arduino board with any device

connected with this module.

In the next picture, is showed a photo of the system installed in my room.