Photon RFID ID-12LA Help

Hi, I’m using an ID-12LA with the Sparkfun RFID starter kit (https://learn.sparkfun.com/tutorials/sparkfun-rfid-starter-kit-hookup-guide?_ga=1.37092261.489843712.1449352366) to put rfid functionality to my photon. I’m using this code to read from the rx and tx pins into my Serial and Serial1 ports:

void setup()  
{
   Serial.begin(9600);
   Serial1.begin(9600);
}

void loop()
{
   while (Serial1.available())
   Serial.write(Serial1.read());
   while (Serial.available())
   Serial1.write(Serial.read());
}

However, when I open up my serial read out, the tags that are printed aren’t the number tags like I would expect (7C0056ABB435). They look like this: ?d^▒f▒▒ٹ2*▒▒▒

What should I do to fix this? Thanks for the help in advance!

Try a search for the sensor on the forums. There are quite a few topics about it from which you can get a lot of information.
If I’m not mistaken there are even libraries available for the sensor which would make things a lot easier.

If it is like the id20 it is not that simple.
You have a start byte (2) , end byte(3) and checksums bytes.
You can just serial in, serial out .

Thanks for the help, I got my tags working and reading in serial. But now I need to take that tag and use it as a variable to be posted to my dashboard and website that I’m developing. I know how to use Particle.variable() and Particle.dashboard(), but how do I put the tag into a variable? Here’s my code so far, I just had to change write to print to get the correct character conversion.

void setup()  
{
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop()
{
  while (Serial1.available())
    Serial.print(Serial1.read());
  while (Serial.available())
    Serial1.print(Serial.read());
    }
}

Variables aren't posted but requested, that's a big difference.

And that doesn't exist I believe...

That said, I think you should have a look at particle.publish() and perhaps the tutorial section of the forums. Search for @bko's tutorials on both variables as well as server sent events :smile:

@Moors7 Thanks for clearing that up, I meant particle.publish() originally btw. Any other suggestions for getting my readout into a variable?

I’ve only ever played with that sensor for a couple of minutes, but I know that there are some very nice topics about it on the forums. If you have a search, you’re sure to find some examples. Using a library might also help.

2 Likes