Introduction: Car Central Lock by Nfc Tech

Picture of Car Central Lock by Nfc Tech

INTRODUCTION

By using your smart phone you can lock or unlock your car. To lock your car touch your phone to car body and to unlock again touch your phone to car body. The advantage of nfc car central lock is its security. Also a siren is attached If anybody attempt to unlock the vehicle. If those who don't have nfc in smart phone a smart tag can attach to their mobile phone battery.In this project i used nfc technology to communicate between your car and your phone.

Details

Near-field communication (NFC) is a set of communication protocols that enable two electronic devices, one of which is usually a portable device such as a smartphone, to establish communication by bringing them within about 5 cm (2 in) of each other.

NFC-equipped smartphones can be paired with NFC Tags or stickers that can be programmed by NFC apps. These programs can allow a change of phone settings, texting, app launching, or command execution.

Activating nfc in phone

Go to Settings > More. Tap on the NFC switch to activate it. The Android Beam function will also automatically turn on. If Android Beam does not automatically turn on, just tap it and select Yes to turn it on. Smartphones’ NFC capabilities operate in tandem with Android Beam. If Android Beam is disabled, it may limit NFC’s sharing capacity.

Step 1: Aruduino Uno

Picture of Aruduino Uno

Arduino/Genuino Uno is a microcontroller board based on the ATmega328P . It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller;

For uploading a sketch to an Arduino board that you can refer back to. Follow these steps to upload your sketch:

Download arduino software for uploading sketch

Connect your Arduino using the USB cable. The square end of the USB cable connects to your Arduino and the flat end connects to a USB port on your computer. Choose Tools→Board→Arduino Uno to find your board in the Arduino menu. You can also find all boards through this menu, such as the Arduino MEGA 2560 and Arduino Leonardo. Choose the correct serial port for your board. You find a list of all the available serial ports by choosing Tools→Serial Port→ comX or /dev/tty.usbmodemXXXXX. X marks a sequentially or randomly assigned number. In Windows, if you have just connected your Arduino, the COM port will normally be the highest number, such as com 3 or com 15. Many devices can be listed on the COM port list, and if you plug in multiple Arduinos, each one will be assigned a new number. On Mac OS X, the /dev/tty.usbmodem number will be randomly assigned and can vary in length, such as /dev/tty.usbmodem1421 or /dev/tty.usbmodem262471. Unless you have another Arduino connected, it should be the only one visible. Click the Upload button. This is the button that points to the right in the Arduino environment. You can also use the keyboard shortcut Ctrl+U for Windows or Cmd+U for Mac OS X.

Code i used for uploading arduino is as follows

#include "PN532_SPI.h"

#include "PN532.h"

#include "NfcAdapter.h"

#define FLAG_NONE 0

#define FLAG_IRQ_TRIGGERED 1

#define FLAG_RESET_IRQ 2

volatile int flags = FLAG_NONE;

String const myUID = "A6 C1 CD 93";

int const irqPin = 2;

int const ActuatorPin = 8;

int const LockPin = A3;

int const UnlockPin = A2;

int const sirenPin = 7;

PN532_SPI interface(SPI, 10);

NfcAdapter nfc = NfcAdapter(interface);

String scannedUID = "";

void setup(void) {

pinMode(LockPin, OUTPUT);

pinMode(UnlockPin, OUTPUT);

pinMode(sirenPin, OUTPUT);

pinMode(ActuatorPin, OUTPUT);

Serial.begin(115200);

nfc.begin();

digitalWrite(LockPin, LOW);

digitalWrite(UnlockPin, LOW);

digitalWrite(sirenPin, LOW);

//digitalWrite(ActuatorPin, LOW);

attachInterrupt(0, irq, FALLING); }

void loop(void) {

int flag = getFlag();

switch (flag) {

case FLAG_NONE:

break;

case FLAG_IRQ_TRIGGERED:

if (nfc.tagPresent()) {

NfcTag tag = nfc.read();

scannedUID = tag.getUidString();

if (myUID.compareTo(scannedUID) == 0) {

if (digitalRead(ActuatorPin) == HIGH) {

Serial.println("Locked");

digitalWrite(LockPin, HIGH);

delay (800);

digitalWrite (LockPin, LOW);

delay(5000);

} else {

Serial.println("UNlocked");

digitalWrite(UnlockPin, HIGH);

delay(800);

digitalWrite(UnlockPin, LOW);

delay(5000); }

} else {

Serial.println("sound");

digitalWrite(sirenPin, HIGH);

delay(3000);

}

setFlag(FLAG_NONE);

reset_PN532_IRQ_pin(); }

else {

setFlag(FLAG_NONE); }

break;

default:

break; } }

void setFlag(int flag) { flags = flag; }

int getFlag() {

return flags; }

void irq() { if (getFlag() == FLAG_NONE) {

setFlag(FLAG_IRQ_TRIGGERED); } }

void reset_PN532_IRQ_pin() {

nfc.tagPresent();

}

Step 2: PN532 NFC Module

Picture of PN532 NFC Module

Description :NFC is a popular technology in recent years. We often heard this work while smartphone company such as Samsung or HTC introduces their latest high-end phones. Almost all the high-end phone in the market support NFC.Near field communication (NFC) is a set of standards for smartphones and similar devices to establish radio communication with each other by touching them together or bringing them into close proximity, usually no more than a few centimeters.For electronics geeks, we also want to use NFC technology to make our own things. So we build this NFC RFID module. This module is built around NXP PN532. NXP PN532 is very popular in NFC area. And the company offers much technology document to help developers. We developed this module based on the official document. And to make things easier, we also build library for this module.We almost break out all the IO pins of NXP532 on this module. Users could easily connect and play. On this module, I2C is the data Interface by default. With our Arduino Sensor Shield, it is very easy to plug and play. However, if users want to use other interface such as UART or SPI, this module also makes it easy to break out those pins

.Feature :

1、Gilt PCB and Small dimension and easy to embed into your project

2、Support I2C、SPI and HSU (High Speed UART), Change between those modes

3、Support RFID reading and writing SupportP2P communication with peers Support NFC with Android phone

4、Typical Operating Distance have been updated to 5cm~7cm reading distance

5、Work in NFC Mode or RFID reader/writer Mode

6、RFID reader/writer supports:

a) Mifare 1k, 4k, Ultralight, and DesFire cards

b) ISO/IEC 14443-4 cards such as CD97BX, CD light, Desfire, P5CN072 (SMX)

c) Innovision Jewel cards such as IRT5001 card

d) FeliCa cards such as RCS_860 and RCS_854

7、Plug and play, Arduino compatible

8、Built in PCB Antenna, with 4cm~6cm communication distance

9、On-board level shifter, Standard 5V TTL for I2C and UART, 3.3V TTL SPI10、Work as RFID reader/writer11、Work as 1443-A card or a virtual card12、Exchange data with other NFC devices such as smartphoneInterface :The version 3 can support I2C、SPI and HSU (High Speed UART), there is a switch can help you to change interface between those modes easily.

Step 3: 5V Two 2 Channel Relay Module

Picture of 5V Two 2 Channel Relay Module

  • 5V 2-Channel Relay interface board, and each one needs 15-20mA Driver Current
  • Equiped with high-current relay,
  • AC250V 10A ; DC30V 10A
  • Standard interface that can be controlled directly by microcontroller (Arduino , 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic)
  • Indication LED's for Relay output status

Step 4: Power Module

Picture of Power Module

Features

Input voltage: DC 6.5~12V or USB powered;

Output voltage: 3.3V, 5V switch;Maximum output current:

Two down two independent control can be switched to 0V, 3.3V, 5V;

Step 5: Circuit Diagram

Picture of Circuit Diagram

Step 6: Circuit Diagram Between Relay and Arduino

Picture of Circuit Diagram Between Relay and Arduino

Step 7: Car Central Lock Wiring Diagram

Picture of Car Central Lock Wiring Diagram

car manufactures adopt various type of wiring diagrams example ..positve trigger ,negative trigger and both ...so be carefull about the car central lock wiring diagram...

Comments

marsekal (author)2017-10-01

good job mr..

mr.ats arduino mr

Swansong (author)2016-10-24

Thanks for sharing :)

About This Instructable

1,668views

25favorites

License:

More by saranath_sr:Car central lock by Nfc tech
Add instructable to: