Search code examples
rserial-portrfid

Use R serial package to extract information stored in a Trovan GR250 RFID reader


I try to access to informations stored inside a Trovan reader using R serial package via a serial port. Connexion seems to be effective since the reader red led is shortly activated when serialConnection function is run but
read.serialConnection function give an empty string instead of the expected tag code. Have someone any ideas ? below a link to the reader documentation and the R script. Many thanks

http://www.vantro.biz/GR-250%20Computer%20Interface%20Manual.pdf

 trovan<-serialConnection(NA,port = "com1", mode =   "9600,N,8,1",translation = 'cr', handshake = 'xonxoff') 
 open(trovan)
 res<-read.serialConnection(trovan)
 close(trovan)
 res

[1] " "


Solution

  • library(serial)
    
    library(radio)###have to add some waiting time between each step
    
    trovan<-serialConnection("get_rfid", port = "COM4", mode ="9600,N,8,1", newline = 1, translation = "cr", handshake = "xonxoff") ##windows os
    
    open(trovan)
    
    wait(1)
    
    write.serialConnection(trovan,"N")
    
    wait(2.5)
    
    res<-read.serialConnection(trovan)
    
    close(trovan)