[solved] Nano with RFID-MC522 not always reading

@Paul__B: Shutdown may be the false term. The Nano reset after the first switching of the relay, maybe due to a spike or short time undervoltage.

@Tom: In the MC7805 datasheet on page 1 the input voltage is stated 5-18V. I removed the connection to Vin and power the Nano now over the 5V pin and the regulator. I also added the the two decoupling capacitors (one I just drew in the schematic and the other one I forgot).

I increased the input voltage from 5.5V (first value where the circuit starts up) to 9V. At 9V the regulator heats up, but is still in the tolerance. Since the circuit seems to work >5.5V I may choose 6-6.5V as my main supply for the "5V-rail".

Since the Nano has a dedicated regulator for the supply what is the better practice to power it? The +5V or the Vin pin?
When I can guarantee a stable 5V I would choose the +5V-pin, otherwise Vin. Is this correct?

EDIT: I looked at the schematic again and the regulator is shown as LM7805. I added the wrong part (similar name in my program)

Hi,

@Tom: In the MC7805 datasheet on page 1 the input voltage is stated 5-18V. I removed the connection to Vin and power the Nano now over the 5V pin and the regulator. I also added the the two decoupling capacitors (one I just drew in the schematic and the other one I forgot).

That datasheet is for the 78XX series that covers ALL 78 series regulators.

Look at drop out voltage for 7805, it is 2V, so input has to be 5 + 2 = 7V minimum for proper regulation.
As the input is usually unregulated, I ensure that 9V is available at the input.

Tom.. :slight_smile:

Thanks for the tip. I will adjust the voltage accordingly. The new design is 4h in operation and the "5V-Mains" rail varies between 8.68-9.01V (with all the other devices operating also). So far no unexpected behavior. I would consider my problem solved.

Since I deviated completely from my original question and changed it to a circuit review I want to thank all participants for their help.

You have a 100 Ohm resistor as the current limit for PC817, if the output from D5 were 5V the current would be near 40 mA. I would increase that to 560, 7 mA.

Hello everyone,

based on my question yesterday I finished soldering my bridging-PCBs (5 pieces). It is just basically a Nano with a power relay where other chips can communicate via SPI (either 3.3V or 5V).

The only module that gives me problems is a RFID-MC522 module. As example I used the standard MC522 project from the example using this library.

When I simply connect the RFID with the Nano (short Jumper cables) and power it over the USB. I almost every time get the response from my key.

I adjusted the code in order to switch my relay (and added some delays after the relay is activated and closed to prevent multiple readings).

#include<Arduino.h>

/*
 * 
 * All the resources for this project: https://www.hackster.io/Aritro
 * Modified by Aritro Mukherjee
 * 
 * 
 */
 
#include <SPI.h>
#include <MFRC522.h>
 
#define SS_PIN 10
#define RST_PIN 9
#define RELAY_PIN 5
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
 
void setup() {
  Serial.begin(9600);   // Initiate a serial communication
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);

  

  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, LOW); //Close the relay
  Serial.println("Approximate your card to the reader...");
  Serial.println();

}

void loop() {

  
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    //Serial.println("start");
    //delay(150);
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    delay(150);
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }

  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "87 35 49 34") { //change here the UID of the card/cards that you want to give access
    Serial.println("Authorized access");
    Serial.println();
    digitalWrite(RELAY_PIN, HIGH); //open the relay
    delay(500);
    digitalWrite(RELAY_PIN, LOW); //Close the relay
    delay(2500);
  }
 
 else   {
    Serial.println(" Access denied");
    delay(500);
  }
  Serial.println("end");
} 

void loop1() {

  delay(150);
  Serial.println("here");
}

Now I connect it to the following PCB and tried following combinations:

  • Power only via USB (upload code, read out serial)
    When a serial monitor is opened the key is detected 1-2 times (relay switches)

  • Power via external 9V@2A power supply
    Switching works either all the time or not at all. Resetting or reconnected leads to different results

  • Power vial external 9V power supply and connected via USB
    Similar behavior as in 2. with less reliability (more often the key is detected 1-2 times). When it works, it works constantly.

In other posts I read about the peak power consumption and that the Nano could not support >50mA and also tried connecting the RFID-module to a adjustable DC-Power (set to 3.3V@3.5A) supply. The error persisted.

I also measured the current drawn from entire circuit and noticed that when it is working the 'idle' current reads 68mA. When the reader is not working I read 42mA.

It is weird behavior, because usually it either works or not. Now I reconnect the power source and sometimes it works. I can not see a pattern other than the current draw, but was not able to determine the source of the problem. My only assumption is that it has to do something with the bridge-PCB, because it works with only the Nano+RFID. Adding peripherals and other functionality leads to unstable behavior.

I know it is hard to debug a custom PCB, especially over the internet, but maybe someone had a similar problem.

RC522-RFID-Reader-Writer-Module-with-Tag-Card-and-FOB-Key-Tag.jpg

I measured the current and adjusted to a 510Ohm Resistor. Thank you

Quick update: I may have found a bad solder joint on the MISO pin (I measured the signal directly on the RFID-module and not at the endpoint of the Nano).

I will run a few test an comment back if it worked or not.

Tested multiple power supply configurations and so far no problem. Unplugging USB while powering external (and vice versa) does not lead to any unexpected interruption.

I also tried to "dirten" the SPI signal and there was still a response.

Usually the problem solved itself when you ask for help.

@v3xX

TOPIC MERGED.

Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum.