Arduino RFID Lock/Unlock Project

Job ID: 35160866

Budget: $30 – $250 USD

My Arduino project is 95% done and I someone work out some code to make the project work but it turned out to not be a long term solution.

I have an Arduino NANO, Digital Servo and 125kHz RFID card. The RFID (RDM 6300) that looks for a card, in my case an RFID ring, and if a match is found it turns a servo to open a lock on a box. When I hold the ring to the reader it should lock or unlock based on the opposite action. The issue is that the code I have is buggy and needs to reliably work. Sometimes the code will work for 10-20 lock/unlock cycles and sometimes it will not work at all when powered up. I have gone through all wires on the breadboard and have changed each component multiple times so I am confident it is not a hardware issue.

The code I am currently using is written out below its written by someone that hacked together some found code. It has references to LED and it doesn’t define both pins on RFID only the RX not the TX and other things I can’t quite figure out. I also think the delays are too short.

It works 60% of the time, so I need help me make it so the code works every time rock solid and has a way to escape and reset so that it doesn’t end up crashing in a loop?

I am unable to use different hardware like a different RFID or Arduino One….The Project must use the hardware I have already purchased.

If you can help how much would you charge me?

















Here is a picture of the bread board, note that there is a voltage regulator to drop power from my source to USB power and also note that the ring is in the square antenna.








Here is the code all pins are correct for my project( I am curious that the RDM_TX_PIN 8 is not defined, is it needed? )

#include <Arduino.h>
#include <rdm6300.h>
#include <Servo.h>
Servo myservo; //define servo name
int pos = 0; // variable to store the servo position
#define RDM6300_RX_PIN 6
#define READ_LED_PIN 13
int zoi=0;

Rdm6300 rdm6300;

void setup()
{
Serial.begin(115200);
myservo.attach(9); //servo pin
pinMode(READ_LED_PIN, OUTPUT);
digitalWrite(READ_LED_PIN, LOW);

rdm6300.begin(RDM6300_RX_PIN);
myservo.write(0);
Serial.println("\nPlace RFID tag near the rdm6300...");
}

void loop()
{
/* get_new_tag_id returns the tag_id of a "new" near tag,
following calls will return 0 as long as the same tag is kept near. */
if (rdm6300.get_new_tag_id())
{
Serial.println(rdm6300.get_tag_id(), HEX);
int t=rdm6300.get_tag_id();

if(t==-31510)
{
Serial.println("Accepted");
if(zoi==0){
for (pos = 0; pos <= 75; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15);
// waits 15 ms for the servo to reach the position
}
}
zoi=zoi+1;

}
}
if(zoi==2){
Serial.println("2nd time");
for (pos = 75; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
zoi=0;
}
/* get_tag_id returns the tag_id as long m as it is near, 0 otherwise. */
digitalWrite(READ_LED_PIN, rdm6300.get_tag_id());

delay(10);
}
Related categories: Electronics Arduino