In this lesson, we will show how to use the Osoyoo IoT Kit to build an RFID access control system. Before starting this lesson, you can get more information about the RFID module from this link.
First, please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:
Build the circuit as below:
RFID Module – RFID Port
Push Button – D3 port
LED Module – D2
Door Servo – D11
Please confirm whether the wiring is correct according to the VCC and GND pins
If you haven’t installed WifiESP,I2C LCD and PWMServo libraries in previous lessons, please download them in following link:
In this lesson we also need a new library called RFID library, if you don’t have it, please download it from following link:
In Arduino IDE, click Sketch→Include Library →Add .ZIP library and upload the library zip files to the IDE.
Step i)Before upload the code, we should adjust the servo angle first. Please remove the items from the wooden house’s door area:
Then please download the servo test code from this link, unzip it:
Step 2 After above operations are completed, connect OSOYOO MEGA2560 Board to PC with USB cable.
Step ii) Open Arduino IDE: Choose corresponding board type and port type for your project.
Step iii) Arduino IDE: Click file – Open, then choose code in the folder, load up the servo_config.ino sketch onto your Arduino.
Upload the sketch to the board. Wait until you see something like this:
Step iv) After upload the code, the servo will turn to 0 degree position, now we install the wooden gear and the white fixed arm:
Step 5 Press the button, the door can be simulated to open, when released, the door can be simulated to close.
After Servo test and installation is completed, we can go to next task. If the door can not be close or open properly, please adjust the servo arm beginning position accordingly.
Download and Edit Lesson2-5 Arduino code file:
Step 1 : Download the code from following link:
Unzip the above file and double click smarthome2-5.ino to open the file in Arduino IDE.
Step 2)find following and replace *** with your Wi-Fi ssid/password
char ssid = "***";//replace this line with your wifi ssid char pass = "***"; //replace this line with your wifi password
please replace the *** with your correct Wi-Fi SSID and password, otherwise your project can not connect to Internet.
Step 3)Upload the sketch to the board. Wait until you see something like this:
Now open Serial monitor, you will see your Arduino IP address as following:
Add your own RFID Card ID:
After completing the above steps and uploading the code, open the IDE serial monitor, we need to find out your RFID card number.
To this, pick a white or blue RFID card and tap it in the RFID sensor, you will see something as following:
RFID START! Find the card! Card type: Unknown The card's number is : 71ba2f2eca 71ba2f2eca ID is unknown.
In the above example, 71ba2f2eca is your RFID number just tapped. Now in code line 15, we need to change variable marystr from 33cd216fb to 71ba2f2eca:
String marystr="33cd216fb"; //change 33cd216fb with your test ID card
After changing, the line 15 will be as following:
In the same way, you can add or modify your card information at will, and finally, re-upload the code to the Arduino and continue the experiment.
Upload the sketch to the board again. Wait until you see something like this:
Now we can use that test RFID card to test our security door. Before testing, let’s open our APP first:
APP Installation and Setting:
Step 1) If you haven’t installed OSOYOO IoT Robot APP, please search OSOYOO IoT Robot Car APP in Google Play or Apple Store to install this APP.
You read following tutorial link for more information about APP install :
Step 2):Make sure your Cell phone is in the same Local Network of Arduino. Open the APP, click Settings, enter your Arduino IP address from Step F and Port to 8888 in settings:
Now you can use the test RFID card to tap the RFID sensor, the door will open for 1 seconds then close. Your APP will show “Mary at the Door”
If you click the F8 key in APP, you can also open the door. APP will show “Door is open by APP”
You can also push the button to open the door.
Each time when the door is open, the LED will turn on. After the door is close, LED will turn off.
|1||OSOYOO MEGA2560 Board||1||Click here to buy|
|2||OSOYOO MEGA-IoT Extension Board||1||Click here to buy|
|3||Photosensitive Sensor||1||Click here to buy|
|4||Temp & Hum Sensor||1||Click here to buy|
|5||OSOYOO Active Buzzer Module||1||Click here to buy|
|6||Flame Detection Sensor||1||Click here to buy|
|7||Fan Motor Module||1||Click here to buy|
|8||Micro Servo Motor||1||Click here to buy|
|9||RGB Module||1||Click here to buy|
|10||Ultrasonic Sensor||1||Click here to buy|
|11||PIR Motion Sensor||1||Click here to buy|
|12||Microphone Module||1||Click here to buy|
|13||1602 I2C LCD Screen||1||Click here to buy|
|14||RFID Module||1||Click here to buy|
|15||White LED Module||1||Click here to buy|
|16||Red LED Module||1||Click here to buy|
|17||Colorful Light||1||Click here to buy|
|18||Red Button Module||1||Click here to buy|
|19||Blue Button Module||1||Click here to buy|
|20||Philips Screwdriver||1||Click here to buy|
DownLoad Url osoyoo.com