🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    UHF RFID on a M5Core2

    Modules
    4
    8
    7.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gleon
      last edited by

      Hi!
      I’ve been trying to compile the demo sketch for multiple reads.

      With some tweaking I was able to compile the demo single read sketch... But i have not been able to compile the multiple read.

      I've switched the library: #include <M5Core2.h> and also the ports for the serial comm:
      Serial2.begin(115200, SERIAL_8N1, 33, 32);

      But i could not make the multiple read sketch to compile.

      Actually, not sure if I'm having problems with this part of the code:
      RFID.Set_transmission_Power(2600);
      RFID.Set_the_Select_mode();
      RFID.Delay(100);
      RFID.Readcallback();
      RFID.clean_data();

      or this one:
      cards = RFID.Multiple_polling_instructions(6);
      for (size_t i = 0; i < cards.len; i++)
      {
      if(cards.card[i]._EPC.length() == 24)
      {
      Serial.println("RSSI :" + cards.card[i]._RSSI);
      Serial.println("PC :" + cards.card[i]._PC);
      Serial.println("EPC :" + cards.card[i]._EPC);
      Serial.println("CRC :" + cards.card[i]._CRC);
      }
      }
      Serial.println(" ");
      RFID.clean_data();

      Does anyone have aby thoughts on where to problem could be?

      Bat21B 2 Replies Last reply Reply Quote 0
      • Bat21B
        Bat21 @gleon
        last edited by Bat21

        @gleon
        Hello
        I am in your same situation, but I can´t even with simple reading.
        If you want we can work together since we have the same devices.
        IIFLOW examples do not work, the EPC only shows 6 characters.

        Thanks.

        1 Reply Last reply Reply Quote 0
        • K
          kylebuttress
          last edited by

          Hi

          Not sure if this will help. I was in a similar situation. However I found I was using the incorrect Tag type. I needed the following tag type ISO 18000-6C, EPC Class1 Gen2 standard protocol.

          Once I had these tags the example code worked as expected, I now have a functional unit that reads multiple tags using M5Paper and M5 Core with Micropython, and is working well for my project.

          Bat21B C 2 Replies Last reply Reply Quote 0
          • Bat21B
            Bat21 @kylebuttress
            last edited by

            @kylebuttress
            Hello
            I'm going to try, to see what kind of labels I have.
            Thank you

            Bat21B 1 Reply Last reply Reply Quote 0
            • Bat21B
              Bat21 @Bat21
              last edited by

              @kylebuttress
              Hello,
              Yes, they are the ones I have EPC Global UHF Class 1 Gen 2 / ISO 18000-6C uses them Decathlon. I have Core 2 and Atom Lite, it does not work in any of the cases.
              IIFOW does not work for examples and Arduino Libreria either.

              Thank you

              1 Reply Last reply Reply Quote 0
              • Bat21B
                Bat21 @gleon
                last edited by

                @gleon said in UHF RFID on a M5Core2:

                Hi!
                I’ve been trying to compile the demo sketch for multiple reads.

                With some tweaking I was able to compile the demo single read sketch... But i have not been able to compile the multiple read.

                I've switched the library: #include <M5Core2.h> and also the ports for the serial comm:
                Serial2.begin(115200, SERIAL_8N1, 33, 32);

                But i could not make the multiple read sketch to compile.

                Actually, not sure if I'm having problems with this part of the code:
                RFID.Set_transmission_Power(2600);
                RFID.Set_the_Select_mode();
                RFID.Delay(100);
                RFID.Readcallback();
                RFID.clean_data();

                or this one:
                cards = RFID.Multiple_polling_instructions(6);
                for (size_t i = 0; i < cards.len; i++)
                {
                if(cards.card[i]._EPC.length() == 24)
                {
                Serial.println("RSSI :" + cards.card[i]._RSSI);
                Serial.println("PC :" + cards.card[i]._PC);
                Serial.println("EPC :" + cards.card[i]._EPC);
                Serial.println("CRC :" + cards.card[i]._CRC);
                }
                }
                Serial.println(" ");
                RFID.clean_data();

                Does anyone have aby thoughts on where to problem could be?

                Gleon,
                What Sketch do you use?
                You can't see EPC or Aton Lite or Core2
                Thank s

                1 Reply Last reply Reply Quote 0
                • C
                  clabbersja @kylebuttress
                  last edited by

                  @kylebuttress Do you happen to still have the code for this project? Is it possible you could send it?

                  K 1 Reply Last reply Reply Quote 0
                  • K
                    kylebuttress @clabbersja
                    last edited by kylebuttress

                    @clabbersja

                    Sure, this is running on a M5Paper, though I have had something very similar running on a M5Core, This is the small segment of an app written for long rang tag reading at a workshop to track keys and other equipment. I have kept in the tag reading portion. I hope this helps. Some of it is not needed for the reading, just too lazy to remove from the snippet.

                    from m5stack import *
                    from m5ui import *
                    from uiflow import *
                    import wifiCfg
                    import time
                    import unit
                    import _thread
                    import os
                    import random
                    import urequests
                    from m5stack import touch
                    
                    
                    setScreenColor(15)
                    buzzer_1 = unit.get(unit.BUZZER, unit.PORTB)
                    uhf_rfid_0 = unit.get(unit.UHF_RFID, unit.PORTC)
                    
                    version = 0.89
                    EPC = None
                    epc_bool = None
                    temp = None
                    tagList = []
                    TouchCordx = None
                    TouchCordy = None
                    rsense = 2
                    readerKey = None
                    businessKey = None
                    
                    uhf_rfid_0.set_region(uhf_rfid_0.REGIN_US)
                    uhf_rfid_0.automatic_freq_hopping(0xFF)
                    uhf_rfid_0.set_channel_freq(924.25)
                    epc_bool = 0
                    uhf_rfid_0.set_select_mode(0x01)
                    
                    print("Beapnow Reader : " + str(version))
                    print("---")
                    
                    def genKey(length):
                        letters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
                        result_str = ''.join(random.choice(letters) for i in range(length))
                        return result_str
                    
                    def SetTouchCordenate():
                        global TouchCordx, TouchCordy
                        print("Setting Touch")
                        TouchCordx, TouchCordy, s, status = touch.read()
                        print(TouchCordx)
                        print(TouchCordy)
                    
                    
                    def uhf_rfid_cb(epc_no, dBm):
                        global EPC, epc_bool, temp
                        EPC = epc_no
                        _ = dBm
                        # label5.setText(str(EPC))
                        print("2")
                        print("---")
                        pass
                    
                    # while not epc_bool:
                    #  epc_bool = uhf_rfid_0.multiple_polling_read(uhf_rfid_cb, 100)
                    # while not (uhf_rfid_0.select_tag_param(EPC)):
                    #  pass
                    
                    ssid = None
                    pc = None
                    keyboard = None
                    sett = True
                    sim = True
                    bz = False
                    readerBool = True
                    touchBool = False
                    bzfreq = 500
                    la = []
                    ba = []
                    alphabet = [
                        "0",
                        "1",
                        "2",
                        "3",
                        "4",
                        "5",
                        "6",
                        "7",
                        "8",
                        "9",
                        "a",
                        "b",
                        "c",
                        "d",
                        "e",
                        "f",
                        "g",
                        "h",
                        "i",
                        "j",
                        "k",
                        "l",
                        "m",
                        "n",
                        "o",
                        "p",
                        "q",
                        "r",
                        "s",
                        "t",
                        "u",
                        "v",
                        "w",
                        "x",
                        "y",
                        "z",
                    ]
                    tu = False
                    ltime = 0
                    dsc = 0
                    rr0 = None
                    rr1 = None
                    rr2 = None
                    rr3 = None
                    rr4 = None
                    rr5 = None
                    rr6 = None
                    rr7 = None
                    
                    label0 = M5TextBox(502, 25, "Beapnow Tag Reader", lcd.FONT_DejaVu40, 0, rotate=90)
                    labelVersion = M5TextBox(
                        460, 30, "version: " + str(version), lcd.FONT_Default, 0, rotate=90
                    )
                    
                    circle0 = M5Circle(492, 904, 30, 12, 0)
                    rectangle0 = M5Rect(290, 875, 60, 60, 12, 0)
                    rectangle1 = M5Rect(380, 875, 60, 60, 12, 0)
                    label1 = M5TextBox(334, 815, "Wifi", lcd.FONT_DejaVu24, 0, rotate=90)
                    label2 = M5TextBox(420, 663, "Read Sensitivity", lcd.FONT_DejaVu24, 0, rotate=90)
                    rs2 = M5TextBox(420, 882, "High", lcd.FONT_DejaVu18, 0, rotate=90)
                    label3 = M5TextBox(501, 770, "Wifi off", lcd.FONT_DejaVu24, 0, rotate=90)
                    label9 = M5TextBox(501, 620, "Waiting...", lcd.FONT_DejaVu24, 0, rotate=90)
                    label7 = M5TextBox(512, 892, "", lcd.FONT_DejaVu40, 0, rotate=90)
                    
                    rectangle7 = M5Rect(170, 307, 200, 410, 14, 0)
                    label12 = M5TextBox(334, 322, "Tag #", lcd.FONT_DejaVu40, 0, rotate=90)
                    label13 = M5TextBox(331, 446, "1234567890", lcd.FONT_DejaVu40, 0, rotate=90)
                    label14 = M5TextBox(276, 431, "READ Success", lcd.FONT_DejaVu24, 0, rotate=90)
                    label15 = M5TextBox(227, 461, "Date Time", lcd.FONT_DejaVu24, 0, rotate=90)
                    
                    def touchScreen():
                        global touchBool, ssid, pc, tu
                        print("Waiting for touch")
                        btty = 6
                        while True:
                            if touch.status():
                                print(str(touch.read()))
                                
                            wait_ms(5)
                    
                    
                    def reader():
                        global bz, dsc, ltime, readerBool,rsense
                    
                        temp = 0
                        count = 0
                        clean = 0
                        print("Waiting for RFID")
                        print("sensitivity = "+str(rsense))
                        while True:
                            ltime += 1
                    
                            # while not temp:
                            temp = uhf_rfid_0.single_polling()
                    
                            if temp:
                                label13.setText(str(temp[0]))
                                print("-----")
                                print(temp[0])
                                print(temp[1])
                                print("-----")
                                count += 1
                                lcd.show()
                            wait_ms(2)
                        
                    def file_exists(filename):
                        try:
                            return (os.stat(filename)[0] & 0x4000) == 0
                        except OSError:
                            return False
                        
                    def readSense():
                        global rsense
                        print("changing rsense")
                        if rsense == 2:
                          rsense = 5
                          rs2.setText("Low")
                        else:
                          rsense = 2
                          rs2.setText("High")
                        lcd.partial_show(370, 875, 60, 60)  
                        
                        
                    def checkConfig():
                    	# some check here
                    	
                    	return True
                    
                    def startTime():
                        print("START TIME")
                    
                    
                    #    time = 0
                    #    loop = True
                    #    while loop:
                    #        if time > 29:
                    #            logTags()
                    #            loop = False
                    #        time += 1
                    #        print(time)
                    #        wait(.95)
                    
                    
                    label13.setText("")
                    ssid = ""
                    pc = ""
                    lcd.show()
                    
                    _thread.start_new_thread(touchScreen, ())
                    
                    if checkConfig():
                        _thread.start_new_thread(reader, ())
                        print("Ready for tags")
                    else:
                        print("waiting for register")
                    
                    
                    
                    
                    
                    
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post