Warning: Declaration of Db::query($query) should be compatible with mysqli::query($query, $resultmode = NULL) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 29

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Cannot modify header information - headers already sent by (output started at /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php:0) in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 168

Warning: session_start(): Cannot start session when headers already sent in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 169

Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64
jobs.html_title
0

members

Easy Basics: Project 002b RFID RC522 module, LEDs, LCD1602 i2C module - simple security access

of Acoptex.com in UNO

Basics: Project 002b

Project name: RFID RC522 module, LEDs, LCD1602 i2C module, active piezo buzzer  - simple security access

Tags: Arduino, Arduino Uno, RFID RC522 module, LED, MFRC522 RFID reader, LEDs, LCD1602 i2C module, active piezo buzzer, simple security access

Attachments: DumpInfosketch library1, library2Rfidsimplesketchaccesssketch

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.MFRC522 13.56Mhz IC or RFID RC522 module with tags 1 pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables M-M, F-M

5. LED 2 pc

6. Resistor 2 pc (220 Ohm)

7. Breadboard 1 pc

8. LCD 1602 I2C module 1 pc

9. Active piezo buzzer 1 pc

Understanding RFID
RFID, or Radio Frequency Identification, is a system for transferring data over short distances (typically less than 6
inches). Often only one of the two devices needs to be powered, while the other is a passive device. This allows for easy
use in such things as credit cards, key fobs, and pet collars as there is no need to worry about battery life. The downside
is that the reader and the information holder (ie credit card) must be very close, and can only hold small amounts of data.

General

We will learn how to connect MFRC522 RFID Reader, LEDs and LCD1602 I2C module to Arduino board and use them as simple security access system.

Understanding the LCD 1602 I2C module

You can read more about it here.

Understanding a piezo buzzer

You can read more about it here.

Understanding the MFRC522 RFID Reader

RFID, or Radio Frequency Identification, is a system for transferring data over short distances (typically less than 6 inches). Often only one of the two devices needs to be powered, while the other is a passive device. This allows for easy use in such things as credit cards, identify people, to make transactions, key fobs, and pet collars as there is no need to worry about battery life. The downsideis that the reader and the information holder (ie credit card) must be very close, and can only hold small amounts of data.

There are cheap RFID modules that can read and write Mifare's tags and being sold at several web stores, like eBay and included with many "starter kits" nowadays. Simply search RFID-RC522 (MF-RC522). The microcontroller and card reader uses SPI for communication (chip supports I2C and UART protocols but not implemented on library). The card reader and the tags communicate using a 13.56MHz electromagnetic field. (ISO 14443A standart tags).

For example, you can use an RFID system to open a door - only the person with the right information on his card is allowed to enter. An RFID system uses:

  1. tags attached to the object to be identified, in this example we have a keychain and an electromagnetic card. Each tag has his own identification (UID).
  2. two-way radio transmitter-receiver, the reader, that send a signal to the tag and read its response.
Datasheet for the chip that used in modules can be found here.

More information about RFID here.

Signals and connections of the LCD 1602 I2C module

As you can see on the back of LCD 1602 module there 4 connections: GND (-), VCC (+5V), Serial Data Line (SDA) (Arduino Uno SDA or Analog pin A4) and Serial Clock Line (SCL) (Arduino Uno SCL or Analog pin A5).

Signals and connections of active piezo buzzer

Active piezo buzzer pin marked with (+) sign should be connected to Arduino Uno board digital pin which sends a signal, the other pin of active piezo buzzer should be connected to Arduino Uno board GND.

Signals and connections of LED

The operating voltage of the LED is 1.8V and the operating current is 10mA-20mA. The Arduino Uno board can supply 5V or 3.3V power. We will use 5V for this project, so the minimum resistance of the current limiting resistor should be (5 V to 1.8 V)/20 = 160 Om. The 220 Om offered in the kit is suitable and you can also choose other resistors that meet the condition. The larger the resistance is, the dimmer the LED will get.

Signals and contacts of RFID RC522


The MFRC522 RFID reader works at 3.3V and it can use SPI or I2C communication. The library we’re going to use to control the RFID reader only supports SPI, so that’s the communication protocol we’re going to use.

GND - ground pin.

SDA - I2C interface data pin.

CLK (or SCK) (Serial Clock) - The clock pulses which synchronize data transmission generated by the master

MOSI (or DI or SI or CMD) (Master Out Slave In) - The Master line for sending data to the peripherals

MISO (or DO or SO) (Master In Slave Out) - The Slave line for sending data to the master

IRQ - interrupt pin. Not in use

RST - reset pin.

3.3V - power supply pin 3.3V.

Wiring

Cautions:

  • On the Arduino many of the pins are not swappable. Because RFID module uses the SPI bus, who’s pins cannot be moved around, pins 11, 12, 13 must remain as shown. RST and IRQ are user specified.
  • RFID module is NOT a 5 volt powered device. You MUST power it with 3.3 volts. If you do not, you risk overheating the RFID. Most Arduino boards include a 3.3V supply pin which can be used to power the RFID module. 
  • Different Arduino boards have different SPI pins. If you’re using another Arduino board, check the Arduino SPI documentation.

RFID RC522 module pin Arduino Uno

SDA  Digital pin 10

SCK Digital pin 13

MOSI Digital pin 11

MISO Digital pin 12

IRQ Not in use

GND GND

RST Digital pin 9

3.3V 3.3V

LCD 1602 I2C module uses I2C communication. This means that it communicates with the Arduino using just 2 pins. For Arduino Uno - Serial Data Line (SDA) (Arduino Uno SDA or Analog pin A4) and Serial Clock Line (SCL) (Arduino Uno SCL or Analog pin A5).

If you’re using other Arduino board rather than the Uno, check out what are their SCL and SDA pins.

  • Nano: SDA (A4); SCL(A5)
  • MEGA: SDA (20); SCL(21)
  • Leonardo: SDA (20); SCL(21)

The following picture shows the needed connections with the Arduino Uno 

Step by Step instruction

  1. Do wiring. As in this project there are 3.3V and 5V modules, make sure that you wire them in correct way - check the recommend voltage before powering the circuit. We suggest you to wire one module at a time.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Find your I2C address. Each device has an I2C address that it uses to  accept commands or send messages. Load the sketch over at http://playground.arduino.cc/Main/I2cScanner and follow the instructions to use it.  By opening up the Serial monitor window after you upload the sketch, Arduino will scan the address range looking for a reply.  Even though the documentation said it was 0x27, this scanner can detect different (in our case 0x3F).
  5. Modify the sketch in attachments above (you can use the sketch below too): the line LiquidCrystal_I2Clcd (0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE) (See part marked bold).
  6. First we need to read data from a RFID tag. Verify and upload the DumpInfosketch to your Arduino Uno.  Open serial monitor at 9600 bps. When you put an RFID tag next to the RFID reader, you will see a bunch of numbers pop out.
  7. This is the information that you can read from the RFID tag, including the card UID. The information is stored in the memory that is divided into segments and blocks. You have 1024 bytes of data storage divided into 16 sectors and each sector is protected by two different keys, A and B. Write down your UID card as you will need it later.
  8. Modify Rfidsimplesketchaccesssketch in the line  if (content.substring(1) == “YOUR CARD UID”) type the UID of your card or tag you have written previously.
  9. Verify and upload the Rfidsimplesketchaccesssketch to your Arduino Uno.  Open serial monitor at 9600 bps. 
  10. When you put an RFID tag next to the RFID reader, you will see number of RFID tag/card and status. It will be in Serial monitor and on LCD screen. You will also see the status with the green/red LED.

Summary

We have learnt how to connect MFRC522 RFID Reader, LEDs and LCD1602 I2C module to Arduino board and use them as simple security access system.

Libraries:

  • All libraries attached on the begining of the project description.
  • MFRC522 library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.
  • SPI library included in Arduino IDE.
  • We have used the library - NewliquidCrystal_1.3.4.zip which we downloaded, unzipped, changed the name of folder to LiquidCristal and added to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.  If you have LiquidCristal folder in this location already - delete this folder and copy folder, which was made by you, to this location.

Sketch:

  • See attachment on the begining of this project


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

jobs.published_at
jobs.viewed