Open stefanos990 opened 9 years ago
Have you configured the serial port on the Pi. It's something I don't mention in the documentation that I should add. See the following for instructions:
http://www.microcasts.tv/episodes/2014/08/08/configure-the-serial-port-on-the-raspberry-pi/
If you've done that and are still having issues just let me know.
I've already done that. Here is an example of what I get: https://dl.dropboxusercontent.com/u/57843365/Capture.PNG
Another thing I just remembered is the format selection. If Pin 7 is left floating you'll get garbage. It needs to be tied to GND for the ASCII format to be used by the module. If floating you could get Wiegand26 output which would likely read as garbage.
It's grounded. Specifically I've pin 11 on 3.3V, pin 9 on RX and pin 7 and pin 1 to GND.
Can you send me the contents of your rfid.py file, the URL to where you bought the sensor and tag from, and a picture of your connections? Sounds like you have everything right so not sure what could be going on.
ID-3LA: http://grobotronics.com/rfid-reader-id-3la-125-khz.html Tag: http://grobotronics.com/rfid-tag-125khz.html
Connections: https://dl.dropboxusercontent.com/u/57843365/April_30__2015_at_0758PM.jpeg
rfid.py:
import sys sys.path.append("/home/pi/Desktop/") from ucasts import ID3LA reader = ID3LA() tag = reader.wait_for_scan() if tag != None: print "RFID Tag is : " + tag
The picture cuts off so I can't see where all the connections go on the Pi from the module. Can you send a picture that shows all of the connections? Seems like everything is good. I'm not an antenna expert so is it possible that is an issue? I've only ever used the ID modules that have built-in antennas.
I don't think that neither the antenna or the connections is wrong, because it works fine on an Arduino. Could be this a problem of PuTTY and its encoding?
That's right. Sorry, I forgot you mentioned it working on Arduino. I guess it's possible it could be PuTTY related but probably not likely. Can you test it with the Pi connected directly to a monitor just to rule that out? Also, we can try eliminating my code and just trying a straight serial read with the following code run as sudo:
import serial
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=0.2)
while True:
rcv = port.readline()
if len(rcv) > 10:
print "Tag detected: " + rcv
If you still get gibberish there then something else must be going on. Maybe even a baud issue even though the module says its 9600.
Wow. It seems that with the straight serial read works!
Interesting! The library basically does the exact same thing except it tries to be helpful and strip out certain parts like the checksum and leading/trailing stuff. I'd be interested to see the output if you called get_last_scan
multiple times. To debug you could modify the code around here
https://github.com/sidwarkd/ucasts_pi/blob/master/python/ucasts.py#L315-L316
to print out data
and maybe see if the length is > 10 since a valid read should be. I have it currently set to > 0 but maybe a garbage read could come in at less than 10 characters and should be ignored.
I've connected the ID-3LA (with external antenna) to my Raspberry Pi, and using your script I tried to read an 125 KHz RFID Tag. The script seems to be working, it identifies the card, but the "tag" variable returns a gibberish value instead of a hexadecimal. What did I do wrong?
P.S. I've tried to read via ID-3LA connected to an Arduino and it works fine.