UHF-RFID Unit
Support the following products:
Micropython Example:
1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4 5import os, sys, io 6import M5 7from M5 import * 8from unit import UHFRFIDUnit 9 10 11nbiot2_0 = None 12uhfrfid_0 = None 13 14 15epc = None 16 17 18def setup(): 19 global nbiot2_0, uhfrfid_0, epc 20 21 M5.begin() 22 Widgets.fillScreen(0x222222) 23 24 uhfrfid_0 = UHFRFIDUnit(2, port=(18, 17)) 25 epc = uhfrfid_0.inventory() 26 print(epc) 27 uhfrfid_0.select(UHFRFIDUnit.S0, 0b000, UHFRFIDUnit.RFU, 0x20, False, epc) 28 uhfrfid_0.write_mem_bank(UHFRFIDUnit.RFU, 0x00, "12345678", "00000000") 29 print(uhfrfid_0.read_mem_bank(UHFRFIDUnit.RFU, 0x00, 4, "00000000")) 30 31 32def loop(): 33 global nbiot2_0, uhfrfid_0, epc 34 M5.update() 35 36 37if __name__ == "__main__": 38 try: 39 setup() 40 while True: 41 loop() 42 except (Exception, KeyboardInterrupt) as e: 43 try: 44 from utility import print_error_msg 45 46 print_error_msg(e) 47 except ImportError: 48 print("please update to latest firmware")
UIFLOW2 Example:
class UHFRFIDUnit
Constructors
Methods
Demodulator
- UHFRFIDUnit.get_demodulator_mixer() int
Get demodulator mixer value.
- Return int:
demodulator mixer value.
- Options:
0x00: 0dB
0x01: 3dB
0x02: 6dB
0x03: 9dB
0x04: 12dB
0x05: 15dB
0x06: 16dB
UIFLOW2:
- UHFRFIDUnit.set_demodulator_mixer(value: int) bool
Set demodulator mixer value.
- Parameters:
value (int) – demodulator mixer value.
- Options:
0x00: 0dB
0x01: 3dB
0x02: 6dB
0x03: 9dB
0x04: 12dB
0x05: 15dB
0x06: 16dB
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.get_demodulator_amplifier() int
Get demodulator amplifier value.
- Return int:
demodulator amplifier value.
- Options:
0x00: 12dB
0x01: 18dB
0x02: 21dB
0x03: 24dB
0x04: 27dB
0x05: 30dB
0x06: 36dB
0x07: 40dB
UIFLOW2:
- UHFRFIDUnit.set_demodulator_amplifier(value: int) bool
Set demodulator amplifier value.
- Parameters:
value (int) – demodulator amplifier value.
- Options:
0x00: 12dB
0x01: 18dB
0x02: 21dB
0x03: 24dB
0x04: 27dB
0x05: 30dB
0x06: 36dB
0x07: 40dB
- Return bool:
True if success, False if failed.
UIFLOW2:
Working
- UHFRFIDUnit.get_working_region() int
Get work region.
- Return int:
work region.
- Options:
UHFRFIDUnit.CN_900MHZ: China 900MHz
UHFRFIDUnit.CN_800MHZ: China 800MHz
UHFRFIDUnit.USA: USA
UHFRFIDUnit.EUR: EUR
UHFRFIDUnit.KR: KR
UIFLOW2:
- UHFRFIDUnit.set_working_region(region: int) bool
Set work region.
- Parameters:
region (int) – work region.
- Options:
UHFRFIDUnit.CN_900MHZ: China 900MHz
UHFRFIDUnit.CN_800MHZ: China 800MHz
UHFRFIDUnit.USA: USA
UHFRFIDUnit.EUR: EUR
UHFRFIDUnit.KR: KR
- Return int:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.get_working_channel() int
Get work channel.
- Return int:
work channel. the range is from 0 to 19.
UIFLOW2:
- UHFRFIDUnit.set_working_channel(channel: int) bool
Set work channel.
- Parameters:
channel (int) – work channel. the range is from 0 to 19.
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.insert_working_channel(channel: int) bool
Insert work channel.
- Parameters:
channel (int) – work channel. the range is from 0 to 19.
- Return bool:
True if success, False if failed.
UIFLOW2:
RF Power
- UHFRFIDUnit.get_channel_rssi(channel: int) int
Get channel RSSI value.
- Parameters:
channel (int) – work channel. the range is from 0 to 19.
- Return int:
channel RSSI value. the unit is dBm.
UIFLOW2:
- UHFRFIDUnit.get_blocking_signal_strength(channel: int) int
Get blocking signal strength.
- Parameters:
channel (int) – work channel. the range is from 0 to 19.
- Return int:
blocking signal strength. the unit is dBm.
UIFLOW2:
- UHFRFIDUnit.get_tx_power() int
Get TX power.
- Return int:
TX power. the unit is dBm. the range is from -7dBm to 30dBm.
UIFLOW2:
Module Information and Settings
- UHFRFIDUnit.get_hardware_version() str
Get hardware version.
- Return str:
hardware version.
UIFLOW2:
- UHFRFIDUnit.get_firmware_version() str
Get firmware version.
- Return str:
firmware version.
UIFLOW2:
Read and Write Tag
- UHFRFIDUnit.inventory() str
Get tag epc code. if no tag is found, return empty string.
- Returns:
hexadecimal string of tag epc code.
UIFLOW2:
- UHFRFIDUnit.set_select_mode(mode: int) bool
Set select mode.
- Parameters:
mode (int) – select mode.
- Options:
0x00: need select command
0x01: no need select command
0x02: part operation need select command
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.select(target: int, action: int, membank: int, pointer: int, truncate: bool, mask: str) bool
Set select tag.
- Parameters:
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.set_access_password(old_password: str, new_password: str) None
Set access password.
- Parameters:
UIFLOW2:
- UHFRFIDUnit.set_kill_password(password) None
Set kill password.
- Parameters:
password (str) – kill password. hexadecimal string.
UIFLOW2:
- UHFRFIDUnit.kill(password: str) bool
Kill tag.
- Parameters:
password (str) – kill password. hexadecimal string.
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.set_query_param(dr=0b0, m=0b00, tr_ext=0b1, sel=0b00, session=0b00, target=0b0, q=0b0100) bool
Set query parameter.
- Parameters:
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.lock_mem_bank(kill_lock: int = 0b00, access_lock: int = 0b00, epc_lock: int = 0b00, tid_lock: int = 0b00, user_lock: int = 0b00, access: str = '00000000') bool
Lock memory bank.
- Parameters:
kill_lock (int) –
kill lock.
- Options:
UHFRFIDUnit.OPEN: open
UHFRFIDUnit.LOCK: lock
UHFRFIDUnit.PERMA_OPEN: perma open
UHFRFIDUnit.PERMA_LOCK: perma lock
access_lock (int) –
access lock.
- Options:
UHFRFIDUnit.OPEN: open
UHFRFIDUnit.LOCK: lock
UHFRFIDUnit.PERMA_OPEN: perma open
UHFRFIDUnit.PERMA_LOCK: perma lock
epc_lock (int) –
epc lock.
- Options:
UHFRFIDUnit.OPEN: open
UHFRFIDUnit.LOCK: lock
UHFRFIDUnit.PERMA_OPEN: perma open
UHFRFIDUnit.PERMA_LOCK: perma lock
tid_lock (int) –
tid lock.
- Options:
UHFRFIDUnit.OPEN: open
UHFRFIDUnit.LOCK: lock
UHFRFIDUnit.PERMA_OPEN: perma open
UHFRFIDUnit.PERMA_LOCK: perma lock
user_lock (int) –
user lock.
- Options:
UHFRFIDUnit.OPEN: open
UHFRFIDUnit.LOCK: lock
UHFRFIDUnit.PERMA_OPEN: perma open
UHFRFIDUnit.PERMA_LOCK: perma lock
access (str) – access password. hexadecimal string.
UIFLOW2:
- UHFRFIDUnit.read_mem_bank(bank: int, offset: int, length: int, access_password: str = '00000000') str
Read memory bank.
- Parameters:
- Return str:
data. hexadecimal string.
UIFLOW2:
Impinj Monza
- UHFRFIDUnit.get_impinj_monza_qt_sr(persistence, password: str = '00000000') bool
Get Impinj Monza QT_SR.
- Parameters:
- Return bool:
QT_SR status.
UIFLOW2:
- UHFRFIDUnit.set_impinj_monza_qt_sr(qt_sr: bool, persistence: int, password: str = '00000000') bool
Set Impinj Monza QT_SR.
- Parameters:
- Return bool:
True if success, False if failed.
UIFLOW2:
- UHFRFIDUnit.get_impinj_monza_qt_mem(persistence, password: str = '00000000') bool
Set Impinj Monza QT_MEM.
- Parameters:
- Return bool:
QT_MEM status.
UIFLOW2:
NXP
- UHFRFIDUnit.nxp_eas_alarm() str
Get NXP EAS alarm code.
- Return str:
NXP EAS alarm code. hexadecimal string.
UIFLOW2:
- UHFRFIDUnit.get_nxp_config_word(password: str = '00000000') int
Get NXP config word.
- Parameters:
password (str) – access password. hexadecimal string.
- Return int:
NXP config word.
UIFLOW2:
- UHFRFIDUnit.set_nxp_config_word(config_word: int, password: str = '00000000') bool
Set NXP config word.
- Parameters:
- Return bool:
True if success, False if failed.
UIFLOW2: