2

I want to get a WCR3237-700 ID Tech USB card reader and attach it to my raspberry Pi. The end goal is to use it to unlock a magnetic lock (when the correct card.) I am currently running PHP scripts on this Pi, so a PHP solution would be nice. I'm also use wiringPi library.

Device: http://www.barcodesinc.com/idtech/part-wcr3237-700us.htm#specs

  • 2
    What have you done so far? Where are you running into issues? You've stated what you want to do, but you haven't asked a question. (Well I guess you did imply that you wanted someone to hand you a ready made solution) – Tyson Sep 12 '15 at 3:36
3

Your card reader is a usb card reader that acs like a keyboard and spits out the value as if keys were being pressed. It looks as if you should be able to use the fgetc()function in php to get keyboard input from the keyboard. Assuming your usb card reader gives an enter key when you scan a card the you should be able to take that usb card reader. Personally for this I would be using node.js as it's easy to take keyboard input. Just use something like this...

var stdin = process.openStdin();
stdin.on('data', function(chunk) { console.log("You pressed the keys: " + chunk); });

But instead of spitting the output into the console then check it against your database and if it's correct unlock the door.

  • It's indeed a HID device which indeed acts as a normal keyboard. PHP in general is synchroneous oriented so it makes much more sense to handle those events in node.js. It will save you a lot of headaches. – EDP Oct 13 '15 at 9:05
1

I have used other brands of card reader with the RPi. They are generally serial devices you can read and write to at the block level.

PySerial will do the trick.

Here is an example of a script that can read and write mag cards using PySerial:

https://www.triades.net/msr605-driver.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.