Arduino board locks up after sending Servo turn signal (using separate power)

Hey all, first time poster and new Arduino fan!

I’m trying to make my door lock operable by RFID without modifying the lock, to that end I’ve build a chassis of sheet metal to go over a turning lock that is attached to a Servo arm which is attached to an Arduino and RFID reader.

To allow myself to manually lock/unlock the door with the key, I’ve included a relay which powers the Servo with a separate 6V(1.5A) supply and cuts off when the RFID isn’t activated. The Arduino is powered by a 5V2A supply.

When I run the apparatus not attached to the lock just sitting on my desk, it runs like a charm. RFID activates, the relay turns on, the servo turns the chassis, relay turns off. Rinse and repeat no issues x 1000 times. I’ve Vise locked the servo and placed heavy countertorque to see if the load of the door lock is too much and it will grind away all day and there are no issues. If I hold the relay with my hand instead of fixing it in place over the lock, dead center over the lock, works like butter.

Problem: However, when my Servo chasis is screwed in to the lock and slightly off center of the
rotation axis of the lock it will cause some jittering when opening, typically complete one rotation cycle, and then the Arduino seems non responsive. I’ve included code to troubleshoot so that it prints out ‘New loop’ every time the RFID loop begins as well as code in the setup phase to see if it resets during this period. It appears the board is still working and does not reset but the loops slow down to about 1 new loop every 2 seconds (previously ‘New loop’ would pop up about 5-10 times/second) and the RFID will no longer activate the board/be detected.

I’ve tried to attach capacitors between 3.3V and RFID and separate 6V power supply and Servo to see if it was a power draw issue, no difference. It seems that there is some feedback going to the board after the Servo jitters that causes some type of slowdown on the Arduino board. I can’t really understand how/why this would be, but the only connections between the Servo and the board are the Servo input to digital pin 8 and they share a common ground. I’ve included my code and a schematic below and appreciate any help offered.


Arduino UNO R3
Servo: ANNIMOS 20KG RC Servo Digital High Torque Full Metal Gear, 180° Control Angle
Item: DS3218MG
Stall Torque (5V): 19 kg/cm (263.8oz/in)
Stall Torque (6.8V): 21.5 kg/cm (298.5 oz/in)
Dead band: 3μs
Speed : 0.16 sec/60°(5V) / 0.14 sec/60°(6.8V)
Operating Voltage: 4.8 ~ 6.8 DC Volts
Weight: 60 g (2.12 oz)
Motor Type: DC Motor
Gear Type: Copper & Aluminum
Working frequence: 1520μs / 333hz

Code below

#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position
int relay = 4;

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.

void setup()
  pinMode(relay, OUTPUT);
  digitalWrite(relay, LOW);
  myservo.attach(8);  // attaches the servo on pin 8 to the servo object
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Approximate your card to the reader..."); //SETUP Message
void loop()
  Serial.println("New loop"); //Troubleshooting message to show the board isn't reset/crashed
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent())
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial())
  //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.print("Message : ");
  if (content.substring(1) == "XXXX" ) //UID for my cards, blanked for demonstration purposes.
    Serial.println("Authorized access");
    digitalWrite(relay, HIGH); //Turn relay on
    Serial.println("HIGH relay");

    if (pos >= 90) //Make the servo turn the opposite way it currently is (i.e. from locked to unlock, the servo is generally in pos(0) (locked) to start with
      pos = 0;
      Serial.println("Greater than 90");
    else //Make the servo turn the opposite way it currently is (i.e. from locked to unlock, the servo is generally in pos(0) (locked) to start with
      myservo.write(180) ;
      pos = 180;
      Serial.println("else statement action");
    digitalWrite(relay, LOW); //Turn relay off
    Serial.println("End of if/LOW");

  else   {
    Serial.println(" Access denied");

Hi, A good overall look at your wiring would be good...

Some suggestions on how to approach this:

The "jitter" of a heavily loaded servo can create transient signals that can mess things up..

How is the Arduino powered??

Is the door / frame metal? Where is "ground"?

Thanks for the quick reply, took me awhile to grab some pictures.

The servo is powered by a separate power adapter supplying 6 V. I have a common ground linking the Servo ground and the arduino ground in a separate PCB board I soldered.

The door is wood of some kind, but it screws into a metal lock which is screwed into a metal locking mechanism on the entry side of the door. The doorframe appears to be metal as well.

I played around a little more with it, mounting the lock itself in a vice and I've found the jitter itself has nothing to do with it. Replacing the lock and the door, I found it's actually me touching the Servo which appears to ground it. If I lightly have a finger on the metal chassis of the servo, 0 problems and it will work all day. When I remove my finger, it appears to short the board. (I uploaded a video showing this). I also tried moving the arduino/rfid reader several feet from the door which worked like a charm, however with the RFID reader mounted in the door as intended, the shorting issue comes back.

Any ideas on how to approach this? I've tried adding a combination of 10uF, .1uF, .01uF capacitors between the Servo power/signal and ground without luck.

I attached some video clips to give a better idea about what I'm trying to do.

Thanks for any help