sbcshop / UHF_Lite_HAT_Software

UHF (Ultra High Frequency) Lite HAT is a radio frequency device that operates in the frequency range of 300 MHz to 3 GHz. UHF modules are commonly used in wireless communication systems, including radio-frequency identification (RFID) systems, Wi-Fi networks, and other short-range wireless communication applications.
MIT License
3 stars 0 forks source link

Read TID #1

Closed ItAndrea closed 4 months ago

ItAndrea commented 10 months ago

Good morning everyone, I'm trying to read the TID of my RFID tag, but with the command you recommended, I keep receiving None as a response. Where am I doing wrong? This is my python script

` import time import sys import serial sys.path.append("..") from Library import uhf import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) port = '/dev/ttyS0' baudrate = 115200

GPIO.setup(7,GPIO.OUT)

GPIO.output(7,GPIO.LOW)# Enable the module

EPC_SELECT_CMD = '0C001301000000206000' TID_READ_CMD = '390009000000000' MEMORY_BANK_TID = '02' DATA_LENGTH = '00000008' START_CMD = 'BB00'

reader = uhf.UHF(port,baudrate)

def calculate_checksum(data):

Calcola il checksum

byte_list = [int(data[i:i+2],16) for i in range(0, len(data), 2)]
checksum = sum(byte_list)
return format (checksum, '02x')[-2:]

SELECT TAG FOR EPC

epc_value = '805197454469600000000000' checksum = EPC_SELECT_CMD + epc_value print (checksum) res_checksum = calculate_checksum(checksum) print(res_checksum) checksum_str = str(res_checksum) print (checksum_str) select_tag_command= EPC_SELECT_CMD + epc_value + checksum_str + '7E' reader.send_command(select_tag_command)

Again calculation of checksum only required if you change data length.

checksum = TID_READ_CMD + MEMORY_BANK_TID + DATA_LENGTH

res_checksum = calculate_checksum(checksum)

print(res_checksum)

tid_read_command = START_CMD + TID_READ_CMD + MEMORY_BANK_TID + DATA_LENGTH + res_checksum + '7E' print(tid_read_command) ris_tid = reader.send_command(tid_read_command) print (ris_tid)

ItAndrea commented 9 months ago

First I wanted to thank you, for posting a script to read the TID. (UHFTag_MemoryDataRead.py)(https://github.com/sbcshop/UHF_Lite_HAT_Software/blob/main/Examples/UHFTag_MemoryDataRead.py) I ran it, this came out, but it's not the TID of the tag, the TID should be this: E2801170200004CE73970956 image

sbcshop3 commented 4 months ago

Did you change the Memory_bank value, 2 is needed for TID read operation.