Book Image

Internet of Things Programming with JavaScript

Book Image

Internet of Things Programming with JavaScript

Overview of this book

The Internet of Things is taking the tech world by storm, and JavaScript is at its helm. This book will get you to grips with this exciting new technology. Where do Node.js, HTML5 and Windows 10 IoT Core come in with JavaScript and IoT? Why Raspberry Pi Zero rather than Arduino? How do you configure and build an IoT network from scratch? All your IoT JavaScript questions are answered in this book.
Table of Contents (15 chapters)
Internet of Things Programming with JavaScript
Credits
About the Author
www.packtpub.com
Customer Feedback
Preface

Controlling access with an RFID card


In this section, we will see how to control access via a door. In the last chapter, we saw how to control the lock and the lamps of a house. This project can complement the last one as it will enable you to control the opening of a door, a specific bedroom door, or lights in other rooms.

Hardware requirements

For this project, we need the following equipment:

  • Reading TAGS cards

  • RFID RC522 Module

  • Arduino Board

The following image shows the RFID tags for reading and controlling the access:

The following figure, shows the RFID card interface for Arduino:

Software requirements

We need to install the <MFRC522.h> library, this file can communicate with and configure the module for reading the tag cards. This library can be downloaded from https://github.com/miguelbalboa/rfid.

Software code

You can now either copy the code inside a file called RFID.ino, or just get the complete code from the folder for this project:

#include <MFRC522.h> 
#include <SPI...