Electronic Pet Door - Arduino Nano LCD RFID Security Door
Electronic Pet Door, products and first test
How can we easily make an electronic project with Arduino to create a cat flap allowing the exit and entry of your cat but not that of the neighbor!
Objects used for this project:
2 colored LEDs.
RFID card reader induction.
1 servo motor.
1 Arduino development board.
1 ProtoShield extension.
2 decks of experimentation.
Resitors, jump cable and USB power cable 1.
Final product online test
This product is an invention, do not copy without specifying the origin and product inventor.
The viedo is made for educational title and any copy for commercial reason isn't allowed. Only copies for personal use are allowed.
The complete Arduino code source:
#include
#include
#include
#include
#include
#include
#define I2C_ADDR 0x27 // <<- Add your address here.
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
Servo myservo;
#define RST_PIN 9 //
#define SS_PIN 10 //
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
String read_rfid;
String ok_rfid_1="c4b256f";
String ok_rfid_n="";
int peezo = 5;
int ledPin1 = 7;
int ledPin2 = 6,butPin=8;
int servopin = 4;
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
int posClosed=30;
int posOpened=120;
int pos = 0,newcard=0;
//stepper
#define STEPS 32 // Number of steps per revolution of Internal shaft
int Steps2Take; // 2048 = 1 Revolution
// In1, In2, In3, In4 in the sequence 1-3-2-4
//Stepper small_stepper(STEPS, 2,3,4,5);
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
ShowReaderDetails(); // Show details of PCD - MFRC522 Card Reader details
//Serial.println(F("Scan PICC to see UID, type, and data blocks..."));
pinMode(ledPin1,OUTPUT);
pinMode(ledPin2,OUTPUT);
pinMode(peezo, OUTPUT); digitalWrite(peezo, LOW);
pinMode(butPin, INPUT); digitalWrite(butPin, LOW);
myservo.attach(servopin);
myservo.write(posClosed);
lcd.clear();
lcd.begin (7,2);
// LCD Backlight ON
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home ();
lcd.print("Chatiere ready");
flashg(2,200);
}
void dump_byte_array(byte *buffer,byte bufferSize){
read_rfid="";
for(byte i=0;i