School Project Help - RFID

Basically, I'm a 6th grader trying to make a project using RFID and I can't code anything useable. Anyone care to help? I'd like to code my rfid toalso use a timer, and once that timer hits zero, and the rfid hasn't been used yet, it will control pin 13 to positive/blink. I have the timer code done, hopefully some of you guys would like to help? Timer code down there.

int timer=0;
bool state=0;
void setup() {
  pinMode(13,OUTPUT);
    
  TCCR0A=(1<<WGM01);    //Set the CTC mode   
  OCR0A=0xF9; //Value for ORC0A for 1ms 
  
  TIMSK0|=(1<<OCIE0A);   //Set  the interrupt request
  sei(); //Enable interrupt
  
  TCCR0B|=(1<<CS01);    //Set the prescale 1/64 clock
  TCCR0B|=(1<<CS00);

 
    
}

void  loop() {
  //in this way you can count 1 second because the interrupt request  is each 1ms
  if(timer>=1000){
    state=!state;
    timer=0;
  }
  
  digitalWrite(13,state);
  
}

ISR(TIMER0_COMPA_vect){    //This  is the interrupt request
  timer++;
}

P.S. if it's wrong I'm sorry

ONCE AGAIN thank you all so much.

have a read of how-to-get-the-best-out-of-this-forum
e.g.

  1. what microcontroller are you using?
  2. have you tested the RFID reader?
  3. did it work? if not how have you connected it?
  4. for timing non-blocking events why not use millis()

Thanks Horace,

1, I'm using the Arduino uno, but I also have a backup ESP8266
2,3, The RFID tester hasn't been tested, will try later and update
4, The timer code isn't perfected, will use millis()

UPDATE
Tried to test the code, my library isn't working for some reason (was using the Addicore_RFID_example to test, as well as the AddicoreRFID-master library), debugging now.

Post data sheet to see how we can help.

https://www.hwkitchen.cz/user/related_files/rc522-rfid-ctecka-klicenka-a-karta-rychly-start-pdf.pdf
should be the data sheet, ty

not used that library - I tend to use RFID_MFRC522v2 library

for pin usage see Arduino_MFRC522v2#pin-layout

1 Like

Just swapped over to a new computer as well as library, tried the "Check Hardware" example code to see the ID on the card, shows me this.

Only known versions supported


Performing test...


Result: DEFECT or UNKNOWN

�W���4ɤ�e��6��9eIH�

I have found there are RFID modules with different IDs - the File>Examples>RFID_MFRC522v2>CheckFirmware program sometimes gives "Result: OK" sometimes "Result: DEFECT or UNKNOWN"
however, In general I then found that the File>Examples>RFID_MFRC522v2>ReadUidMultiReader program still works OK

Checking the ReadUidMultiReader code now

UPDATE

I get this error message (�Reader 1: = (unknown)
WAoperly connected?
is the MFRC522 properly connected?
Reader 2: = (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?
y ��� ڈy8) when I try the ReadUidMultiReader code. My wiring is correct,
(SDA-digital 10, SCK-digital 13, MOSI-digital 11, MISO-digital 12, IRQ not connected, GND-GND, RST-digital 9, 3.3v-3.3v) anyone know why?

Can have many many reasons as they are

  • unreliable loose connections
  • cold solderings
  • wrong or no knowledge how breadboards are connected internally
  • many
  • many
  • more

So best thing is that you provide with more informations
post a picture of your real hardware. No online-links or online pictures

These pictures shall show how you have things wired together
The picture shall be taken from vertically above to make it easy to see what is connected to what.

Post a NOT-frizzy-picture of a hand-drawn schematic
Here are a few pictures that explain how to do it and how to not do it

Post the code that you used as a code-section

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.