Upload
apoorv-gupta
View
459
Download
0
Embed Size (px)
Citation preview
SUMMER INTERNSHIP REPORT
SUBMITTED BY: AAKASH TIWARI APOORV GUPTA ANURAG NANDAN GAURAV PRASAD
EMBEDDED SYSTEMS & ROBOTICS FROM
I3INDYA
COMPANY PROFILE• i3indya™ Technologies ( A unit of I THREE INFOTECH PVT
LTD ) with its foundation pillars as Innovation, Information and Intelligence is exploring indefinitely as a Technology service provider and as a Training Organization.
• i3indya™ was started by a group of entrepreneurs with a sole mission of establishing a dedicated Research & Development Cell and bringing the findings to the benefit of budding Engineers. Little did they know that their efforts will bring an enormous change in the world of technology & training. Today in just four years of its existence, i3indya™ has a pan India acclaim for its unmatched quality services.
BLUETOOTH BASED HOME AUTOMATION SYSTEM
WHAT IS HOME AUTOMATION?
Home automation is the control of electrical/electronic appliances reducing human effort. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security. Home automation for the elderly and disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care. The popularity of home automation has been increasing greatly in recent years due to much higher affordability and simplicity through smartphone and tablet connectivity.
SYSTEM OVERVIEW
COMPONENTS• A microcontroller board(ATmega8)• A 9v adaptor• A no. of relays• ULN2803 for driving relays• A power supply circuit• A cell-phone running Android OS• And most importantly Bluetooth module
ATMEGA8L Features• High Performance, Low-power AVR 8-bit Microcontroller.• Advanced RISC Architecture– 130 Powerful Instructions– Most Single-clock Cycle Execution– 32 x 8 General Purpose Working Registers– Fully Static Operation– Up to 16 MIPS Throughput at 16 MHz• Nonvolatile Program and Data Memories– 8K Bytes of In-System Self-Programmable Flash– 512 Bytes EEPROM– 1K Byte Internal SRAM
FEATURES• I/O and Packages– 23 Programmable I/O Lines• Operating Voltages– 4.5 - 5.5V• Speed Grades– 0 - 16 MHz• Special Microcontroller Features– Internal Calibrated RC Oscillator– External and Internal Interrupt Sources
Pin Configurations
Pin Descriptions• VCC : Digital supply voltage.• GND : Ground.• Port B (PB7..PB0) : Port B is an 8-bit bi-directional I/O port
with internal pull-up resistors (selected for each bit). • Port C (PC5..PC0)/(ADC5..ADC0): Port C is an 7-bit bi-
directional I/O port with internal pull-up resistors (selected for each bit).These pins also serve as analog inputs to the A/D converter .
• PC6/RESET: If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input.
• Port D (PD7..PD0): Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
• AVCC : AVCC is the supply voltage pin for the A/D Converter. It should be externally connected to VCC, even if the ADC is not used.
• AREF: AREF is the analog reference pin for the A/D Converter. AREF is used to set the TOP value for Analog to Digital conversion.
WHAT’S A RELAY?• A relay is an electrically operated switch. Relays are used
where it is necessary to control a circuit by a low-power signal with complete electrical isolation between control and controlled circuits, or where several circuits must be controlled by one signal.
• In this figure, you can see that relay consist of two separate and completely independent Circuit (1-3 & 2-4). When the electromagnet is ON, and it attracts the armature. The armature is acting as a switch in the second circuit.
• When the electromagnet is energized, the armature completes the second circuit and the light is ON and vice-versa.
TO DRIVE A RELAY…
• To drive a relay, we need the ULN2803A IC which is a high-voltage, high-current Darlington transistor array. The device consists of eight NPN-Darlington pairs that feature high-voltage outputs for switching inductive loads. The collector-current rating of each Darlington pair is 500 mA.
• Applications include relay drivers, lamp drivers, etc. The ULN2803A has a 2.7-kΩ series base resistor for each Darlington pair for operation directly with TTL or 5-V CMOS devices.
POWER SUPPLY
The above shown circuit is used to provide 5v regulated DC power supply for our Home Automation circuit. This circuit uses a 7805 5v regulator IC which is used to step down higher DC voltages to +5v DC voltage. Two different capacitors are used in this circuit to bypass any AC voltage component present.
ANDROID SMARTPHONE• Any smartphone with any version of Android installed on it
will do the task.• We are using an Android application named “Bluetooth
Terminal” which can be easily found on Google Play Store and installed on the phone.
BLUETOOTH TERMINAL• Bluetooth Terminal is an Android application that is a VT-100 terminal emulator for communicating with serial devices using a Bluetooth module.
• One can download this application from here https://play.google.com/store/apps/details?id=es.pymasde.blueterm&hl=en
HC-05 Bluetooth Module
Description• The Bluetooth module used in this project is HC-05 Linvor
Bluetooth module.• It is an easy- to-use Bluetooth serial port protocol (SPP)
module, designed for a transparent wireless serial connection set-up.
• The module has 34 PINS for configuration/interfacing of Bluetooth module with microcontrollers.
• Bluetooth Serial module can communicate with the other Bluetooth devices but requires at least two conditions:
(1) The communication must be between master and slave. (2) The password must be correct.
Pins Description• PIN1: UART_TXD, Bluetooth serial signal sending PIN, can
connect with MCU’s RXD PIN• PIN2:UART_RXD, Bluetooth serial signal receiving PIN, can
connect with the MCU’s TXD PIN• PIN11:RESET, the reset PIN of module• PIN12:VCC, voltage supply for logic, the standard voltage is
3.3V• PIN13:GND• PIN 31:It is used to indicate module state.• PIN32:Used to control LED indicating pairing. It will be steady
on when pairing is successful.
Hardware details• Built-in CSR company Bluetooth chip BC417143.• Bluetooth Technology v2.0+EDR.• Coverage up to 30 ft/10 m.• Built-in antenna.• Power input: +3.3V DC.• The maximum serial baud rate: 1382400 bps.• Connection/non-connection status indicator.• Frequency: 2.4GHz ISM band• Modulation: FSK (Frequency Shift Keying)• Emission power: ≤4dBm, Class 2• Speed: Asynchronous: 2.1Mbps (max.)/160 kbps• Dimensions: 26.9mm×13mm× 2.2mm
Communication between Smartphone and MCU
• Start the Bluetooth manager(e.g. Bluetooth Terminal available on Google play Store).
• Connect device(should find module).• Pair.• Send Commands from phone.• See the magic being done.
THE MOST IMPORTANT PART
THE UART/USART COMMUNICATION
USART/UART UART stands for Universal Asynchronous Receiver/Transmitter
UART helps to communicate with:-• Another microcontroller• Multiple microcontrollers• Computer using a voltage level shifter or converter• Other devices that are compatible with USART/UART
WHAT DOES UART DO? UART can :-• Transmit data using a buffer and a shift register• Receive data using a shift register and buffer• Create a frame of data that is recognised on both the receiving end and the transmitting end.
All of this, works according to an agreed upon speed from both sides, or with synchronous mode where the clock line is directly connected.
Transmission/Reception in UART
Data to be transmitted
Data sent to a buffer
Data is sent to shift register
Data moves along
transmit wire
• This is how transmission is done.• Receiving information is done in the reverse order
of transmission.
CLOCK MODES UCSRC=(1<<UMSEL);//setting the UMSEL bit to 1 for synchronous mode
UCSRC&=~(1<<UMSEL);//setting the UMSEL bit to 0 for asynchronous mode
Baud Rate-the driving force The baud is the clock that pushes the data along the line.
In USART, a clock wire must be connected between each microcontroller. This wire will pulse like a heartbeat. In the case of asynchronous(UART), each microcontroller has its own clock, the clock(baud rate) at transmitter and receiver end must be same i.e. the receiving microcontroller must be receiving data at the same pace at which it is transmitted.
Initializing the UARTFunction to initialize the UART :- void UART_INIT(unsigned int baud)
UBBRH=(unsigned char)(baud>>8);UBBRL=(unsigned char)baud;
//Enable the receiver and transmitterUSCRB=(1<<RXEN)|(1<<TXEN);UCSRC=(1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
• When TXEN is set(Transmitter enabled), the general purpose function of that pin is not available until TXEN is disabled. Same idea goes for RXEN pin.
TRANSMISSON void UART_Transmit(unsigned int data) while(!(UCSRA&(1<<UDRE)));//wait until the transmitter is readyUDR=data;//transmit that data out of here
RECEPTION
Function for receiving :- unsigned char UART_Receive(void) while(!(UCSRA&(1<<RXC)); //wait for RXC to not have 0 return UDR; //get that data out of there and back to the main program
UART I/O Data Register-UDR
UART Control and Status Register A-UCSRA
REGISTERS
UART Control and Status Register B – UCSRB
UART Control and Status Register C – UCSRC
UART Baud Rate Registers – UBRRL and UBRRHs
SCHEMATIC
PCB LAYOUT• To the left is the actual PCB
layout of the product.• This shows both the
bottom and top copper layers.
• This image also shows the silkscreen for placing the components on the PCB.
• The actual product contains all of the above mentioned/explained components.
• These components are soldered on a home made PCB(printed circuit board).
• The product needs some improvisation will be ready to install at home/office.
• The home automation board has small dimensions and can be easily installed by any electrician.
SOME PICS
THANKSFOR
WATCHING