Here is how I got an ID12 RFID reader from SparkFun to work on a Raspberry Pi. The same will work for an ID20 reader too. Using udev rules is the way to go here too…
- RFID Reader Kit from Sparkfun
- Plug everything in.
- NOTE: This device probably works fine without the FTDI D2xx drivers. Test with sample code found here. I tested via the AdaFruit WebIDE.
- You can find the ttyUSB device the RFID reader has been assigned to by doing ‘dmesg’ after plugging it in. You should see something like this, indicating I’m on ttyUSB4
[173832.871279] usb 1-1.3.4: new full-speed USB device number 13 using dwc_otg [173832.995485] usb 1-1.3.4: New USB device found, idVendor=0403, idProduct=6001 [173832.995518] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [173832.995535] usb 1-1.3.4: Product: FT232R USB UART [173832.995550] usb 1-1.3.4: Manufacturer: FTDI [173832.995565] usb 1-1.3.4: SerialNumber: AD01SU55 [173834.105994] usbcore: registered new interface driver ftdi_sio [173834.112869] USB Serial support registered for FTDI USB Serial Device [173834.120217] ftdi_sio 1-1.3.4:1.0: FTDI USB Serial Device converter detected [173834.122730] usb 1-1.3.4: Detected FT232RL [173834.122783] usb 1-1.3.4: Number of endpoints 2 [173834.122820] usb 1-1.3.4: Endpoint 1 MaxPacketSize 64 [173834.122839] usb 1-1.3.4: Endpoint 2 MaxPacketSize 64 [173834.122855] usb 1-1.3.4: Setting MaxPacketSize 64[173834.130135] usb 1-1.3.4: FTDI USB Serial Device converter now attached to ttyUSB4 [173834.130268] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
- If you find everything is working fine, you probably don’t need to do the following steps. I had already done them before I figured our how to check ttyUSB value.
- Setup FTDI D2XX drivers as per this with more detailed development information in this PDF.
- NOTE: as of this writing the RasPi compatible version did not work, so I used the one here.
- During installation it says to do ‘sudo rmmod ftdi_sio’ and ‘sudo rmmod usbserial’. I did ‘sudo rmmod ftdi_sio’, but don’t know if it was required. ‘sudo rmmod usbserial’ threw an error saying it was in used by pl2303.
- I couldn’t figure out which ttyUSB device was my reader and noticed in dmesg the following, indicating the device had been detached when I did ‘sudo rmmod ftdi_sio’. This also suggests it would have worked fine without the FTDI D2xx drivers. That caused me some problems during testing.
[193184.440517] USB Serial deregistering driver FTDI USB Serial Device [193184.445448] ftdi_sio ttyUSB4: FTDI USB Serial Device converter now disconnected from ttyUSB4 [193184.445607] usbcore: deregistering interface driver ftdi_sio [193184.445802] ftdi_sio 1-1.3.4:1.0: device disconnected
- Once I restarted the Pi everything worked fine, found the ttyUSB ID from dmesg and tested with the sample code, which successfully printed the RFID tag number
- ‘dmesg | grep FTDI’ shows the following, showing that ftdi_sio is back in use again but on a different ttyUSB ID.
[ 5.010753] usb 1-1.3.4: Manufacturer: FTDI [ 8.358161] USB Serial support registered for FTDI USB Serial Device [ 8.546943] ftdi_sio 1-1.3.4:1.0: FTDI USB Serial Device converter detected [ 9.222204] usb 1-1.3.4: FTDI USB Serial Device converter now attached to ttyUSB1 [ 9.375986] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver