This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

RFID reader integration over RS-232
#1
The example below shows how to integrate Idesco Access 7 C RFID reader over RS-232 port. The script below will read all RFID cards and log IDs. The script is easy adjustable if there is a necessity to trigger specific KNX, Bacnet etc. objects.

Add the following resident script with sleep-time = 0:


Code:
-- init
if not port then
 require('serial')

 port = serial.open('/dev/RS232', { baudrate = 9600 })

 function readid(port)
   local char, byte, line, id, csum, val

   -- wait for start byte
   char = port:read(1, 1)
   if not char then
     return nil, 'timeout'
   end

   -- start byte must be STX
   byte = char:byte(1)
   if byte ~= 2 then
     return nil, 'wrong start byte'
   end

   -- read remaining line
   line = port:read(15, 1)
   if not line then
     return nil, 'failed to read data'
   end

   -- calculate checksum
   csum = 0
   for i = 1, 11 do
     val = tonumber(line:sub(i, i), 16)
     csum = bit.bxor(csum, val)
   end

   -- verify checksum
   if csum ~= tonumber(line:sub(12, 12), 16) then
     return nil, 'invalid checksum'
   end

   -- return ID
   return line:sub(1, 10)
 end
end

id = readid(port)
if id then
 log(id)
end
Reply
#2
Would this also work with the latest Idesco’s 8 CD 2.0 MI readers?
Reply
#3
That's a question for the manufacturer not us Smile You should contact their support.
Reply
#4
Well, obviously I put my question wrongly:
As it might be a matter of opinion, whether this would be is a question for Idesco support or for this forum. Big Grin 

From the point of view of a system integrator, the question arises in particular whether the latest 8 CD 2.0 MI readers from Idesco have already been successfully implemented with LM5 or not. Cool

Anyway, I followed your advice and emailed "their support".
Reply
#5
If the protocol is the same then it will work
Reply


Forum Jump: