Learn how to interface the EM-18 RFID reader module with an Arduino board and read data from RFID cards or tags. Follow our step-by-step guide to wiring, coding, and testing the system. Add contactless identification to your projects with the EM-18 module and Arduino.
Disclaimer:
Handling electricity carries inherent risks. It’s essential to have the appropriate skills to manage it safely. Proceed at your own risk, as the author disclaims responsibility for any misuse, harm, or errors. All content on this website is unique and copyrighted; please avoid unauthorized copying. While most articles are open-source for your benefit, feel free to use the knowledge provided. If you find our resources helpful, consider purchasing available materials to support our work.
For assistance or guidance, leave a comment below; the author is committed to helping. Some articles may contain affiliate links that support the author with a commission at no additional cost to you. Thank you for your understanding and support.
Table of Contents
About EM-18:
The EM18 RFID reader is a widely used module in access control systems and other applications where contactless identification is required. The EM18 module communicates with the Arduino microcontroller board via serial communication, which makes it easy to integrate into any project.
Pin configuration of EM-18:
How to interface EM-18 RFID with an Arduino:
Now, to interface EM-18, you need to follow the following steps.
Step 1: Required Components:
Before we begin, we need to gather the necessary components for this project:
- Arduino board (UNO, Nano, or any other compatible board)
- EM18 RFID reader module
- RFID card or tag
- Jumper wires
- Breadboard
Step 2: Wiring:
The wiring diagram for interfacing EM18 with Arduino is straightforward. First, connect the GND pin of the EM18 module to the GND pin of the Arduino board. Then, connect the VCC pin of the EM18 module to the 5V pin of the Arduino board.
Next, connect the TX pin of the EM18 module to the RX pin of the Arduino board, and the RX pin of the EM18 module to the TX pin of the Arduino board. Finally, connect the LED and Buzzer pins of the EM18 module to any digital pins of the Arduino board.
Step 3: Code:
Now that we have connected the EM18 module to the Arduino board, it’s time to write the code. First, we need to include the SoftwareSerial library to communicate with the EM18 module. Then, we create a new instance of the SoftwareSerial class, which we will use to read the data from the EM18 module.
Next, we initialize the LED and Buzzer pins as output pins. Finally, we enter the main loop of the code, where we read the data from the EM18 module using the SoftwareSerial object. When a card or tag is detected, the LED and Buzzer pins are turned on to indicate that a card or tag has been read.
Here’s the code:
#include <SoftwareSerial.h> SoftwareSerial RFID(2, 3); // RX and TX pins int ledPin = 13; int buzzerPin = 12; void setup() { pinMode(ledPin, OUTPUT); pinMode(buzzerPin, OUTPUT); Serial.begin(9600); RFID.begin(9600); } void loop() { if (RFID.available() > 0) { String data = ""; while (RFID.available() > 0) { data += char(RFID.read()); delay(10); } if (data.length() > 0) { digitalWrite(ledPin, HIGH); digitalWrite(buzzerPin, HIGH); Serial.println(data); delay(500); digitalWrite(ledPin, LOW); digitalWrite(buzzerPin, LOW); } } }
Result:
Now that we have connected the EM18 module to the Arduino board and uploaded the code, we can test the system by placing an RFID card or tag near the EM18 module. When a card or tag is detected, the LED and Buzzer pins will turn on, indicating that the card or tag has been read.
Conclusion:
Interfacing the EM18 RFID reader with Arduino is a simple and easy process. By following the steps outlined in this article, you can quickly integrate the EM18 module into your projects and read data from RFID cards or tags. With a little creativity, you can use the EM18 module to add contactless identification to your projects and create innovative new applications.
Read more on:
- How to interface a 16×2 LCD with an STM32
- How to interface ESP8266 with STM32
- How to interface Stepper Motor with STM32
- How to interface an OLED display with an STM32
- How to interface SHT31 with STM32
For Professional Designs or Help:
0 Comments