Read RFID Cards Using Android, Arduino and MFRC522 Module, Part 2 : Android App

Droiduino Blog
3 min readSep 23, 2020

This is the second part of creating RFID Reader using Android and Arduino. In this post, I will describe how to create an Android custom app to display RFID information and process it further.

Development environment

To manage some expectations in case the app doesn’t work like it’s supposed to be, this is the environment I use to develop this app:

  1. Samsung Galaxy S8, with Android version 9.
  2. Android Studio version 3.6.3 with compatible Gradle version.
  3. Minimum SDK Version: 19 (You need to select this when creating a new project using Android Studio).
  4. Mac OS 10.15.4 (Windows should also work perfectly)

How this app works

The main function of this app is to parse information (UID) that was transmitted by the Arduino board created in the previous post. This UID is then displayed on the phone screen.

In essence, this app expands the function of this Bluetooth app. The difference is just that instead of transmitting a hardcoded message, the Arduino board transmitting a data sequence from an RFID card.

App structures

This app consists of the following Activities and Java Class:

  1. MainActivity. This is automatically created when you create a new project. This is where most of the interactions take place. Including the code for creating Bluetooth connection with the Arduino board.
  2. SelectDeviceActivity. The UI where you select the Bluetooth device that you want to connect.
  3. DeviceListAdapter. A class to display a list of paired Bluetooth devices for you to connect. The list will be displayed in SelectDeviceActivity.
  4. DeviceInfoModel. A class that acts as a placeholder for the remote device information.

All the code is available in Github. Once you build the whole project, you need to install the app to your actual device to be able to use the Bluetooth function.

There is a great Udemy course called Basic Android Programming for Arduino Makers that will teach you how create a Bluetooth app that can talk to your Arduino projects, even if you don’t have prior knowledge in Android programming.

Note: Due to periodic update to the app, the Github version might slightly different from the code in this post. But the core function remains the same.

Trying the app

The steps to try the app and make sure everything works well are as follows:

  1. Connect the Arduino board to the MFRC522 and HC05 module as shown in the previous post and then plug it into a power supply (or to your computer).
  2. Pair the Arduino Board with your Android phone. Then, from your app, create a connection to the Arduino board by clicking the Connect button and selecting a HC05 device. Later, you might want to change the default name for HC05 module.
  3. Wait until the Bluetooth device is successfully connected.
  4. Tap an RFID card to the reader and the UID information should be displayed on the Android phone

Note: for more information about connecting an Arduino board to an Android phone using HC05 Bluetooth module, please read this post.

What can you do this with this project

The reason I am connecting RFID reader is because I want to create a portable inventory management system to organise the electronic parts I have scattered around and also to manage many stuffs I have around the house. To accomplish that, I will need to expand the app e.g. connect it to a local or cloud database, and put the hardware in a durable electronic box (since I will frequently use this reader).

But that is not the only application for a RFID reader. You can create, for example, an access system that is connected to an electronic lock, or an attendance system that is connected to your company’s HR system.

--

--

Droiduino Blog

Droiduino is about sharing knowledge in the realm of Android app programming, Arduino project creation and using R for processing data.