How to get (read) data from RFID reader 900mhz to ESP32

flavioavilela
Posts: 4
Joined: Sun Jul 05, 2020 12:45 am

How to get (read) data from RFID reader 900mhz to ESP32

Postby flavioavilela » Sun Jul 05, 2020 1:03 am

I'm not so familiar with ESP32 and a need a help.

I have this setup:
RFID Sensor 900mhz passive.
RFID tag like a cow earring.
ESP32 OLED LoRa.
Protoboard and some jumpers.

I need to read this cow earring RFID tag number from the RFID sensor to my ESP32. I have connected the black and red wire to power and the white wire to ESP32 36 GPIO.
I have tested some codes like a analogRead(), digitalRead(). I even tried Serial.read() and external interrupt but I wasn't able to read this RFID tag number.

Can anyone help me to read this number???

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: How to get (read) data from RFID reader 900mhz to ESP32

Postby ESP_Sprite » Sun Jul 05, 2020 7:32 am

You will need to know what protocol the RFID reader speaks, then use something compatible on the ESP32 side to receive that. Just randomly trying APIs in order to hope one works won't get you far. Either see if the RFID reader has documentation, or see if you can figure out what chip it uses and see if you can find documentation for that.

flavioavilela
Posts: 4
Joined: Sun Jul 05, 2020 12:45 am

Re: How to get (read) data from RFID reader 900mhz to ESP32

Postby flavioavilela » Sun Jul 05, 2020 4:31 pm

Hi, thanks for your reply.

I figured out that this RFID reader documentation is very poor, but I have found the manual that apparently is used to this RFID reader.
According to this manual and a many posts in forums, I figured out a way to read this data. This is make by sending a digitalWrite and Serial2.write commands. Later, in loop() command verify if the Serial2.available() is higher than 0. If so, I should make Serial2.read();

Additionaly, I have a RS232 to TTL conversor and put the TX pin from TTL into RX pin from ESP32 (pin 16).

To explain this batter, follow the code below:
  1.  
  2. void sendIdentifyCmd () // Command to request ID tag from RFID sensor.
  3.   {
  4.     digitalWrite(16,HIGH); //port 16 from ESP32 (RX)
  5.     Serial2.write (0x7C);    
  6.     Serial2.write (0xFF);
  7.     Serial2.write (0xFF);  
  8.     Serial2.write (0x11);                  
  9.     Serial2.write (0x32);
  10.     Serial2.write (0x00);
  11.     Serial2.write (0x43);                
  12.     digitalWrite(16,LOW);            
  13.   }
Running this code I send the command to request the ID.

my setup() code is like that:
  1. void setup() {
  2.     //inicialize antena
  3.     Serial.begin(115200);
  4.     delay(1000);  
  5.     Serial.print("Ready to receive TAG!\n");
  6.     Serial2.begin (9600, SERIAL_8N1, 16);
  7.     delay(1000);
  8.   }
And my loop() code is like that:
  1. void loop(){  
  2.   sendIdentifyCmd();
  3.   delay(1000);
  4.   while (Serial2.available() > 0) {
  5.     tag = Serial2.read();
  6.    
  7.     //just to test
  8.     if (tag < 16)
  9.       Serial.print("0");
  10.     Serial.print(tag, HEX);
  11.     Serial.print(' ');
  12.     delay(1000);
  13.   }  
  14. }
What I'm doing wrong?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: How to get (read) data from RFID reader 900mhz to ESP32

Postby ESP_Sprite » Mon Jul 06, 2020 8:45 am

I am not particularily with Arduino, so I can't give you a solution for this, but in general I imagine a Serial.write command will return when the byte is *queued* in the uart, not when it's sent. So the digitalWrite(16,LOW); line may actually be executed too early.

Who is online

Users browsing this forum: No registered users and 82 guests