RDM6300 125Khz RFID reader

In this example we are going to connect to RDM6300 RFID reader.

The RDM6300 is for 125 kHz RF tags.

This board uses UART (serial communication) but the protocol is fairly simple to deal with.

The RDM6300 seen from back and front

And the antenna that comes with it.

Disclaimer:
We do not take any responsibility for possible errors in the guide or errors that you might do wiring it up. Incorrect wiring can result in damaged sensor or damaged Raspberry PI.

Pieces we use in this example:

  • Raspberry PI 2 (or Raspberry PI 3)
  • Cobbler and Cobbler cable
  • Bread board
  • RDM6300 reader as shown on the pictures above. (I paid around $2 and half for it on some store at Ali Express, and the antenna comes with it).
  • Some 125 Khz RF Tags. (It is good if the numbers are printed on them so you can verify that things are working right).

If you are not familiar with breadboards, how to place a cobbler on the breadboard then click here bellow

   Using breadboard


Preparations:

Since this board uses UART serial communications then you need to disable Serial on your Raspberry PI. (Yes I know this sounds strange but the way I understand it is that your freeing the Serial port so that it is available for your use when you disable it).

To do this you go in the Raspberry PI main Menu -> Preferences -> Raspberry Pi Configurations -> Interfaces (Tab) -> Serial -> Set to disabled.

Specifications:

The RMD6300 board has the following specifications:

  • Baud rate: 9600
  • Interface: TTL level RS232 format.
  • Working voltage DC 5V (+- 5%)
  • Working current: < 50 mA.
  • Receive distance: 20 – 50 mm

Wiring up the board:

GPIO Header

We connect as follows:

  • 5V on cobbler to 5V on header 3 on RDM6300
  • GND on cobbler to GND on header 3 on RDM6300
  • RX on Cobbler (shown as GPIO15 on the Raspberry header schema above to TX on header 1 on RDM6300).
  • TX on Cobbler (shown as GPIO14 on the Raspberry header schema above to RX on header 1 on RDM6300).
  • Antenna wires to ANT1 and ANT2 on header 2 on RDM6300. (polarity does not matter)

Note that RX is connecting to TX and TX to RX. People often make mistake here and blindly connect TX to TX and RX to RX. But you want Transmitter to connect to receiver and receiver to connect to transmitter for communications to make sense.

The Xojo code:

We created class called RFID125KHZ which inherits from Serial class to make things easy for you. The class and example project can be downloaded at bottom of this article.

The class is decoding the RF tags and validating their checksums and then broadcasting event to the user interface once a tag is found.

Preview of the main portion of the class:

Sub DataAvailable() Handles DataAvailable
 Dim data as String
 Dim startMarker as Integer
 Dim endMarker as Integer
 Dim byteValue as Integer
 Dim checksum as Integer
 Dim value as Integer
 Dim valueString as String
 
 // Format of data is 02 - 10 byte data - Checksum (2 bytes) - 03, total of 14 bytes
 // Checksum is calculated doing Xor on every pair of 2 bytes of the 10 byte data
 
 data = me.ReadAll()
 
 if data.LenB &gt;= 14 then
 startMarker = AscB(data.MidB(1,1))
 endMarker = AscB(data.MidB(14,1))
 
 if startMarker = 2 and endMarker = 3 then
 // We found start and end markers
 
 valueString = data.MidB(2,10)
 
 value = Val("&amp;h" + valueString)
 
 if LastScannedID = valueString then
 if Microseconds - LastScannedTime &lt; 500000 then
 return // To prevent multiple reads at to fast rate
 end if
 end
 
 LastScannedID = valueString
 
 // Check if the checksum matches
 checksum = Bitwise.BitXor(checksum,Val("&amp;h" + valueString.MidB(1,2)))
 checksum = Bitwise.BitXor(checksum,Val("&amp;h" + valueString.MidB(3,2)))
 checksum = Bitwise.BitXor(checksum,Val("&amp;h" + valueString.MidB(5,2)))
 checksum = Bitwise.BitXor(checksum,Val("&amp;h" + valueString.MidB(7,2)))
 checksum = Bitwise.BitXor(checksum,Val("&amp;h" + valueString.MidB(9,2)))
 
 RFIDScanned(Str(value),data.MidB(12,2) = Hex(checksum))
 end if
 
 LastScannedTime = Microseconds
 end if
End Sub

Downloading the code:

   Download the code


 

Einhugur technical blog that involves Xojo and Einhugur Xojo plugin related topics

%d bloggers like this: