«

»

Mar 17

Print this Post

SM130 RFID Reader and Arduino

Recently I’ve been working on a RFID identification solution for a new project at University of Aveiro.

Our first approach will be through Arduino and the Son Micro SM130 RFID module. At first, the Arduino seemed quite simple and effective for the final goal, but soon the problems came up.

We will have to communicate basically with two different modules:

  • The RFID reader (ships with UART communication, but can be upgraded to an I2C firmware version)
  • The Door module (responsible to communicate with a database and opening the door – UART only communication)

The first problem we came across is that Arduino only has one Hardware UART available, which is also connected to the USB interface (used to upload programs to the board). If we need to upload a new program to the ATMega, we have to physically disconnect the SM130 from the UART pins. Not only this is a non-elegant solution but also, if we need to print something to the Serial console, the same will be sent to the RFID module. For the Door communication we would use the SoftwareSerial library, as a second UART.

SoftwareSerial supports multiple software UARTs but only one of them can be “listening” at a time, which means we lose everything that is sent to us while we are not listening.

Our solution will be to upgrade the SM130 to the I2C version, leaving the HW UART free for debugging purposes and the Door module handling for the SoftwareSerial. This scheme improves the overall performance of our final prototype, because incoming messages will always be placed in the corresponding buffer, ready to be read as soon as we can.

In this post I will also provide you some useful information that I found throughout the preliminary search. All links were working at 17/march/2012, but if you find a broken link, feel free to contact me. Also, the information I provide is merely to instructional purposes, use it at your own risk.

The I2C Firmware

The I2C firmware version is not freely available in SonMicro’s website, but if you are interested in the official release of the I2C firmware, you should send an e-mail to support@sonmicro.com to request it.

The upgrade is easy and is done using the Firmware Upgrade tool available at SM130′s Support Webpage.

I found some links supposedly with the i2c firmware (use at your own risk, I recommend that you request it from SonMicro):

Connect the SM130 module to USB through a FTDI cable or an Arduino without the ATMega in the socket. You only need to connect 5 pins on SM130: +5V/Vcc (pins 1 and 28), GND (14), RX (11) and TX (12). If you are using a chipless Arduino, see this link for more information.

Run the Firmware Upgrade tool, select the right COM port and the right firmware file you want to upload and then click “Auto Upgrade” button.

It is usual that the I2C slave address is not correctly set (it tends to be 0×30 after the FW upgrade). To check/change it, you must use the SMRFID Mifare Tool from SonMicro (available at the module’s support page). Unzip and execute the tool.

  • Set the baud rate in the left top corner to 19200
  • Make sure you have the right COM port selected
  • Click “hardware commands” in the menu
  • Click ‘read I2C adress’

If this returns 42 (or 0×42) it has the default address. To change it to 0×42 you click “Set I2C adress” in “hardware commands” menu and input 42 (input is done in HEX).

Testing the module

To test the module you can read the I2C Appplication Note from SonMicro and write your own program. However, to save time, there is already a library that you can use to print the card TAG in the serial monitor, called RFIDuino, available here. Install the library and use the “seek” example. Hopefully you will see your TAG on the screen.

About the author

Ricardo Dias

Ricardo Dias was born in Entroncamento, Portugal and is studying Electronic and Telecommunications Engineering at University of Aveiro. He is a researcher in robotics and is currently the Team Leader of CAMBADA@MSL team. As a hobby, he is also a freelancer Stage Lighting Designer.

Permanent link to this article: http://ricardo-dias.com/2012/03/17/sm130-rfid-reader-and-arduino/

5 comments

Skip to comment form

  1. Drew

    This is great, but I keep getting the message “Error!Unexpected Response: FF. Make sure module exited from configuration mode” when I go to upgrade via the SONMicro tool. Any advice?

  2. Joseph

    Just curious, but have you looked into using the GPIO pins on the SM130 to control a door module? They can’t do UART, but perhaps there’s a dumber door module you could use that just gets triggered by a high pin or a relay. I plan to use them to control a solenoid via a relay or mosfet.

    1. Ricardo Dias

      Hi Joseph.

      Short answer for your question, no… :)
      But actually the project involved another group that made a “Door Module” – the bridge between our ID Module and a DataBase of access permissions.
      They implemented the interface to the door lock with a digital signal, connected to a relay, because most electronic locks are just solenoids.
      Using the GPIOs would be, in fact, more cost-effective than having a dedicated module just for that function.

      If you go on with this idea, keep me up-to-date :)

      Best regards,
      Ricardo Dias

  3. wenjiun

    Great tips, very helpful when I try SM130 on Alamode.

    Just a quick tip, if you are using Alamode or any other Arduino Shield that already take the I2C slave address 0×42, there is no need to change the I2C slave address from the default 0×30 but instead change the RFIDuino library (SM130.cpp, in the constructor SM130::SM130() , the line address = 0×30;).

    1. Ricardo Dias

      Hey wenjiun,

      Thanks for the tip!

      Best regards,
      Ricardo Dias

Leave a Reply

Your email address will not be published. Required fields are marked *