SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Magnetic Door Lock employing Arduino
             Technology
Abstract




 The Magnetic Door lock is a simple locking device that consists of a magnetic lock and armature plate
with no moving parts and it purely works due to the magnetic field. Therefore the magnetic lock is truly
fail-safe (Power to lock). Thus, the magnetic lock is met with both security and fire safety requirements
   and is available for emergency exit doors. While the magnetic door lock might be quite a simplistic
 locking device, but the efficiency of the locking gadget can certainly not be denied. The purpose of this
paper is to design Magnetic Door Lock employing Arduino Technology. Magnetic lock or mag lock uses
an electrical current to produce a magnetic force. When a current is passed through the coil, the magnet
    lock becomes magnetized. The door will be securely bonded when the electromagnet is energized
    holding against the armature plate. Access control systems are operated by peripheral device (ie.
     keypad reader here ) to identify the user whether access is permitted or not. The power will be
    automatically turned off by the user and gains access through a reader. The objective of the work
   undertaken in this paper is to sense the correctness of a secret code using the Arduino technology.
I.INTRODUCTION                                            II.DESCRIPTION ABOUT THE
THIS section gives a brief introduction about the work,
                                                          MICROCONTROLLER
which describes all the components namely Magnetic
                                                          This section gives a brief idea about the
Door Lock, Arudino platform, Atmeg168. Followed by
design of Magnetic Door Lock by Arudino                   ATMEGA168 microcontroller its core features,
Technology.                                               block diagram, pin diagram and its description.

Door locks are certainly considered to be the basic       A. INTRODUCTION
modes of the everyday household door and                  Circumstances that we find ourselves today in the
keeping this fact in mind, door locks hold an             field of microcontrollers had their beginnings in
immense importance for the protection of doors.           the development of technology of integrated
While the magnetic door lock might be quite a             circuits. This development had made it possible to
simplistic locking device, but the efficiency of the      store hundreds of thousands of transistors into one
locking gadget can certainly not be denied.               chip. That was a prerequisite for production of
Magnetic Door Lock employing Arduino                      microcontrollers, and adding external peripherals
Technology. The main aim of the work                      such as memory, input-output lines, timers and
undertaken in this paper is to sense the correctness      other made the first computers. Further increasing
of a secret code using the Arduino technology.            of the volume of the package resulted in creation
When the correct code is entered through keypad,          of integrated circuits. These integrated circuits
it lights a green LED in addition to operating a          contained both processor and peripherals. That is
small solenoid which when powered, will strongly          how the first chip containing a microcomputer, or
attract the metal slug in its center, pulling it into     what would later be known as a microcontroller
place, when the power is removed, it is free to           came out .
move.
                                                          B. MICROCONTROLLER VERSUS
Arduino is an open-source electronics prototyping         MICROPROCESSORS
platform based on flexible, easy-to-use hardware          Microcontroller differs from a microprocessor in many
and software. Arduino can sense the environment           ways. First and the most important is its
by receiving input from a variety of sensors and          functionality. In order for a microprocessor to be
can affect its surroundings by controlling lights,        used, other components such as memory, or
motors, and other actuators. The microcontroller          components for receiving and sending data must
on the board is programmed using the Arduino              be added to it. In sort that means that
programming language (based on Wiring) and the            microprocessor is the very heart of the computer.
Arduino development environment (based                    On the other and , microcontroller is designed to
on Processing). Arduino projects can be stand-            be all of that in one. No other external
alone or they can communicate with software               components are needed for its application because
running on a computer (e.g. Flash,                        all necessary peripherals are already built in to it.
Processing, MaxMSP).                                      Thus, we save the time and space needed to
Arduino is a small microcontroller board with a           construct devices.
USB plug to connect to your computer and a
number of connection sockets that can be wired            C. ATMEL ATMEGA168
up to external electronics, such as motors, relays,
                                                          MICROCONTROLLER
light sensors, laser diodes, loudspeakers,
                                                          Overview:ATmega168 is widely used because it
microphones, etc. They can either be powered
                                                          supports wide range of system development tools
through the USB connection from the computer or
                                                          such as C Compliers, Macro assemblers, Program
from a 9V battery. They can be controlled from
                                                          Debugger/Simulators, In-circuit Emulators and
the computer or programmed by the computer and
                                                          Evaluation Kits . Its features includes: 23 general
then disconnected and allowed to work
                                                          purpose I/O lines, 32 general purpose working
independently. Since the Arduino is an open-
                                                          registers, three flexible timer/counters with
source hardware design,anyone is free to take the
                                                          compare/capture/PWM mode, a SPI serial port,
designs and create their own clones of the
                                                          16K bytes of in-system programmable Flash with
Arduino and sell them, so the market for the
                                                          Read-while-Write capabilities. 512 bytes of
boards is competitive.
                                                          EEPROM and 1K bytes SRAM. In Idle mode
CPU stops working while allowing the SRAM,           channel 10-bit ADC, a programmable watchdog
timers/counters, USART, SPI port and interrupt       timer with internal oscillator .
system to continue functioning. It also has 6

Description: The device is manufactured using        through an SPI serial interface, by a conventional
Atmel’s high-density non-volatile memory             non-volatile memory programmer, or by an on
technology.“The on-chip ISP flash allows the         chip boot program running the AVR core”.
program memory to be reprogrammed in-system
                                                     Depending on the clock selection fuse settings,
                                                     PB6 can be used as input to the inverting
                                                     oscillator amplifier and input to the internal clock
                                                     operating circuit Depending on the clock selection
                                                     fuse settings, PB7 can be used as output from
                                                     inverting oscillating amplifier
                                                     PORT C (PC5:0)
                                                             Port C is a 7-bit bi-directional I/O port
                                                     with internal pull-up resistors. As inputs, Port C
                                                     pins that are externally pulled low will source
                                                     current if the pull-up resistors are activated
                                                     PC6/RESET If the RSTDISBL register is
                                                     programmed, PC6 is used as I/O pin. Behavior of
                                                     PC6 is different from other Port C pins. If
                                                     RSTDISBL is not programmed, PC6 can be used
                                                     as a Reset input. A low level on this pin for longer
                                                     than the minimum pulse length will generate a
                                                     reset even without the clock signal. Shorter pulses
                                                     are not guaranteed to generate a Reset
                                                     PORT D (PD7:0)
                                                             Port D is an 8-bit bi-directional I/O port
                                                     with internal pull-up resistors. As inputs, Port C
                                                     pins that are externally pulled low will source
                                                     current if the pull-up resistors are activated. The
                                                     Port D pins become tri-stated if the reset condition
                                                     become active, even if the clock is running .
PIN Description:                                     AVCC
                                                              AVCC is the supply pin for the A/D
VCC                                                  Convertor, PC[5:0]. It should be externally
       Digital supply voltage.                       connected to VCC, even if the ADC is not used. If
GND                                                  the ADC is used it should be connected to VCC
       Ground voltage for the microcontroller        through low pass filter
chip.                                                AREF
 PORT B (PB7:0)                                              AREF is an analog reference pin for the
        Port B is an 8-bit bi-directional I/O Port   A/D convertor. XTAL1It is an input to the
with internal pull-up resistors. As Inputs, Port B   inverting oscillator amplifier and the internal
pins that are externally pulled low will source      clock circuit [2]. XTAL2It is an output pin from
current if the pull-up resistors are activated .     the inverting oscillator amplifier.
Oscillator Characteristics:
 As shown in Figure , XTAL1 is input and
XTAL2 is output of an inverting amplifier that
can be configured for use as an on-chip oscillator.
To use external oscillator as clock source, XTAL2
should be left unconnected while XTAL1 is
driven.
Quartz crystal or ceramic resonator can be used as
oscillator.




Block Diagram                                          ATmega168 CCP Modules
Figure below shows the block diagram of the            Each CCP (Capture/Compare/PWM) module
ATMEL ATmega168 microcontroller. The AVR               contains a 16-bit register which can be operate as
core has 32 general-purpose registers. All these       16-bit capture register, as a 16-bit compare
registers are directly connected to the Arithmetic     register or as a 16-bit PWM master/slave duty
Logic Unit (ALU), allowing two independent             cycle register. The CCP modules are identical in
registers to be accessed in 20 one single              operation, with the exception of the operation of
instruction executed in one clock cycle. The           the special event trigger .Most registers and bit
resulting architecture is code efficient. The device   references for this IC are written in general form.
is manufactured using Atmel’s high-density non-        For example, a lower case “n” replaces the
volatile memory technology.                            Timer/Counter number, and a lower case “x”
                                                       replaces the output compare unit channel. When
                                                       these registers or bits are defined in a program,
                                                       they are declared as TCNT2 for accessing
                                                       Timer/Counter2 counter value and so on. Figure
                                                       below shows a block diagram for the 16-bit
                                                       Timer/Counter
•   Arduino can be used to develop interactive
                                                        objects, taking inputs from a variety of
Registers
                                                        switches or sensors, and controlling a
 • TCCR1A – Timer/Counter1 Control Register             variety of lights, motors, and other
   A                                                    physical outputs.
                                                    •    Arduino projects can be stand-alone, or
                                                        they can be communicate with software
                                                        running on your computer (e.g. Flash,
                                                        Processing, MaxMSP.)
                                                    •   The Arduino programming language is an
                                                        implementation of Wiring, a similar
Bit [7:6] – COM1A1:0 Compare Output Mode for            physical computing platform, which is
Channel A                                               based on the Processing multimedia
Bit [5:4] - COM1B1:0 Compare Output Mode for            programming environment.
Channel B
                                                        Advantages
• TCCR1B – Timer/Counter1 Control Register A
                                                    •   There are many other microcontrollers and
                                                        microcontroller platforms available for
                                                        physical computing. Parallax Basic Stamp,
                                                        Netmedia's BX-24, Phidgets, MIT's
                                                        Handyboard, and many others offer similar
                                                        functionality.
                                                    •   Inexpensive - Arduino boards are
                                                        relatively inexpensive compared to other
Bit [0:2] – CS[10:12] Clock Select Bits                 microcontroller platforms.
Bit [4:3] – WGM[13:12] Waveform Generation          •   Cross-platform - The Arduino software
Mode
These bits are used in conjunction with TCCR1A          runs on Windows, Macintosh OSX, and
Control Register bits                                   Linux operating systems.
WGM[11:10] to set the timer/counter mode as 8-      •   Simple, clear programming environment -
bit Fast PWM.                                           The Arduino programming environment is
                                                        easy-to-use for beginners, yet flexible
                  Arduino                               enough for advanced users to take
                                                        advantage of as well.
Introduction                                        •   Open source and extensible software- The
   •   Arduino is a tool for making computers           Arduino software is published as open
       that can sense and control more of the           source tools, available for extension by
       physical world than your desktop                 experienced programmers.
       computer.                                    •    The language can be expanded through
   •    It's an open-source physical computing          C++ libraries, and people wanting to
       platform based on a simple microcontroller       understand the technical details can make
       board, and a development environment for         the leap from Arduino to the AVR C
       writing software for the board.                  programming language on which it's
                                                        based.
Introduction to Arduino
             Duemilanove
                                                          Power
                                                          The Arduino Duemilanove can be powered via the
                                                          USB connection or with an external power supply.
                                                          The power source is selected automatically.
                                                          External (non-USB) power can come either from
                                                          an AC-to-DC adapter (wall-wart) or battery. The
                                                          adapter can be connected by plugging a 2.1mm
                                                          center-positive plug into the board's power jack.
                                                          Leads from a battery can be inserted in the Gnd
                                                          and Vin pin headers of the POWER connector.
                                                          The board can operate on an external supply of 6
                                                          to 20 volts. If supplied with less than 7V,
                                                          however, the 5V pin may supply less than five
                                                          volts and the board may be unstable. If using more
                                                          than 12V, the voltage regulator may overheat and
                                                          damage the board. The recommended range is 7 to
Overview                                                  12 volts.
The Arduino Duemilanove ("2009") is a
microcontroller board based on the ATmega168              The power pins are as follows:
or ATmega328. It has 14 digital input/output pins (of     VIN. The input voltage to the Arduino board
which 6 can be used as PWM outputs), 6 analog             when it's using an external power source (as
inputs, a 16 MHz crystal oscillator, a USB connection,    opposed to 5 volts from the USB connection or
a power jack, an ICSP header, and a reset button. It      other regulated power source). You can supply
contains everything needed to support the                 voltage through this pin, or, if supplying voltage
microcontroller; simply connect it to a computer with a   via the power jack, access it through this pin.
USB cable or power it with a AC-to-DC adapter or
                                                          5V. The regulated power supply used to power the
battery to get started.
                                                          microcontroller and other components on the
                                                          board. This can come either from VIN via an on-
Summary                                                   board regulator, or be supplied by USB or another
Microcontroller          ATmega168                        regulated 5V supply.
Operating Voltage        5V                               3V3. A 3.3 volt supply generated by the on-board
Input Voltage                                             FTDI chip. Maximum current draw is 50 mA.
                         7-12V                            GND. Ground pins.
(recommended)
Input Voltage (limits)   6-20V
                         14 (of which 6 provide           Memory
Digital I/O Pins
                         PWM output)
                                                          The ATmega168 has 16 KB of flash memory for
Analog Input Pins        6                                storing code (of which 2 KB is used for the
DC Current per I/O                                        bootloader); the ATmega328has 32 KB, (also with
                         40 mA
Pin                                                       2 KB used for the bootloader).
DC Current for 3.3V                                       The ATmega168 has 1 KB of SRAM and 512
                         50 mA                            bytes of EEPROM (which can be read and written
Pin
                         16 KB (ATmega168) or             with the EEPROM library. the ATmega328 has 2
                         32 KB (ATmega328) of             KB of SRAM and 1 KB of EEPROM.
Flash Memory
                         which 2 KB used by
                         bootloader
                         1 KB (ATmega168) or 2
SRAM
                         KB (ATmega328)
                         512 bytes (ATmega168)
EEPROM
                         or 1 KB (ATmega328)
Clock Speed              16 MHz
Input and Output
Each of the 14 digital pins on the Duemilanove can be   The mapping between Arduino pins and
used as an input or output,                                      ATmega168 ports
using pinMode(), digitalWrite(),
anddigitalRead() functions. They operate at 5
volts. Each pin can provide or receive a maximum
of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In
addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX)
and transmit (TX) TTL serial data. These pins are
connected to the corresponding pins of the FTDI
USB-to-TTL Serial chip.
External Interrupts: 2 and 3. These pins can be
configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See
the attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM
output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13
(SCK). These pins support SPI communication
using the SPI library.                                  Communication
LED: 13. There is a built-in LED connected to
digital pin 13. When the pin is HIGH value, the         The Arduino Duemilanove has a number of
LED is on, when the pin is LOW, it's off.               facilities for communicating with a computer,
The Duemilanove has 6 analog inputs, each of            another Arduino, or other microcontrollers.
which provide 10 bits of resolution (i.e. 1024          The ATmega168 and ATmega328 provide UART
different values). By default they measure from         TTL (5V) serial communication, which is
ground to 5 volts, though is it possible to change      available on digital pins 0 (RX) and 1 (TX). An
the upper end of their range using the AREF pin         FTDI FT232RL on the board channels this serial
and the analogReference() function.                     communication over USB and the FTDI
 Additionally, some pins have specialized               drivers (included with Windows version of the
functionality:                                          Arduino software) provide a virtual com port to
I2C: analog input pins A4 (SDA) and A5                  software on the computer.
(SCL). Support I2C (TWI) communication using             The Arduino software includes a serial monitor
the Wire library.                                       which allows simple textual data to be sent to and
                                                        from the Arduino board. The RX and
There are a couple of other pins on the board:          TX LEDs on the board will flash when data is
                                                        being transmitted via the FTDI chip and USB
AREF. Reference voltage for the analog inputs.          connection to the computer (but not for serial
                                                        communication on pins 0 and 1).A SoftwareSerial
Reset. Bring this line LOW to reset the                 library allows for serial communication on any of
microcontroller. Typically used to add a reset          the Duemilanove's digital pins.
button to shields which block the one on the            The ATmega168 and ATmega328 also
board.                                                  support I2C (TWI) and SPI communication. The
                                                        Arduino software includes a Wire library to
                                                        simplify use of the I2C bus.
Programming                                              USB Overcurrent Protection
The Arduino Duemilanove can be programmed                The Arduino Duemilanove has a resettable
with the Arduino software.                               polyfuse that protects your computer's USB ports
The ATmega168 or ATmega328 on the Arduino                from shorts and overcurrent. Although most
Duemilanove comes preburned with                         computers provide their own internal protection,
a bootloader that allows you to upload new code          the fuse provides an extra layer of protection. If
to it without the use of an external hardware            more than 500 mA is applied to the USB port, the
programmer. It communicates using the                    fuse will automatically break the connection until
original STK500protocol (reference, C header             the short or overload is removed.
files).You can also bypass the bootloader and
program the microcontroller through the ICSP (In-        Physical Characteristics
Circuit Serial Programming) header.
                                                         The maximum length and width of the
Automatic (Software) Reset                               Duemilanove PCB are 2.7 and 2.1 inches
                                                         respectively, with the USB connector and power
Rather then requiring a physical press of the reset      jack extending beyond the former dimension.
button before an upload, the Arduino                     Three screw holes allow the board to be attached
Duemilanove is designed in a way that allows it to       to a surface or case. Note that the distance
be reset by software running on a connected              between digital pins 7 and 8 is 160 mil (0.16"),
computer. One of the hardware flow control lines         not an even multiple of the 100 mil spacing of the
(DTR) of the FT232RL is connected to the reset           other pins.
line of the ATmega168 or ATmega328 via a 100
nanofarad capacitor. When this line is asserted
(taken low), the reset line drops long enough to
reset the chip. The Arduino software uses this
capability to allow you to upload code by simply
pressing the upload button in the Arduino
environment. This means that the bootloader can
have a shorter timeout, as the lowering of DTR
can be well-coordinated with the start of the
upload. This setup has other implications. When
the Duemilanove is connected to either a
computer running Mac OS X or Linux, it resets
each time a connection is made to it from software
(via USB). For the following half-second or so,
the bootloader is running on the Duemilanove.
While it is programmed to ignore malformed data
(i.e. anything besides an upload of new code), it
will intercept the first few bytes of data sent to the
board after a connection is opened. If a sketch
running on the board receives one-time
configuration or other data when it first starts,
make sure that the software with which it
communicates waits a second after opening the
connection and before sending this data.
The Duemilanove contains a trace that can be cut
to disable the auto-reset. The pads on either side
of the trace can be soldered together to re-enable
it. It's labeled "RESET-EN". You may also be
able to disable the auto-reset by connecting a 110
ohm resistor from 5V to the reset line; see this
forum thread for details.
Schematic Design
Arduino Varieties:
                                                  Applications




Arduino shields:
Add-on module to extend arduino’s capabilities.
Also called Daughterboard or Cape




          Communication Shields




                    Sensors
Design and Development of
Magnetic Door Lock

The main aim of the work undertaken in this paper
is to sense the correctness of a secret code using      COMPONENTS AND EQUIPMENT
the Arduino technology. When the correct code is
entered through keypad, it lights a green LED in        Arduino Diecimila or Duemilanove board or clone
addition to operating a small solenoid which            D1 Red 5-mm LED
when powered, will strongly attract the metal slug      D2 Green 5-mm LED
in its center, pulling it into place, when the power    R1-3 270 _ 0.5W metal film resistor
is removed, it is free to move. The secret code is      K1 4 x 3 keypad
stored in EEPROM, so if the power is                    0.1-inch header strip
disconnected, the code will not be lost. When           T1 BC548
powered, the solenoid will strongly attract the         5V solenoid (< 100 mA)
metal slug in its center, pulling it into place. When   D3 1N4004
the power is removed, it is free to move.




Keypads are normally arranged in a grid so that
when one of the keys is pressed, it connects a row
to a column. Figure beside shows a typical
arrangement for a 12-key keyboard with numbers
from 0 to 9 and * and # keys.
 The key switches are arranged at the intersection
of row-and-column wires. When a key is pressed,
it connects a particular row to a particular column.
By arranging the keys in a grid like this, it
means that we only need to use 7 (4 rows +
3columns) of our digital pins rather than 12 (one
for each key).
Figure beside shows how you can solder seven
                        pins from a pin header strip onto the keypad so
                        that you can then connect it to the breadboard. Pin
                        headers are bought in strips and can be easily
                        snapped to provide the number of pins required.




                        The solenoid is an inductive load and therefore
                        liable to generate a back EMF, which diode D3
                        protects against. The solenoid is controlled by T1,
                        so be careful to select a solenoid that will not
                        draw more than 100 mA, which is the maximum
                        collector current of the transistor. We are using a
                        very low power solenoid, and this would not keep
                        intruders out. If you are using a more substantial
                        solenoid, a BD139 transistor would be better. If
                        the solenoid can be mounted on the breadboard,
                        this is all well and good. If not, you will need to
                        attach leads to it that connect it to the breadboard.




Hardware

The schematic diagram
Software : The software for this project
#include <Keypad.h>                        locked = false;
#include <EEPROM.h>                        updateOutputs();
                                           }
char* secretCode = "1234";                 delay(100);
int position = 0;                          }
boolean locked = true;
const byte rows = 4;                       void updateOutputs()
const byte cols = 3;                       {
char keys[rows][cols] = {                  if (locked)
{'1','2','3'},                             {
{'4','5','6'},                             digitalWrite(redPin, HIGH);
{'7','8','9'},                             digitalWrite(greenPin, LOW);
{'*','0','#'}};                            digitalWrite(solenoidPin, HIGH);
byte rowPins[rows] = {2, 7, 6, 4};         }
byte colPins[cols] = {3, 1, 5};            else
                                           {
Keypad keypad = Keypad(makeKeymap(keys),   digitalWrite(redPin, LOW);
rowPins, colPins, rows, cols);             digitalWrite(greenPin, HIGH);
int redPin = 9;                            digitalWrite(solenoidPin, LOW);
int greenPin = 8;                          }
int solenoidPin = 10;                      }

void setup()                               void getNewCode()
{                                          {
pinMode(redPin, OUTPUT);                   flash();
pinMode(greenPin, OUTPUT);                 for (int i = 0; i < 4; i++ )
loadCode();                                {
flash();                                   char key;
updateOutputs();                           key = keypad.getKey();
}                                          while (key == 0)
                                           {
void loop()                                key = keypad.getKey();
{                                          }
char key = keypad.getKey();                flash();
if (key == '*' && ! locked)                secretCode[i] = key;
{                                          }
// unlocked and * pressed so change code   saveCode();
position = 0;                              flash();
getNewCode();                              flash();
updateOutputs();                           }
}
if (key == '#')                            void loadCode()
{                                          {
locked = true;                             if (EEPROM.read(0) == 1)
position = 0;                              {
updateOutputs();                           secretCode[0] = EEPROM.read(1);
}                                          secretCode[1] = EEPROM.read(2);
if (key == secretCode[position])           secretCode[2] = EEPROM.read(3);
{                                          secretCode[3] = EEPROM.read(4);
position ++;                               }
}                                          }
if (position == 4)
{
void saveCode()                                         EEPROM.write(3, secretCode[2]);
{                                                       EEPROM.write(4, secretCode[3]);
EEPROM.write(1, secretCode[0]);                         EEPROM.write(0, 1);
EEPROM.write(2, secretCode[1]);                         }
void flash()                                            delay(500);
{                                                       digitalWrite(redPin, LOW);
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(greenPin, LOW);
}

Since each character is exactly one byte in length,     and off will not reset it to 1234. Instead, you will
the code can be stored directly in the EEPROM           have to comment out the line:
memory. We use the first byte of EEPROM to              loadCode(); in the setup function, so that it
indicate if the code has been set. If it has not been   appears as shown here:
set, the code will default to 1234. Once the code       // loadCode();
has been set, the first EEPROM byte will be given
a value of 1.
                                                        Conclusion and future scope:
Putting It All Together
                                                        A Magnetic Door Lock employing Arduino
 Load the completed sketch and download it to the       technology is presented. We have implemented a
board . We can make sure everything is working          failsafe maglock, fail secure maglock also can be
by powering up our project and entering the code        implemented. Instead of keypad Reader using the
1234, at which point, the green LED should light        variety of sensors and shields various
and the solenoid release. We can then change the        combinations of Magnetic Door Lock can be
code to something a little less guessable by            produced and installed according to the
pressing the * key and then entering four digits for    requirements of any Industry.
the new code. The lock will stay unlocked until
we press the # key. If you forget your secret code,     References:
unfortunately, turning the power to the project on         •   http://arduino.cc/
                                                           •   ITP Physical Computing
                                                           •   http://www.ladyada.net
                                                           •   http://www.sparkfun.com
                                                           •   http://seeedstudio.com
                                                           •   http://coopermaa2nd.blogspot.com




By,
Sravanthi Rani Sinha S
09BD1A04A0

Mais conteúdo relacionado

Mais procurados

Project Report- RFID Based Automated Toll Collection System using Arduino @ A...
Project Report- RFID Based Automated Toll Collection System using Arduino @ A...Project Report- RFID Based Automated Toll Collection System using Arduino @ A...
Project Report- RFID Based Automated Toll Collection System using Arduino @ A...
Aman Gupta
 

Mais procurados (20)

Project Report- RFID Based Automated Toll Collection System using Arduino @ A...
Project Report- RFID Based Automated Toll Collection System using Arduino @ A...Project Report- RFID Based Automated Toll Collection System using Arduino @ A...
Project Report- RFID Based Automated Toll Collection System using Arduino @ A...
 
Home automation using IoT
Home automation using IoTHome automation using IoT
Home automation using IoT
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
Smart door project report shivnaresh likhar
Smart door project report shivnaresh likharSmart door project report shivnaresh likhar
Smart door project report shivnaresh likhar
 
AUTOMATIC RAILWAY GATE CONTROL SYSTEM
AUTOMATIC RAILWAY GATE CONTROL SYSTEMAUTOMATIC RAILWAY GATE CONTROL SYSTEM
AUTOMATIC RAILWAY GATE CONTROL SYSTEM
 
Boom barrier
Boom barrierBoom barrier
Boom barrier
 
Home Automation using Iot
Home Automation using IotHome Automation using Iot
Home Automation using Iot
 
Presentation on home automation
Presentation on home automationPresentation on home automation
Presentation on home automation
 
Timer programming for 8051 using embedded c
Timer programming for 8051 using embedded cTimer programming for 8051 using embedded c
Timer programming for 8051 using embedded c
 
Plc 4 abstract plc
Plc 4 abstract   plcPlc 4 abstract   plc
Plc 4 abstract plc
 
Sequential Logic
Sequential LogicSequential Logic
Sequential Logic
 
Report on Embedded Based Home security system
Report on Embedded Based Home security systemReport on Embedded Based Home security system
Report on Embedded Based Home security system
 
Smart card technology
Smart card technologySmart card technology
Smart card technology
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counter
 
Visitor counter
Visitor counterVisitor counter
Visitor counter
 
Security door lock system
Security door lock system Security door lock system
Security door lock system
 
Voice Control Home Automation
Voice Control Home AutomationVoice Control Home Automation
Voice Control Home Automation
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
 
Smart sensors and their Application
Smart sensors and their ApplicationSmart sensors and their Application
Smart sensors and their Application
 
Basics of ATmega32
Basics of ATmega32Basics of ATmega32
Basics of ATmega32
 

Destaque

Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
Sravanthi Sinha
 
Report on automatic door
Report on automatic doorReport on automatic door
Report on automatic door
Indira Kundu
 

Destaque (9)

Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
 
Mayank_Bluetooth Controlled Lock
Mayank_Bluetooth Controlled LockMayank_Bluetooth Controlled Lock
Mayank_Bluetooth Controlled Lock
 
Password based door locking system
Password based door locking systemPassword based door locking system
Password based door locking system
 
Report on automatic door
Report on automatic doorReport on automatic door
Report on automatic door
 
A minor project report HOME AUTOMATION USING MOBILE PHONES
A minor project report HOME AUTOMATION  USING  MOBILE PHONESA minor project report HOME AUTOMATION  USING  MOBILE PHONES
A minor project report HOME AUTOMATION USING MOBILE PHONES
 
HOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINOHOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINO
 
Presentation Smart Home With Home Automation
Presentation Smart Home With Home AutomationPresentation Smart Home With Home Automation
Presentation Smart Home With Home Automation
 
Home automation using android mobiles
Home automation using android mobilesHome automation using android mobiles
Home automation using android mobiles
 
My Final Year Project - Individual Control Home Automation System
My Final Year Project - Individual Control Home Automation SystemMy Final Year Project - Individual Control Home Automation System
My Final Year Project - Individual Control Home Automation System
 

Semelhante a Magnetic door lock

AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
Vivek Venugopal
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt main
eddy royappa
 
Office automation system using arduino
Office automation system using arduinoOffice automation system using arduino
Office automation system using arduino
Ashfaqul Haque John
 
Chapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptxChapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptx
khgh7
 

Semelhante a Magnetic door lock (20)

Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
Introduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptIntroduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).ppt
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
 
Contactless digital tachometer using microcontroller
Contactless digital tachometer using microcontroller Contactless digital tachometer using microcontroller
Contactless digital tachometer using microcontroller
 
Presentation
PresentationPresentation
Presentation
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Intro arduino
Intro arduinoIntro arduino
Intro arduino
 
Embedded system application
Embedded system applicationEmbedded system application
Embedded system application
 
embedded system and microcontroller
 embedded system and microcontroller embedded system and microcontroller
embedded system and microcontroller
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt main
 
Office automation system using arduino
Office automation system using arduinoOffice automation system using arduino
Office automation system using arduino
 
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauriArduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
 
1.Arduino Ecosystem.pptx
1.Arduino Ecosystem.pptx1.Arduino Ecosystem.pptx
1.Arduino Ecosystem.pptx
 
introduction of arduino and node mcu
introduction of arduino and node mcuintroduction of arduino and node mcu
introduction of arduino and node mcu
 
Chapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptxChapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptx
 
iot1&2.pdf
iot1&2.pdfiot1&2.pdf
iot1&2.pdf
 
Touch Switch (Smart Switches) by arduino Project report file
Touch Switch (Smart Switches) by arduino  Project  report fileTouch Switch (Smart Switches) by arduino  Project  report file
Touch Switch (Smart Switches) by arduino Project report file
 

Magnetic door lock

  • 1. Magnetic Door Lock employing Arduino Technology
  • 2. Abstract The Magnetic Door lock is a simple locking device that consists of a magnetic lock and armature plate with no moving parts and it purely works due to the magnetic field. Therefore the magnetic lock is truly fail-safe (Power to lock). Thus, the magnetic lock is met with both security and fire safety requirements and is available for emergency exit doors. While the magnetic door lock might be quite a simplistic locking device, but the efficiency of the locking gadget can certainly not be denied. The purpose of this paper is to design Magnetic Door Lock employing Arduino Technology. Magnetic lock or mag lock uses an electrical current to produce a magnetic force. When a current is passed through the coil, the magnet lock becomes magnetized. The door will be securely bonded when the electromagnet is energized holding against the armature plate. Access control systems are operated by peripheral device (ie. keypad reader here ) to identify the user whether access is permitted or not. The power will be automatically turned off by the user and gains access through a reader. The objective of the work undertaken in this paper is to sense the correctness of a secret code using the Arduino technology.
  • 3. I.INTRODUCTION II.DESCRIPTION ABOUT THE THIS section gives a brief introduction about the work, MICROCONTROLLER which describes all the components namely Magnetic This section gives a brief idea about the Door Lock, Arudino platform, Atmeg168. Followed by design of Magnetic Door Lock by Arudino ATMEGA168 microcontroller its core features, Technology. block diagram, pin diagram and its description. Door locks are certainly considered to be the basic A. INTRODUCTION modes of the everyday household door and Circumstances that we find ourselves today in the keeping this fact in mind, door locks hold an field of microcontrollers had their beginnings in immense importance for the protection of doors. the development of technology of integrated While the magnetic door lock might be quite a circuits. This development had made it possible to simplistic locking device, but the efficiency of the store hundreds of thousands of transistors into one locking gadget can certainly not be denied. chip. That was a prerequisite for production of Magnetic Door Lock employing Arduino microcontrollers, and adding external peripherals Technology. The main aim of the work such as memory, input-output lines, timers and undertaken in this paper is to sense the correctness other made the first computers. Further increasing of a secret code using the Arduino technology. of the volume of the package resulted in creation When the correct code is entered through keypad, of integrated circuits. These integrated circuits it lights a green LED in addition to operating a contained both processor and peripherals. That is small solenoid which when powered, will strongly how the first chip containing a microcomputer, or attract the metal slug in its center, pulling it into what would later be known as a microcontroller place, when the power is removed, it is free to came out . move. B. MICROCONTROLLER VERSUS Arduino is an open-source electronics prototyping MICROPROCESSORS platform based on flexible, easy-to-use hardware Microcontroller differs from a microprocessor in many and software. Arduino can sense the environment ways. First and the most important is its by receiving input from a variety of sensors and functionality. In order for a microprocessor to be can affect its surroundings by controlling lights, used, other components such as memory, or motors, and other actuators. The microcontroller components for receiving and sending data must on the board is programmed using the Arduino be added to it. In sort that means that programming language (based on Wiring) and the microprocessor is the very heart of the computer. Arduino development environment (based On the other and , microcontroller is designed to on Processing). Arduino projects can be stand- be all of that in one. No other external alone or they can communicate with software components are needed for its application because running on a computer (e.g. Flash, all necessary peripherals are already built in to it. Processing, MaxMSP). Thus, we save the time and space needed to Arduino is a small microcontroller board with a construct devices. USB plug to connect to your computer and a number of connection sockets that can be wired C. ATMEL ATMEGA168 up to external electronics, such as motors, relays, MICROCONTROLLER light sensors, laser diodes, loudspeakers, Overview:ATmega168 is widely used because it microphones, etc. They can either be powered supports wide range of system development tools through the USB connection from the computer or such as C Compliers, Macro assemblers, Program from a 9V battery. They can be controlled from Debugger/Simulators, In-circuit Emulators and the computer or programmed by the computer and Evaluation Kits . Its features includes: 23 general then disconnected and allowed to work purpose I/O lines, 32 general purpose working independently. Since the Arduino is an open- registers, three flexible timer/counters with source hardware design,anyone is free to take the compare/capture/PWM mode, a SPI serial port, designs and create their own clones of the 16K bytes of in-system programmable Flash with Arduino and sell them, so the market for the Read-while-Write capabilities. 512 bytes of boards is competitive. EEPROM and 1K bytes SRAM. In Idle mode
  • 4. CPU stops working while allowing the SRAM, channel 10-bit ADC, a programmable watchdog timers/counters, USART, SPI port and interrupt timer with internal oscillator . system to continue functioning. It also has 6 Description: The device is manufactured using through an SPI serial interface, by a conventional Atmel’s high-density non-volatile memory non-volatile memory programmer, or by an on technology.“The on-chip ISP flash allows the chip boot program running the AVR core”. program memory to be reprogrammed in-system Depending on the clock selection fuse settings, PB6 can be used as input to the inverting oscillator amplifier and input to the internal clock operating circuit Depending on the clock selection fuse settings, PB7 can be used as output from inverting oscillating amplifier PORT C (PC5:0) Port C is a 7-bit bi-directional I/O port with internal pull-up resistors. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated PC6/RESET If the RSTDISBL register is programmed, PC6 is used as I/O pin. Behavior of PC6 is different from other Port C pins. If RSTDISBL is not programmed, PC6 can be used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset even without the clock signal. Shorter pulses are not guaranteed to generate a Reset PORT D (PD7:0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins become tri-stated if the reset condition become active, even if the clock is running . PIN Description: AVCC AVCC is the supply pin for the A/D VCC Convertor, PC[5:0]. It should be externally Digital supply voltage. connected to VCC, even if the ADC is not used. If GND the ADC is used it should be connected to VCC Ground voltage for the microcontroller through low pass filter chip. AREF PORT B (PB7:0) AREF is an analog reference pin for the Port B is an 8-bit bi-directional I/O Port A/D convertor. XTAL1It is an input to the with internal pull-up resistors. As Inputs, Port B inverting oscillator amplifier and the internal pins that are externally pulled low will source clock circuit [2]. XTAL2It is an output pin from current if the pull-up resistors are activated . the inverting oscillator amplifier.
  • 5. Oscillator Characteristics: As shown in Figure , XTAL1 is input and XTAL2 is output of an inverting amplifier that can be configured for use as an on-chip oscillator. To use external oscillator as clock source, XTAL2 should be left unconnected while XTAL1 is driven. Quartz crystal or ceramic resonator can be used as oscillator. Block Diagram ATmega168 CCP Modules Figure below shows the block diagram of the Each CCP (Capture/Compare/PWM) module ATMEL ATmega168 microcontroller. The AVR contains a 16-bit register which can be operate as core has 32 general-purpose registers. All these 16-bit capture register, as a 16-bit compare registers are directly connected to the Arithmetic register or as a 16-bit PWM master/slave duty Logic Unit (ALU), allowing two independent cycle register. The CCP modules are identical in registers to be accessed in 20 one single operation, with the exception of the operation of instruction executed in one clock cycle. The the special event trigger .Most registers and bit resulting architecture is code efficient. The device references for this IC are written in general form. is manufactured using Atmel’s high-density non- For example, a lower case “n” replaces the volatile memory technology. Timer/Counter number, and a lower case “x” replaces the output compare unit channel. When these registers or bits are defined in a program, they are declared as TCNT2 for accessing Timer/Counter2 counter value and so on. Figure below shows a block diagram for the 16-bit Timer/Counter
  • 6. Arduino can be used to develop interactive objects, taking inputs from a variety of Registers switches or sensors, and controlling a • TCCR1A – Timer/Counter1 Control Register variety of lights, motors, and other A physical outputs. • Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.) • The Arduino programming language is an implementation of Wiring, a similar Bit [7:6] – COM1A1:0 Compare Output Mode for physical computing platform, which is Channel A based on the Processing multimedia Bit [5:4] - COM1B1:0 Compare Output Mode for programming environment. Channel B Advantages • TCCR1B – Timer/Counter1 Control Register A • There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others offer similar functionality. • Inexpensive - Arduino boards are relatively inexpensive compared to other Bit [0:2] – CS[10:12] Clock Select Bits microcontroller platforms. Bit [4:3] – WGM[13:12] Waveform Generation • Cross-platform - The Arduino software Mode These bits are used in conjunction with TCCR1A runs on Windows, Macintosh OSX, and Control Register bits Linux operating systems. WGM[11:10] to set the timer/counter mode as 8- • Simple, clear programming environment - bit Fast PWM. The Arduino programming environment is easy-to-use for beginners, yet flexible Arduino enough for advanced users to take advantage of as well. Introduction • Open source and extensible software- The • Arduino is a tool for making computers Arduino software is published as open that can sense and control more of the source tools, available for extension by physical world than your desktop experienced programmers. computer. • The language can be expanded through • It's an open-source physical computing C++ libraries, and people wanting to platform based on a simple microcontroller understand the technical details can make board, and a development environment for the leap from Arduino to the AVR C writing software for the board. programming language on which it's based.
  • 7. Introduction to Arduino Duemilanove Power The Arduino Duemilanove can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to Overview 12 volts. The Arduino Duemilanove ("2009") is a microcontroller board based on the ATmega168 The power pins are as follows: or ATmega328. It has 14 digital input/output pins (of VIN. The input voltage to the Arduino board which 6 can be used as PWM outputs), 6 analog when it's using an external power source (as inputs, a 16 MHz crystal oscillator, a USB connection, opposed to 5 volts from the USB connection or a power jack, an ICSP header, and a reset button. It other regulated power source). You can supply contains everything needed to support the voltage through this pin, or, if supplying voltage microcontroller; simply connect it to a computer with a via the power jack, access it through this pin. USB cable or power it with a AC-to-DC adapter or 5V. The regulated power supply used to power the battery to get started. microcontroller and other components on the board. This can come either from VIN via an on- Summary board regulator, or be supplied by USB or another Microcontroller ATmega168 regulated 5V supply. Operating Voltage 5V 3V3. A 3.3 volt supply generated by the on-board Input Voltage FTDI chip. Maximum current draw is 50 mA. 7-12V GND. Ground pins. (recommended) Input Voltage (limits) 6-20V 14 (of which 6 provide Memory Digital I/O Pins PWM output) The ATmega168 has 16 KB of flash memory for Analog Input Pins 6 storing code (of which 2 KB is used for the DC Current per I/O bootloader); the ATmega328has 32 KB, (also with 40 mA Pin 2 KB used for the bootloader). DC Current for 3.3V The ATmega168 has 1 KB of SRAM and 512 50 mA bytes of EEPROM (which can be read and written Pin 16 KB (ATmega168) or with the EEPROM library. the ATmega328 has 2 32 KB (ATmega328) of KB of SRAM and 1 KB of EEPROM. Flash Memory which 2 KB used by bootloader 1 KB (ATmega168) or 2 SRAM KB (ATmega328) 512 bytes (ATmega168) EEPROM or 1 KB (ATmega328) Clock Speed 16 MHz
  • 8. Input and Output Each of the 14 digital pins on the Duemilanove can be The mapping between Arduino pins and used as an input or output, ATmega168 ports using pinMode(), digitalWrite(), anddigitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions: Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip. External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details. PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library. Communication LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the The Arduino Duemilanove has a number of LED is on, when the pin is LOW, it's off. facilities for communicating with a computer, The Duemilanove has 6 analog inputs, each of another Arduino, or other microcontrollers. which provide 10 bits of resolution (i.e. 1024 The ATmega168 and ATmega328 provide UART different values). By default they measure from TTL (5V) serial communication, which is ground to 5 volts, though is it possible to change available on digital pins 0 (RX) and 1 (TX). An the upper end of their range using the AREF pin FTDI FT232RL on the board channels this serial and the analogReference() function. communication over USB and the FTDI Additionally, some pins have specialized drivers (included with Windows version of the functionality: Arduino software) provide a virtual com port to I2C: analog input pins A4 (SDA) and A5 software on the computer. (SCL). Support I2C (TWI) communication using The Arduino software includes a serial monitor the Wire library. which allows simple textual data to be sent to and from the Arduino board. The RX and There are a couple of other pins on the board: TX LEDs on the board will flash when data is being transmitted via the FTDI chip and USB AREF. Reference voltage for the analog inputs. connection to the computer (but not for serial communication on pins 0 and 1).A SoftwareSerial Reset. Bring this line LOW to reset the library allows for serial communication on any of microcontroller. Typically used to add a reset the Duemilanove's digital pins. button to shields which block the one on the The ATmega168 and ATmega328 also board. support I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus.
  • 9. Programming USB Overcurrent Protection The Arduino Duemilanove can be programmed The Arduino Duemilanove has a resettable with the Arduino software. polyfuse that protects your computer's USB ports The ATmega168 or ATmega328 on the Arduino from shorts and overcurrent. Although most Duemilanove comes preburned with computers provide their own internal protection, a bootloader that allows you to upload new code the fuse provides an extra layer of protection. If to it without the use of an external hardware more than 500 mA is applied to the USB port, the programmer. It communicates using the fuse will automatically break the connection until original STK500protocol (reference, C header the short or overload is removed. files).You can also bypass the bootloader and program the microcontroller through the ICSP (In- Physical Characteristics Circuit Serial Programming) header. The maximum length and width of the Automatic (Software) Reset Duemilanove PCB are 2.7 and 2.1 inches respectively, with the USB connector and power Rather then requiring a physical press of the reset jack extending beyond the former dimension. button before an upload, the Arduino Three screw holes allow the board to be attached Duemilanove is designed in a way that allows it to to a surface or case. Note that the distance be reset by software running on a connected between digital pins 7 and 8 is 160 mil (0.16"), computer. One of the hardware flow control lines not an even multiple of the 100 mil spacing of the (DTR) of the FT232RL is connected to the reset other pins. line of the ATmega168 or ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload. This setup has other implications. When the Duemilanove is connected to either a computer running Mac OS X or Linux, it resets each time a connection is made to it from software (via USB). For the following half-second or so, the bootloader is running on the Duemilanove. While it is programmed to ignore malformed data (i.e. anything besides an upload of new code), it will intercept the first few bytes of data sent to the board after a connection is opened. If a sketch running on the board receives one-time configuration or other data when it first starts, make sure that the software with which it communicates waits a second after opening the connection and before sending this data. The Duemilanove contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for details.
  • 11. Arduino Varieties: Applications Arduino shields: Add-on module to extend arduino’s capabilities. Also called Daughterboard or Cape Communication Shields Sensors
  • 12. Design and Development of Magnetic Door Lock The main aim of the work undertaken in this paper is to sense the correctness of a secret code using COMPONENTS AND EQUIPMENT the Arduino technology. When the correct code is entered through keypad, it lights a green LED in Arduino Diecimila or Duemilanove board or clone addition to operating a small solenoid which D1 Red 5-mm LED when powered, will strongly attract the metal slug D2 Green 5-mm LED in its center, pulling it into place, when the power R1-3 270 _ 0.5W metal film resistor is removed, it is free to move. The secret code is K1 4 x 3 keypad stored in EEPROM, so if the power is 0.1-inch header strip disconnected, the code will not be lost. When T1 BC548 powered, the solenoid will strongly attract the 5V solenoid (< 100 mA) metal slug in its center, pulling it into place. When D3 1N4004 the power is removed, it is free to move. Keypads are normally arranged in a grid so that when one of the keys is pressed, it connects a row to a column. Figure beside shows a typical arrangement for a 12-key keyboard with numbers from 0 to 9 and * and # keys. The key switches are arranged at the intersection of row-and-column wires. When a key is pressed, it connects a particular row to a particular column. By arranging the keys in a grid like this, it means that we only need to use 7 (4 rows + 3columns) of our digital pins rather than 12 (one for each key).
  • 13. Figure beside shows how you can solder seven pins from a pin header strip onto the keypad so that you can then connect it to the breadboard. Pin headers are bought in strips and can be easily snapped to provide the number of pins required. The solenoid is an inductive load and therefore liable to generate a back EMF, which diode D3 protects against. The solenoid is controlled by T1, so be careful to select a solenoid that will not draw more than 100 mA, which is the maximum collector current of the transistor. We are using a very low power solenoid, and this would not keep intruders out. If you are using a more substantial solenoid, a BD139 transistor would be better. If the solenoid can be mounted on the breadboard, this is all well and good. If not, you will need to attach leads to it that connect it to the breadboard. Hardware The schematic diagram
  • 14. Software : The software for this project #include <Keypad.h> locked = false; #include <EEPROM.h> updateOutputs(); } char* secretCode = "1234"; delay(100); int position = 0; } boolean locked = true; const byte rows = 4; void updateOutputs() const byte cols = 3; { char keys[rows][cols] = { if (locked) {'1','2','3'}, { {'4','5','6'}, digitalWrite(redPin, HIGH); {'7','8','9'}, digitalWrite(greenPin, LOW); {'*','0','#'}}; digitalWrite(solenoidPin, HIGH); byte rowPins[rows] = {2, 7, 6, 4}; } byte colPins[cols] = {3, 1, 5}; else { Keypad keypad = Keypad(makeKeymap(keys), digitalWrite(redPin, LOW); rowPins, colPins, rows, cols); digitalWrite(greenPin, HIGH); int redPin = 9; digitalWrite(solenoidPin, LOW); int greenPin = 8; } int solenoidPin = 10; } void setup() void getNewCode() { { pinMode(redPin, OUTPUT); flash(); pinMode(greenPin, OUTPUT); for (int i = 0; i < 4; i++ ) loadCode(); { flash(); char key; updateOutputs(); key = keypad.getKey(); } while (key == 0) { void loop() key = keypad.getKey(); { } char key = keypad.getKey(); flash(); if (key == '*' && ! locked) secretCode[i] = key; { } // unlocked and * pressed so change code saveCode(); position = 0; flash(); getNewCode(); flash(); updateOutputs(); } } if (key == '#') void loadCode() { { locked = true; if (EEPROM.read(0) == 1) position = 0; { updateOutputs(); secretCode[0] = EEPROM.read(1); } secretCode[1] = EEPROM.read(2); if (key == secretCode[position]) secretCode[2] = EEPROM.read(3); { secretCode[3] = EEPROM.read(4); position ++; } } } if (position == 4) {
  • 15. void saveCode() EEPROM.write(3, secretCode[2]); { EEPROM.write(4, secretCode[3]); EEPROM.write(1, secretCode[0]); EEPROM.write(0, 1); EEPROM.write(2, secretCode[1]); } void flash() delay(500); { digitalWrite(redPin, LOW); digitalWrite(redPin, HIGH); digitalWrite(greenPin, HIGH); digitalWrite(greenPin, LOW); } Since each character is exactly one byte in length, and off will not reset it to 1234. Instead, you will the code can be stored directly in the EEPROM have to comment out the line: memory. We use the first byte of EEPROM to loadCode(); in the setup function, so that it indicate if the code has been set. If it has not been appears as shown here: set, the code will default to 1234. Once the code // loadCode(); has been set, the first EEPROM byte will be given a value of 1. Conclusion and future scope: Putting It All Together A Magnetic Door Lock employing Arduino Load the completed sketch and download it to the technology is presented. We have implemented a board . We can make sure everything is working failsafe maglock, fail secure maglock also can be by powering up our project and entering the code implemented. Instead of keypad Reader using the 1234, at which point, the green LED should light variety of sensors and shields various and the solenoid release. We can then change the combinations of Magnetic Door Lock can be code to something a little less guessable by produced and installed according to the pressing the * key and then entering four digits for requirements of any Industry. the new code. The lock will stay unlocked until we press the # key. If you forget your secret code, References: unfortunately, turning the power to the project on • http://arduino.cc/ • ITP Physical Computing • http://www.ladyada.net • http://www.sparkfun.com • http://seeedstudio.com • http://coopermaa2nd.blogspot.com By, Sravanthi Rani Sinha S 09BD1A04A0