RFID

Information and discussion regarding Firewing shields

RFID

Postby Stormbringer » Fri Aug 02, 2013 8:11 pm

I recently purchased a couple of Xbee SD shields and was impressed by how easy they are to use. I have another application I want to develop and was wondering if there is an RFID module that would plug into the Xbee shield.
Stormbringer
 
Posts: 1
Joined: Fri Aug 02, 2013 8:05 pm

Re: RFID

Postby Moby » Sat Aug 03, 2013 7:56 am

Hi. Glad to hear you enjoyed using the Xbee shields and nice to know you found them easy to use.
Have a look at this RFID module:

http://www.cooking-hacks.com/index.php/arduino-rfid-module-1.html

It uses the same footprint as the DIGI Maxstream Xbee modules so should be a good starting point.

Cheers
Moby
User avatar
Moby
 
Posts: 3
Joined: Thu Nov 08, 2012 9:24 pm

Re: RFID

Postby David John Barker » Sat Aug 03, 2013 9:01 am

I did some commercial work using Firewing and RFID earlier in the year. I found these units easy to work with (simple RS232 interface):

http://www.ibtechnology.co.uk/products/ ... roduct.htm

I've attached an image of the module mounted on a Firewing prototyping board, together with a LCD Plus shield.
Attachments
rfid.jpg
RFID Module
rfid.jpg (92.21 KiB) Viewed 15245 times
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: RFID

Postby skartalov » Thu Jul 03, 2014 6:39 am

I was trying to figure out how to work with MIFARE MC522 IC card readers/writers, which are pretty low cost chineese board available on internet.
Well, reading the datasheet of RC522, I found that it's too complicated for me.
Anyone using this RFID technology with experience?
I just want to read the card ID tag!
(Writing/Reading information is next step)

Thanks!
skartalov
 
Posts: 69
Joined: Sun Sep 15, 2013 1:12 pm

Re: RFID

Postby David John Barker » Fri Jul 04, 2014 8:49 am

It's some time since I used RFID, but maybe this module code will give you some pointers:
Code: Select all
'*****************************************************************************
'*  Name    : RFID Library                                                   *
'*  Author  : David John Barker                                              *
'*  Notice  : Copyright (c) 2012 Mecanique                                   *
'*          : All Rights Reserved                                            *
'*  Date    : 03/03/2013                                                     *
'*  Version : 1.0                                                            *
'*  Notes   :                                                                *
'*          :                                                                *
'*****************************************************************************
Module RFID

' Uart interface...
imports UartTypes                               ' uart structures
private _uBRG As U2BRG                          ' baud rate generator
private _uSta as USTAReg absolute Pic.U2STA     ' status and control register
private _mode as UMODEReg absolute Pic.U2MODE   ' uart mode
private _rcRegister As U2RXREG                  ' recieve register         
private _txRegister As U2TXREG                  ' transmit register

' RFID interface...
private _Rts as D2                              ' RFID RTS line
private const RFID_OK           = &H86
private const RFID_WRITE_EEPROM = &H50
private const RFID_STATUS       = &H53
private const RFID_WRITE_BLOCK  = &H57
private const RFID_READ_BLOCK   = &H52
private const RFID_UID          = &H55
 
'****************************************************************************
'* Name    : SetBaudrate                                                    *
'* Purpose : Sets the hardware USART baudrate                               *
'****************************************************************************
private Sub SetBaudrate()
   _mode.Value = &H8800    ' mode (UARTEN = 1, RTSMD = 1) 
   _mode.BRGH = 1             
   _uSta.UTXEN = 1       
   _uBRG =((_clock * 1000000 / 2) / 4 / 9600) - 1
End Sub

'****************************************************************************
'* Name    : ReadByte                                                       *
'* Purpose : Read a Byte from the hardware USART                            *
'*         : Waits for USART data, returns byte in RCREG(x)                 *
'****************************************************************************
private Function ReadByte() As _rcRegister
   ' clear any possible overruns
   _uSta.OERR = 0
   
   ' now read data...
   Do
      ClearWDT
   Loop Until _uSta.URXDA = 1 ' have data = 1 
End Function

'****************************************************************************
'* Name    : WriteByte                                                      *
'* Purpose : Write a byte value to the hardware USART                       *
'*         : Wait until ready to send is enabled, then send byte            *
'****************************************************************************
private Sub WriteByte(value As byte)
   Do           
      ClearWDT
   Loop Until _uSta.TRMT = 1 ' busy = 0
   _txRegister = value
End Sub

'****************************************************************************
'* Name    : WaitForLow                                                     *
'* Purpose : Wait for the RTS line to go low                                *
'****************************************************************************
private inline sub WaitForLow()
   while _Rts = 1
   end while
end sub

'****************************************************************************
'* Name    : WaitForHigh                                                    *
'* Purpose : Wait for the RTS line to go high                               *
'****************************************************************************
private inline sub WaitForHigh()
   while _Rts = 0
   end while
end sub

'****************************************************************************
'* Name    : ReadArray                                                      *
'* Purpose : Read an array from the RFID                                    *
'****************************************************************************
private sub ReadArray(byref array() as byte)
   dim index as byte = 0
   while index <= ubound(array) and _rts = 1
      array(index) = ReadByte
      index += 1           
   end while
end sub

'****************************************************************************
'* Name    : WriteArray                                                     *
'* Purpose : Write and array to the RFID                                    *
'****************************************************************************
private sub WriteArray(byref array() as byte)
   dim index as byte = 0
   while index <= ubound(array)
      WriteByte(array(index))
      index += 1
   end while 
end sub

'****************************************************************************
'* Name    : WriteEEPROM                                                    *
'* Purpose : Write a data value to EEPROM                                   *
'****************************************************************************
public function WriteEEPROM(address as byte, data as byte) as boolean
   WaitForLow() 
   WriteByte(RFID_WRITE_EEPROM)   
   WriteByte(address) 
   WriteByte(data)
   WaitForHigh()
   return ReadByte() = RFID_OK       
end function

'****************************************************************************
'* Name    : WriteBlock                                                     *
'* Purpose : Write a block of data to the RFID tag                          *
'****************************************************************************
public function WriteBlock(cardBlock as byte, byref array() as byte) as boolean
   WaitForLow() 
   WriteByte(RFID_WRITE_BLOCK)   
   WriteByte(cardBlock) 
   WriteByte(0)
   WriteArray(array)
   WaitForHigh()
   return ReadByte() = RFID_OK       
end function

'****************************************************************************
'* Name    : ReadBlock                                                      *
'* Purpose : Read a block of data from the RFID tag                         *
'****************************************************************************
public function ReadBlock(cardBlock as byte, byref array() as byte) as boolean
   WaitForLow() 
   WriteByte(RFID_READ_BLOCK)
   WriteByte(cardBlock)
   WriteByte(0)
   WaitForHigh()
   ReadBlock = (ReadByte = RFID_OK)
   if ReadBlock then ReadArray(array)     
end function

'****************************************************************************
'* Name    : ReadUID                                                        *
'* Purpose : Read the Unique ID (UID) from the RFID tag                     *
'****************************************************************************
public function ReadUID(byref array() as byte) as boolean
   WaitForLow() 
   WriteByte(RFID_UID)   
   WaitForHigh()
   ReadUID = (ReadByte = RFID_OK)
   if ReadUID then ReadArray(array)   
end function

'****************************************************************************
'* Name    : InRange                                                        *
'* Purpose : Return true if an RFID tag is in range, false otherwise        *
'****************************************************************************
public function InRange() as boolean
   WaitForLow() 
   WriteByte(RFID_STATUS)   
   WaitForHigh()
   InRange = (ReadByte = RFID_OK)         
end function

' module initialisation...
private inline Sub Main()
   RPINR19 = RPINR19 and &HFFE0 or &B00001  ' map Uart2 RX to A1 (RB.1)
   RPOR0 = RPOR0 and &HFFE0 or &B00101      ' map Uart2 TX to A2 (RB.0)
   SetBaudrate()
End Sub

End Module 
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: RFID

Postby skartalov » Sat Jul 19, 2014 9:24 am

OK I decided to go on the regular old fashioned 125kHz RFID protocol EM4100, which is widely spread.

Anyone with experience decoding the dataflow? I am using EM4095 IC. The TAGS uses Manchester encoding.
It works, I can see the data stream coming out, but how to decode this is a mystery for me.

thanks
skartalov
 
Posts: 69
Joined: Sun Sep 15, 2013 1:12 pm


Return to Shields

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x