![]() |
|
RFID reader integration over RS-232 - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: RFID reader integration over RS-232 (/showthread.php?tid=256) |
RFID reader integration over RS-232 - edgars - 31.03.2016 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)
endRE: RFID reader integration over RS-232 - Boris - 24.02.2020 Would this also work with the latest Idesco’s 8 CD 2.0 MI readers? RE: RFID reader integration over RS-232 - admin - 25.02.2020 That's a question for the manufacturer not us You should contact their support.
RE: RFID reader integration over RS-232 - Boris - 27.02.2020 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. 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. ![]() Anyway, I followed your advice and emailed "their support". RE: RFID reader integration over RS-232 - admin - 27.02.2020 If the protocol is the same then it will work |