Page 1 of 1

Plugin for RFID Reader RDM6300

Posted: 11 Oct 2016, 15:36
by Thotti
I'm trying to develop a plugin for the RFID Reader Module RDM6300.
Is ist connected via the Serial RX PIN on my NodeMCU.

In my plugin i read the serial data via hardware serial.
I read the serial data in the function PLUGIN_TEN_PER_SECOND and put the result in UserVar[event->BaseVarIndex].
Is this the correct way of reading serial data?

But Something must be wrong. I always get wrong data.
The nearly same code of collecting the rfid tag from the serial data works on my arduino in the loop function.

Any ideas what could be wrong?

Re: Plugin for RFID Reader RDM6300

Posted: 11 Oct 2016, 15:58
by Martinus
Have a look at the Ser2Net plugin (020). You can use this call:

case PLUGIN_SERIAL_IN:
{
}

There can be one plugin active that intercepts hardware serial data.

Re: Plugin for RFID Reader RDM6300

Posted: 14 Oct 2016, 09:55
by Thotti
Thanks.
I put my code into:

case PLUGIN_SERIAL_IN:
{
}

In the log i can see the RFID Tag by printing UserVar[event->BaseVarIndex].
But it seems that it is not accessable in the rules and the value of "Tag" is also not shown on the "devices page".
The event for that device is never triggered. The device is named "RFID" and the Variablename is "Tag".
So it should be accessable via RFID#Tag, shouldn't it?

Any idea?

Re: Plugin for RFID Reader RDM6300

Posted: 14 Oct 2016, 13:30
by Martinus
You asked how to read serial data, and using the case PLUGIN_SERIAL_IN call is the way to go. Making a working plugin is another thing ;)

This is how it should basically work when the data is received and processed, sample from the RFID plugin 008:

Code: Select all

UserVar[event->BaseVarIndex] = (Plugin_008_keyBuffer & 0xFFFF);
UserVar[event->BaseVarIndex + 1] = ((Plugin_008_keyBuffer >> 16) & 0xFFFF);
String log = F("RFID : Tag: ");
log += Plugin_008_keyBuffer;
addLog(LOG_LEVEL_INFO, log);
sendData(event);
Do you run the sendData function call in your plugin?

Re: Plugin for RFID Reader RDM6300

Posted: 14 Oct 2016, 19:21
by Thotti
This is my code:

Code: Select all

case PLUGIN_SERIAL_IN:
      {
        if (Plugin_034_init)
        {
            Plugin_034_receivedTag = false;
            
            if(Serial.available() > 0) {          // if data available from reader 
              if((val = Serial.read()) == 2) {   // check for header 
                bytesread = 0; 
                while(bytesread<10) {              // read 10 digit code 
                  if( Serial.available() > 0) { 
                    val = Serial.read(); 
                    if((val == 2)||(val == 3)) { // if header or stop bytes before the 10 digit reading 
                      break;                       // stop reading 
                    } 
                    Plugin_034_tagNumber[bytesread] = val;         // add the digit           
                    bytesread++;                   // ready to read next digit  
                  } 
                } 
                if(bytesread == 10) {              // if 10 digit read is complete 
                  Plugin_034_receivedTag = true;
                  //Serial.print("TAG code is: ");   // possibly a good TAG 
                  //Serial.println(code);            // print the TAG code 
                } 
                bytesread = 0; 
              } 
            } 

            if(Plugin_034_receivedTag){
              unsigned long Plugin_034_keyBuffer = Plugin_034_hex2int(Plugin_034_tagNumber, 10);
              UserVar[event->BaseVarIndex] = (Plugin_034_keyBuffer & 0xFFFF);
              UserVar[event->BaseVarIndex + 1] = ((Plugin_034_keyBuffer >> 16) & 0xFFFF);
              
              String log = F("RFID : Tag: ");
              log += UserVar[event->BaseVarIndex];
              addLog(LOG_LEVEL_INFO, log);
              sendData(event);
              success = true;

              //memset(Plugin_034_tagNumber,0,sizeof(Plugin_034_tagNumber));
              // this clears the rest of data on the serial, to prevent multiple scans
              while (Serial.read() >= 0) {
                Serial.flush(); // trying
              }
              delay(500);
            }
            
        }
        break;
      }
What could be the problem?

Re: Plugin for RFID Reader RDM6300

Posted: 14 Oct 2016, 20:03
by Martinus
Let me have another look at the ESP Easy internals. It may well be that this is not directly supported yet, as no other serial plugin refers back to it's task.

Re: Plugin for RFID Reader RDM6300

Posted: 17 Oct 2016, 08:18
by Thotti
Did you already have a look at the ESP Easy internals? ;-)

Re: Plugin for RFID Reader RDM6300

Posted: 20 Oct 2016, 16:02
by Martinus
Thotti wrote:Did you already have a look at the ESP Easy internals? ;-)
I did and it will not work without some workarounds.

But i also googled on RDM6300 and it looks like the output could be similar to a RFID device that i've used on the old Nodo project:
ID12LA.jpg
ID12LA.jpg (21.84 KiB) Viewed 14454 times
It's an ID-12LA from ID Innovations and produces serial output. I have a working plugin that i can push to the playground.

The Nodo Shop also sells the RDM6300. If Nodo users have been using this reader with the RFID Nodo plugin, than it should also work with this ESP Easy plugin without modifications.

Re: Plugin for RFID Reader RDM6300

Posted: 20 Oct 2016, 18:37
by Thotti
That would be great. Can you push it to the playground?
I would like to check it out. :-)

Re: Plugin for RFID Reader RDM6300

Posted: 21 Oct 2016, 17:06
by Martinus
Thotti wrote:That would be great. Can you push it to the playground?
I would like to check it out. :-)
Pushed to the playground.
Please check if P116 works for this device.

Re: Plugin for RFID Reader RDM6300

Posted: 22 Oct 2016, 09:40
by Thotti
Thank you very much! It works with the RDM6300. :D

Re: Plugin for RFID Reader RDM6300

Posted: 18 Mar 2017, 21:14
by ludogomez
Hi,

I try the plugin with RDM6300 and it's not working.

I connect the RDM6300 on RX on my wemos D1 mini and I can't read my tags.

Can you send me an advice ?
Please

Thanks a lot,
Regards

Re: Plugin for RFID Reader RDM6300

Posted: 17 May 2017, 13:54
by dumdidum
hi,
is it possible to change the plugin to read the full 10 digits - for now i get only 8.
so the card 7800108b38 gets read as 00108b38.
a checkbox to get a hex or dec value would also be nice.

Re: Plugin for RFID Reader RDM6300

Posted: 18 May 2017, 13:48
by dumdidum
is it possible to have a string as a sensor value ?
the long int store only 32bit em4001 cards have 40bit
so that was the reason why one byte is missing here.

Re: Plugin for RFID Reader RDM6300

Posted: 28 Apr 2018, 13:53
by fraeggle
When i try to compile with this plugin i allways get an error.

invalid conversion from 'unsigned int*' to 'int' [-fpermissive]

event->idx = Settings.TaskDeviceID[index];

Regards Peter

Re: Plugin for RFID Reader RDM6300

Posted: 08 Jul 2018, 00:57
by Naesstrom
Is this now included in the latest normals?