RFID Card Access System with NodeMCU
How to connect rfid to nodemcu? i’ll answer that question.
First of all we need the following materials:
- 1 piece NodeMCU DevKit
- 1 piece RC522 RFID Reader Module
- 1 piece red , 1 piece green LEDs
- 2 piece of 330 Ω (ohm) Resistor
- 1 piece Breadboard
- Jumper cables
Why we use NodeMCU ?
NodeMCU is a small, inexpensive and powerful device.
By default, it runs at 80 MHz. However, it is also capable of operating at 160MHz if desired. For comparison, the ATmega328 in Arduino Uno is only 16 MHz.
One of the biggest features of the card is the embedded WiFi module.
Of course, without mentioning the disadvantages of such a beautiful device. For example, the number of pins is small, but it is inevitable to give up the number of pins when the size decreases. Again, there is no short circuit protection on the board due to the small size. This means that if you make a wrong connection or because of the static electricity that is likely to occur in your body, the card will be permanently malfunctioning. Therefore, you should be as careful as possible during the circuit installation
To use the Arduino IDE with NodeMCU, you must first install the NodeMCU drivers at https://github.com/tahasvc/nodemcu-devkit if you are using an operating system external to GNU / Linux-based distributions. GNU / Linux users are advantageous in this regard, as soon as they are installed on your computer in almost all the current system automatically recognizes and is ready to use.
Windows users now come across a screen like the one below. If you click the “INSTALL but button, the program will automatically install the drivers on your computer.
In the previous stage, we learned how to introduce NodeMCU to our computer. Now we’ll learn how to introduce it to the Arduino IDE. First of all, we need the Arduino IDE if it is not already installed. You should download the appropriate one for your system at https://www.arduino.cc/en/Main/Software. It takes a long time to install.
When the installation is complete, enter File> Preferences. You will see a screen like the following.
Since the display of line numbers will make your job easier, my advice is to check that box. If you type Devre http://arduino.esp8266.com/stable/package_esp8266com_index.json ına in the Additional Circuit Board Manager URLs section and press OK, after a few operations, the NodeMCU and the Arduino IDE will begin to recognize each other.
Now go to Tools> Board> Board Manager and get to the bottom. As you can see in the visual, I have already set up. You can perform the installation by clicking the ”Install” button. The length of this process may vary depending on the speed of your Internet connection.
now you have to select your card and make it ready to throw the code and make the necessary configuration. To do this, go to Tools> Board and select the NodeMCU 1.0 card. You should then adjust the settings, as you will see at the bottom of the image and in the upper part of the code. By default, the NodeMCU operates at a frequency of 80 MHz. It can be set to 160 MHz frequency if desired. You can achieve more performance by changing this parameter. However, as you increase the frequency, it will draw more current and will cause an increase in power consumption. If you don’t have a power problem, you can run it freely at 160 MHz. Never worry about heating problems. Even though I have used it in many projects and left the device on under load for a long time, there was no heating up.
Now, let’s install the necessary libraries. For library installation, you must select the .zip file you will download from https://github.com/tahasvc/nodemcu-devkit/raw/master/rfid.zip by going to Draft> Add library> Add .ZIP Library…. Thus, the library will be established.
Now let’s install our circuit. You can see the circuit diagram below. I have also written the connections between the RFID reader and the NodeMCU in the diagram. In addition, the D1 pin must be connected to the Red LED and the D2 pin to the Green LED.
At this stage we are now going to the code section. If we threw our code, our system will be ready to work after a few small details. I’ve written the address below where you can download the code.In the code, I specify the description lines and details.