Recent

Author Topic: RFID Reader  (Read 18032 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
RFID Reader
« on: June 13, 2016, 10:07:11 pm »
Hello guys, I bought an RFID reader as in the image. Working properly, if I pass the card on the reader wrote to me on an editor the value contained in the paper. Just need to want to understand how to read from a command reader. I leave the card on the reader and then by lazarus I say: Read the content. Who explains to me how?

http://ecx.images-amazon.com/images/I/61uoO5FcocL._SX522_.jpg
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RFID Reader
« Reply #1 on: June 13, 2016, 10:34:09 pm »
not sure about your RFID, but these guys supply APIs for their readers. Surprisingly - Lazarus is listed among platforms. ... wait ... this is Serbian company. Makes sense now.
and it might actually work with your Mifare too.
« Last Edit: June 13, 2016, 10:37:01 pm by skalogryz »

wp

  • Hero Member
  • *****
  • Posts: 13225
Re: RFID Reader
« Reply #2 on: June 13, 2016, 10:42:12 pm »
Surprisingly - Lazarus is listed among platforms.
... and Lazarus is listed before Borland Delphi. :D

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RFID Reader
« Reply #3 on: June 13, 2016, 10:58:43 pm »
... and Lazarus is listed before Borland Delphi. :D
hm... I wonder if that means that neither Code Gear nor Embarcadero Delphi are supported.

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
Re: RFID Reader
« Reply #4 on: June 13, 2016, 11:22:32 pm »
I tried with their example, but can not login! I have to understand why. No one has experience in this regard?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

rvk

  • Hero Member
  • *****
  • Posts: 6886
Re: RFID Reader
« Reply #5 on: June 14, 2016, 12:09:22 am »
No one has experience in this regard?
Search the forum for RFID. There should be some experience.
I found this:
http://forum.lazarus.freepascal.org/index.php/topic,25783.msg157035.html#msg157035

rvk

  • Hero Member
  • *****
  • Posts: 6886
Re: RFID Reader
« Reply #6 on: June 14, 2016, 12:14:40 am »
B.T.W. what I understand is that the reader itself outputs the data as keyboard information. But that only works when the card is initially detected. You want to read a card which is already read (you want to pull the data from the card-reader). I'm not sure if the card-reader works like that. It's possible you would always need to "swipe" to get a reading (but I'm not sure of that).

Maybe opening the card-reader directly as /dev/ttyUSB0 it will spit out the data from the "current" card.

You should see if your card reader supports BRI (basic reader interface). If it does you can communicate with it via certain commands (look for the manual online) via /dev/ttyUsbx. I'm sure there is a command to list all card-numbers in range.
« Last Edit: June 14, 2016, 12:47:48 am by rvk »

avra

  • Hero Member
  • *****
  • Posts: 2566
    • Additional info
Re: RFID Reader
« Reply #7 on: June 14, 2016, 03:20:09 pm »
I leave the card on the reader and then by lazarus I say: Read the content. Who explains to me how?

Make a form in Lazarus, then when you want to read RFID you should instruct the user to use RFID with a message, and then you focus programatically on Edit1 that you have previously created. After Edit1 is focused you use RFID reader and Edit1.Text should contain RFID tag content or number. That's enough to get you started.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
Re: RFID Reader
« Reply #8 on: June 15, 2016, 08:31:06 am »
Hello Avra, I but I want my user leaves the card leaning on the player and when you need my software reads its contents. But at the request of the software. I need to check the user's permissions
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Thaddy

  • Hero Member
  • *****
  • Posts: 18370
  • Here stood a man who saw the Elbe and jumped it.
Re: RFID Reader
« Reply #9 on: June 15, 2016, 12:36:35 pm »
If I understand you correctly you want to check the credentials?
Well, that can not be done before the handshake.
You should write code that AFTER the handshake performs the credentials check.

There is simply no way that the reader can take the initiative. The card needs to be in proximity and needs to present its data first. Then the reader tries a handshake. After that the reader takes over.
« Last Edit: June 15, 2016, 12:39:15 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
Re: RFID Reader
« Reply #10 on: June 15, 2016, 01:09:47 pm »
Maybe I have not explained.

1. The user leaves the card to the reader
2. The user uses a program, when you click on a button, the program asks the reader of the code contained in the card and checks in the database if it is enabled to continue.
3. The user walks away from the station by removing his card (without exiting the program), so if another user can not get to click the button if it does not insert his card.

For this I need the player is called up by the program. I know that some readers allow it and I was hoping that too!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

rvk

  • Hero Member
  • *****
  • Posts: 6886
Re: RFID Reader
« Reply #11 on: June 15, 2016, 01:15:45 pm »
First you need to forget about getting code via the keyboard. That just doesn't work if you want to do a check "if the card is still in range"-access.

What type and brand is the reader exactly and do you have a manual?
What protocols does it support?
What happens if you connect directly via ttyUSBx with the reader?
  (do you have the ability to give commands or is it just one way data-input?)

Optimally you should be able to give a "trigger" command to the reader to read the card in the area. If that works you could do this periodically (say every minute or so) and if the card is not detected you disable your button/program.

(Maybe just connecting to ttyUSBx already triggers it and gives you the card-number)
« Last Edit: June 15, 2016, 01:18:52 pm by rvk »

xinyiman

  • Hero Member
  • *****
  • Posts: 2259
    • Lazarus and Free Pascal italian community
Re: RFID Reader
« Reply #12 on: June 15, 2016, 01:22:48 pm »
So I try to give as a command to make the trigger as you say. Type

echo "get" >> /dev/ttyUSB0
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

rvk

  • Hero Member
  • *****
  • Posts: 6886
Re: RFID Reader
« Reply #13 on: June 15, 2016, 01:23:43 pm »
Yep, or maybe this is already sufficient:
cat /dev/ttyUSB0

In your case a "get" (IF the rfid reader supports it) you would also need to read the output or ttyUSB0 (which that command does not). But maybe a simple read (cat) is sufficient. You'll need to check.
« Last Edit: June 15, 2016, 01:25:31 pm by rvk »

Thaddy

  • Hero Member
  • *****
  • Posts: 18370
  • Here stood a man who saw the Elbe and jumped it.
Re: RFID Reader
« Reply #14 on: June 15, 2016, 01:33:09 pm »
Maybe I have not explained.

1. The user leaves the card to the reader
2. The user uses a program, when you click on a button, the program asks the reader of the code contained in the card and checks in the database if it is enabled to continue.
3. The user walks away from the station by removing his card (without exiting the program), so if another user can not get to click the button if it does not insert his card.

For this I need the player is called up by the program. I know that some readers allow it and I was hoping that too!
So, let's say Elvis has entered the building and John Lennon wants it too? And John should be prevented to enter the building before Elvis has left the building?
That should be done in code, not by the reader.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018