0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

RFID和蓝牙门锁的制作

454398 来源:wv 2019-09-26 11:18 次阅读

步骤1:所需的零件

必需的零件。

1-带拇指的门锁打开门的内部

1-Arduino Uno r3(或兼容)

1-360度伺服系统

1-HC-06蓝牙模块

1-RC522 RFID阅读器(可能是Sintron,不记得了)

1-16 x 2-4线LDC屏幕

1-RGB LED

2-220Ω电阻器

1-瞬时按动开关(从内部操作以锁定/

1-1-1kΩ电阻

2-双后箱(1个约45mm深度,另一个约33mm深度)

跳线

电源(我打算使用2 x 9v电池,但已决定使用市电供电的9v电源,因为更可靠)

螺丝或坚固的双面胶带

1-伺服支架(我自己设计和印刷)

** ----------------等待发货-------- ------------------- ------------ **

2-双盲板

1-12芯报警电缆的长度(长度取决于放置位置)

2-5amp模块连接器(每个12线)

** --------------------------- -------------------------------------------------- ---- **

Andriod蓝牙锁应用程序。 BTControl.apk

步骤2:接线

RFID和蓝牙门锁的制作

电源:

9v稳压电源(或电池)

RFID读取器:

VCC-引脚3.3v

GND-GND

重置(RST)-引脚D9

SDA(SS)-引脚D10

MOSI-引脚D11

MISO-引脚D12

SCK-引脚D13

LCD屏幕

VCC-5v

GND-GND

SDA-引脚A4

SCL-引脚A5

瞬时开关:

VCC-5v(如上所示)

GND到1kΩ电阻(如上所示)

Pin 8 arduino(如上所示)

RGB LED:

将D7的220Ω电阻接至LED引脚(红色)

将D6的220Ω电阻接至LED引脚(绿色)

公共(长线)- GND

伺服:

VCC-5v

GND-GND

信号-引脚D5

蓝牙模块:

VCC-5v

GND -GND

TX-D0(RX)

RX-D1(TX)

Fritzing图:

步骤3:Pu一起努力

Arduino,蓝牙模块和瞬间开关+ RGB LED电路安装在45mm的底盒中。我刚刚使用Blu-Tac将它们固定在原位,因为一旦固定在墙上就不会移动。我已经将开关,LED和电阻器焊接到了电路板上,并在电路板的任何一侧创建了GND和VCC连接,还将放置一个用于12芯报警电缆的块连接器,以连接RFID和LCD屏幕到arduino。盖子上会钻2个孔,以容纳开关和引线。

RFID和LCD屏幕安装在33mm的后盖内,并开有一个插槽,用于LCD屏幕穿过。这些将通过12芯报警电缆和模块连接器连接到arduino。

为使伺服器连接到门锁,我3D打印了一个支架,该支架将拧紧到门上并连接到门上。

步骤4:代码-(于2018年6月23日更新)

/*

* ----------------------------------------------------------------------------

* This sketch uses the MFRC522 library ; see https://github.com/miguelbalboa/rfid

* for further details and other examples.

*

* NOTE: The library file MFRC522.h has a lot of useful info. Please read it.

*

* This sketch show a simple locking mechanism using the RC522 RFID module.

* ----------------------------------------------------------------------------

* Typical pin layout used:

* -----------------------------------------------------------------------------------------

* MFRC522 Arduino Arduino Arduino Arduino Arduino

* Reader/PCD Uno Mega Nano v3 Leonardo/Micro Pro Micro

* Signal Pin Pin Pin Pin Pin Pin

* -----------------------------------------------------------------------------------------

* RST/Reset RST 9 5 D9 RESET/ICSP-5 RST

* SPI SS SDA(SS) 10 53 D10 10 10

* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16

* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14

* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15

*

*/

#include

#include

#include

#include

#include

#include

#define RST_PIN 9 // Configurable, see typical pin layout above

#define SS_PIN 10

#define Green_LED 6 //pin for green “door unlocked” indicator LED

#define Red_LED 7 //pin for red “door locked” indicator LED

char array1[]=“ Swipe Your Tag”; //the string to print on the LCD

char array2[]=“ On The Reader.”;

char array3[]=“ Tag Accepted. ”;

char array4[]=“ Locking. ”;

char array5[]=“ Unlocking. ”;

int tim = 1; //the value of delay time

// initialize the library with the numbers of the interface pins

LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

Servo myservo;

String read_rfid;

String ok_rfid_1=“94e68de2”;

String ok_rfid_2=“f5642a50”;

String ok_rfid_3=“4249622993c81”;

int addr = 1;

int eVal = 0;

int lockPosition;

int servo_position;

int BUTTON1 = 8;

void setup() {

Serial.begin(9600); // Initialize serial communications with the PC

while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

SPI.begin(); // Init SPI bus

mfrc522.PCD_Init(); // Init MFRC522 card

{

lcd.init(); //initialize the lcd

lcd.backlight(); //open the backlight

lcd.begin(16,2);

}

pinMode(Green_LED, OUTPUT); //set all input/output pins, including whether they should be high (5v) or low (ground)

pinMode(Red_LED, OUTPUT);

digitalWrite(Green_LED, LOW);

digitalWrite(Red_LED, HIGH);

pinMode(BUTTON1,INPUT);

myservo.attach(5);

lockPosition = EEPROM.read(1);

// Serial.print(EEPROM.read(1));

if(lockPosition == 1){

digitalWrite(Red_LED, LOW);

digitalWrite(Green_LED, HIGH);

}

else {

digitalWrite(Red_LED, HIGH);

digitalWrite(Green_LED, LOW);

lockUnlock();

}

swipeText();

/*

* Dump a byte array as hex values to Serial.

*/

void dump_byte_array(byte *buffer, byte bufferSize) {

read_rfid=“”;

for (byte i = 0; i 《 bufferSize; i++) {

read_rfid=read_rfid + String(buffer[i], HEX);

}

}

void lockUnlock() { // locks or unlocks door

myservo.attach(5);

if(lockPosition == 1) {

lock2();

servo_position = 0;

myservo.write(servo_position);

digitalWrite(Red_LED, HIGH);

digitalWrite(Green_LED, LOW);

delay(3000);

lockPosition = 2;

eVal = lockPosition;

EEPROM.write(1,eVal);

// Serial.print(eVal);

}

else if(lockPosition == 2) {

lock1();

servo_position = 350;

myservo.write(servo_position);

digitalWrite(Red_LED, LOW);

digitalWrite(Green_LED, HIGH);

delay(3000);

lockPosition = 1;

eVal = lockPosition;

EEPROM.write(1,eVal);

// Serial.print(eVal);

}

myservo.detach();

}

void swipeText()

{

lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.

lcd.setCursor(0,0); // set the cursor to column 15, line 0

for (int positionCounter1 = 0; positionCounter1 《 15; positionCounter1++)

{

lcd.print(array1[positionCounter1]); // Print a message to the LCD.

delay(tim); //wait for 250 microseconds

}

lcd.setCursor(0,1); // set the cursor to column 15, line 1

for (int positionCounter = 0; positionCounter 《 15; positionCounter++)

{

lcd.print(array2[positionCounter]); // Print a message to the LCD.

delay(tim); //wait for 250 microseconds

}

}

void lock1()

{

lcd.clear();

lcd.setCursor(0,0);

for (int positionCounter1 = 0; positionCounter1 《 15; positionCounter1++)

{

lcd.print(array3[positionCounter1]);

delay(tim);

}

lcd.setCursor(0,1);

for (int positionCounter1 = 0; positionCounter1 《 10; positionCounter1++)

{

lcd.print(array4[positionCounter1]);

delay(tim);

}

}

void lock2()

{

lcd.clear();

lcd.setCursor(0,0);

for (int positionCounter1 = 0; positionCounter1 《 15; positionCounter1++)

{

lcd.print(array3[positionCounter1]);

delay(tim);

}

lcd.setCursor(0,1);

for (int positionCounter1 = 0; positionCounter1 《 12; positionCounter1++)

{

lcd.print(array5[positionCounter1]);

delay(tim);

}

}

void loop() {

if(digitalRead(BUTTON1) == HIGH){

lockUnlock();

swipeText();

}

// Look for new cards

if ( ! mfrc522.PICC_IsNewCardPresent())

return;

// Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial())

return;

dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);

Serial.println(read_rfid);

if (read_rfid==ok_rfid_1) {

//ok, open the door.

lockUnlock();

swipeText();

}

//Add below as many “keys” as you want

if (read_rfid==ok_rfid_2) {

//also ok, open the door

lockUnlock();

swipeText();

}

//Add below as many “keys” as you want

if (read_rfid==ok_rfid_3) {

//also ok, open the door

lockUnlock();

swipeText();

}

}

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • RFID
    +关注

    关注

    383

    文章

    5784

    浏览量

    234645
  • 蓝牙
    +关注

    关注

    112

    文章

    5428

    浏览量

    165650
  • 门锁
    +关注

    关注

    0

    文章

    47

    浏览量

    11763
收藏 人收藏

    评论

    相关推荐

    蓝牙在智能锁中的应用

    。在智能锁领域无线通信主要有zigbee,WiFi、蓝牙3种,其中蓝牙以低功耗、低成本,高安全性能突出优点,成为智能门锁厂商热衷的无线方案通讯技术。 蓝牙智能锁方案有哪些优势: 1)待
    的头像 发表于 03-08 15:04 132次阅读

    射频识别RFID

    射频识别(RFID) 是 Radio Frequency Identification 的缩写。 射频识别技术是自动识别技术的,通过无线射频方式进行非接触双向数据通信,利用无线射频方式对记录媒体
    发表于 02-28 11:31

    蓝牙FCC认证定频板怎么制作

    电子发烧友网站提供《蓝牙FCC认证定频板怎么制作.pdf》资料免费下载
    发表于 11-07 17:09 2次下载

    制作一个蓝牙遥控小车

    本周我们来制作一个蓝牙遥控小车,不得不说bluno nano的蓝牙交互功能还是让人眼前一亮,毕竟是首款集成蓝牙4.0的arduino板。制作
    发表于 10-13 06:01

    智能门锁蓝牙模块,SKYLAB蓝牙模块原理图

    基于SKYLAB的蓝牙智能门锁方案,基于Nordic52832/52840两种芯片方案,居家用户无需携带钥匙即可通过APP实现开关门锁,便捷又安全;蓝牙智能
    的头像 发表于 09-04 17:36 882次阅读
    智能<b class='flag-5'>门锁</b><b class='flag-5'>蓝牙</b>模块,SKYLAB<b class='flag-5'>蓝牙</b>模块原理图

    nfc近距离通讯技术原理 nfc,rfid,蓝牙的区别

    虽然NFC在传输速度与距离比不上蓝牙 (小于 20 cm),但相应可以减少不必要的干扰。这让NFC特别适用于设备密集而传输变得困难的时候。相对于蓝牙,NFC兼容于现有的被动 RFID (13.56 MHzISO/IEC 1800
    发表于 08-30 10:15 1373次阅读
    nfc近距离通讯技术原理 nfc,<b class='flag-5'>rfid</b>,<b class='flag-5'>蓝牙</b>的区别

    详解RFID电子标签特点及制作工艺

    的厂商而言,好用的RFID标签是项目成功的一大关键所在。那么,RFID电子标签有什么特点,有哪些制作工艺呢? RFID电子标签的特点 1、使用时间长,数据保留时间长达10年。 2、识别
    的头像 发表于 08-04 14:58 1858次阅读
    详解<b class='flag-5'>RFID</b>电子标签特点及<b class='flag-5'>制作</b>工艺

    智能门锁的无线通讯协议有哪些?它的主要特点和工作原理是什么?

    智能门锁的无线通讯协议主要有蓝牙、ZigBee和Wi-Fi等。
    的头像 发表于 07-15 08:55 1021次阅读

    带ESP8266的RFID智能门锁

    电子发烧友网站提供《带ESP8266的RFID智能门锁.zip》资料免费下载
    发表于 07-06 10:07 0次下载
    带ESP8266的<b class='flag-5'>RFID</b>智能<b class='flag-5'>门锁</b>

    如何制作RFID Arduino门禁系统

    电子发烧友网站提供《如何制作RFID Arduino门禁系统.zip》资料免费下载
    发表于 06-27 10:34 3次下载
    如何<b class='flag-5'>制作</b><b class='flag-5'>RFID</b> Arduino门禁系统

    使用Arduino的RFID和基于键盘的门锁

    电子发烧友网站提供《使用Arduino的RFID和基于键盘的门锁.zip》资料免费下载
    发表于 06-26 11:41 0次下载
    使用Arduino的<b class='flag-5'>RFID</b>和基于键盘的<b class='flag-5'>门锁</b>

    如何制作Arduino蓝牙控制的汽车

    电子发烧友网站提供《如何制作Arduino蓝牙控制的汽车.zip》资料免费下载
    发表于 06-26 10:21 0次下载
    如何<b class='flag-5'>制作</b>Arduino<b class='flag-5'>蓝牙</b>控制的汽车

    用语音控制的语音命令门锁制作

    电子发烧友网站提供《用语音控制的语音命令门锁制作.zip》资料免费下载
    发表于 06-12 10:48 1次下载
    用语音控制的语音命令<b class='flag-5'>门锁</b><b class='flag-5'>制作</b>

    如何通过蓝牙制作无线温湿度监测系统

    电子发烧友网站提供《如何通过蓝牙制作无线温湿度监测系统.zip》资料免费下载
    发表于 06-12 09:37 0次下载
    如何通过<b class='flag-5'>蓝牙</b><b class='flag-5'>制作</b>无线温湿度监测系统

    结合蓝牙定位技术、RFID技术实现智慧医疗解决方案

    利用蓝牙定位技术和RFID技术实现智慧医疗解决方案是可行的。该方案借助移动互联网技术,利用蓝牙Beacon设备、RFID标签等技术对医院信息化进行整合,监控医院内部人员、物品的位置及动
    的头像 发表于 05-19 14:11 389次阅读
    结合<b class='flag-5'>蓝牙</b>定位技术、<b class='flag-5'>RFID</b>技术实现智慧医疗解决方案