Tuesday, 16 April 2013 21:05

Arduino and Stronglink SL018 RFID module

Stronglink SL018 RFID module
Among the RFID modules, Stronglink SL018 is the lowest cost RFID module that I can get which supports read and write. SL018 is a 13.56MHz RFID module, it supports Mifare 1K, Mifare 4K and Mifare Ultralight. The specification are as follow:
Model
MIFARE Module SL018
Frequency
13.56MHz
Protocol
ISO14443A
Tag supported
Ultralight, NTAG203, MIFARE Mini, MIFARE ™ Classic 1K, 4K MIFARE Classic ™, FM11RF08
Interface
I2C
Supply voltage
4.4 - 7.0VDC
Dimension
65 × 45 mm

To communicate with Arduino, Marc Boon had developed the SL018 library for Arduino which support reading UID of tags and reading/writing tags.
 

Stand alone Stronglink SL018 module
By supplying 5V to the SL018 module, the module is able to detect Mifare RFID tags without connecting to the controller such as Arduino. L3 LED will turn on if a Mifare RFID tag is detected within range, 3V appear at Pin1 (Tags) if measured from GND.
Stronglink SL018 pinout
 
 
Install the SL018 library for Arduino
  • Download the SL018 library, it supports SL030 RFID module as well.
  • Extract the Zip file (RFIDuino-master.zip)
  • Copy the SL018 folder to the libraries folder of Arduino as shown in figure below
 SL018 Library
 
 
Verify SL018 library is installed correctly
  • Launch the Arduino software, I'm using Arduino 1.0.4
  • You will be able to see the SL018 examples as shown in figure below if everything is working correctly.
Stronglink SL018 examples
 
 
Upload sketch to Arduino
Marc Boon RFID library included examples for reading the UID of tags.
  • Connect Arduino to computer
  • Launch the Arduino software
  • Click on File>Examples>SL018>UID to use load the UID example
  1. #include <Wire.h>
  2. #include <SL018.h>
  3. SL018 RFID;
  4. int led = 13;
  5.  
  6. void setup()
  7. {
  8. pinMode (LED, OUTPUT);
  9. Wire.begin ();
  10. Serial.begin (19200);
  11. Serial.println("Show me your tag"); // prompt for tag
  12. }
  13.  
  14. void loop ()
  15. {
  16. rfid.seekTag () / / start the seek mode
  17. while (! rfid.available ()) / / wait until detected tag
  18. Serial.println (rfid.getTagString ()); / / print some id
  19. }
  • Click on upload button to start upload the above sketch to Arduino.
  • Upon completing uploading, the next step will be connect the SL018 module to Arduino for testing.
 
Connecting SL018 RFID module to Arduino
AL018 uses i2c for communication, only two signal is used (Pin2 and Pin3). Connect the SL018 and Arduino based on table below:
SL018
Arduino
1 (TAG) 
A3 (Analog 3)
2 (SDA)
A4 (Analog 4)
3 (SLC)
A5 (Analog 5)
4 (VCC)
VCC
5 (GND)
GND
Notice that table above shows Pin1(Tag) is connected to Arduino, but it is not using in this example.
 
 
SL018 RFID module communicate with Arduino
  • Connecting SL018 and Arduino based on table above
  • Launch the Arduino software
  • L3 LED will turn on if Mifare tag detected within range, the UID of the tag will appear in the Serial Monitor (make sure baud rate is 19200) as shown in figure below.
Show your tag
 
 
Improve the coding for use with Verification
Code below demonstrate an LED will turn on if verification is passed, LED will turn off after 3 seconds.
  1. #include <Wire.h>
  2. #include <SL018.h>
  3. SL018 rfid;
  4. int led = 13; // Pin 13 has an LED connected on most Arduino boards
  5. String cardUID;
  6.  
  7. void setup()
  8. {
  9. pinMode(led, OUTPUT); // initialize the digital pin as an output.
  10. Wire.begin();
  11. Serial.begin(19200);
  12. Serial.println("Show me your tag"); // prompt for tag
  13. }
  14. void loop()
  15. {
  16. rfid.seekTag(); // start seek mode
  17.  
  18. while(!rfid.available()); // wait until tag detected
  19. cardUID = rfid.getTagString();
  20. Serial.println( cardUID); // print tag id
  21. if ( cardUID == "0467CB11E20280") {
  22. digitalWrite(led, HIGH); // turn the LED on
  23. delay(3000); //wait for 3 seconds
  24. digitalWrite(led, LOW); // turn the LED off
  25. }
  26. }
 
 
Reading and Writing demonstration
The sl018demo example come with Mac Boon RFID library, features include:
  • Read UID
  • Read all the information in the RF tag
  • Write two bytes to the RF tag
Use the same step as above to upload sl018demo sketch to Arduino. When everything is ready, we use the Serial Monitor to   monitor the result. Here is how we do it:
 
Enter ? will bring up the help screen as shown in figure below:
Help
 
a command
Use to toggle auto read ON of OFF.  When Auto Read is ON, the SL018 module will read the tag and display the tag information in the Serial Monitor as long as the Mifare tag is within range.
 
d command
Use to toggle debug ON or OFF. When Debug is ON, the command send to SL018 module and its results will display int the Serial Monitor. 
 
s command to
Read and list the UID of the tag
Seek UID
 
r command to
Read and list the UID of the tag & also read and list the information of the tag
Read Data
 
w command
writes two bytes to RFID tag
Write string AB to RFID card
Read 22261 times Last modified on Monday, 07 October 2013 23:39
Back to Top