基于arduino的门禁系统。
本帖最后由 cnkids 于 2012-11-23 17:44 编辑协会要换锁,上门禁系统,{:soso_e135:}{:soso_e135:}找不到人焊锁。。囧囧的。。
使用的材料有:
电机锁 x1
MANGO x1
RFID读卡模块 x1
ID卡 若干
直流稳压电源板 x1
DC-DC固态继电器 x1
先来几张图~{:soso_e147:}{:soso_e147:}
上视频,不是很长,基本演示了一下功能。
http://player.youku.com/player.php/sid/XNDc5MDIyNzI0/v.swf
贴个程序,有兴趣的一起研究哈~#include <EEPROM.h>
#define EEPROM_write(address, p) {int i = 0; byte *pp = (byte*)&(p);for(; i < sizeof(p); i++) EEPROM.write(address+i, pp);}
#define EEPROM_read(address, p) {int i = 0; byte *pp = (byte*)&(p);for(; i < sizeof(p); i++) pp=EEPROM.read(address+i);}
const int ENPin = 2; // the number of the EN pin
int ENState = 1; //default EN state was HIGH
int lock = 3;
void setup()
{
Serial.begin(9600);
pinMode(ENPin, INPUT);
pinMode(lock,OUTPUT);
digitalWrite(lock,LOW);
}
void loop()
{
unsigned long ID = 0; //define a string variable
unsigned long IDR = 0;
for(ENState = digitalRead(ENPin) ; ENState == LOW && Serial.available() > 0; ) // read the state of the EN value,check if the EN is LOW,the output the data.
{
ID = ID * 10 + int(Serial.read()-'0'); //read the number from IDcard
delay(2);
}
if(ID != 0) //if comdata gets the IDcard number,show it
{
Serial.println(ID);
for(int addr = 0; addr <= 1020; addr = addr + 10)
{
EEPROM_read(addr, IDR);
if(ID == IDR)
{
digitalWrite(lock, HIGH);
delay(1000);
digitalWrite(lock, LOW);
delay(20);
Serial.println("Welcome!"); break;
}
}
if(ID != IDR) Serial.println("Sorry,you are not allowed!");
ID = 0; //clean the comdata
}
}
抢沙发抢沙发,笑看2楼lu~~~~ 好东西,应用不错啊! 不错啊,最增加个自动开锁后,将门弹开功能就绝了, 不错啊 实用 请问一下 那块板子后面的铜皮是怎么去掉的 ?? 小黑 发表于 2012-11-23 18:37 static/image/common/back.gif
请问一下 那块板子后面的铜皮是怎么去掉的 ??
热转印+腐蚀~ pww999 发表于 2012-11-23 18:19 static/image/common/back.gif
不错啊,最增加个自动开锁后,将门弹开功能就绝了,
加一个弹簧什么~考虑看看 cnkids 发表于 2012-11-23 18:49 static/image/common/back.gif
热转印+腐蚀~
哦雕刻行不 感觉那样来的更快啊 小黑 发表于 2012-11-23 18:52 static/image/common/back.gif
哦雕刻行不 感觉那样来的更快啊
买不起雕刻机。。。 这是上次的那个刷卡机程序,改过来的吧》? pww999 发表于 2012-11-23 21:12 static/image/common/back.gif
这是上次的那个刷卡机程序,改过来的吧》?
嗯,那时候写的程序就是为了搞这个~ 这个真不错,感谢分享 嗯,好东西,呵呵 你这个直流稳压电路是怎样的?
页:
[1]
2