RFID Door Lock component question

Ok So I am going to set up a system similar to http://www.instructables.com/id/Arduino-RFID-Door-Lock/?ALLSTEPS However I have a prebuilt RFID reader 2 actually (a. HID Miniprox with the following wires red=DC, blk=GND, grn=Data, wht=data, drain=drain gnd, orn=grn led, brn=red led, yel = beeper, blu = hold, voi= card present. b. Which I prefer to use ademco OmniProx op30-fw following wires red= 5-16vdc, blk= sheild/ground, wht= data1, grn= data0, brn= ledctr, purple=tamper) The lock I have is 24vdc, so I don't believe the set up from the instructable will be able to power the lock, i tried with my 12vdc converter and it wouldnt flip the lock. I know minimal about programming or electronics so any help would be appreciated. thanks!

12v DC converter? More details maybe?

Anyway, your basic approach will be to use a logic-level MOSFET to operate the lock.

I have a circuit for the system I am using here:

http://gammon.com.au/forum/?id=11283

Since you have a 24V lock you would need to put 24V into the electric strike, and not 12V as I have on the circuit. The MOSFET "grounds" the other end of the lock, so you have: 24V --> MOSFET --> Gnd which, when the program tells it to, operates the lock.

something similar to this is what I have http://www.amazon.com/Wagan-Amp-12V-Power-Adapter/dp/B000P7O5DG Not exactly like that but same principle plug into wall outlet and 12 volt comes out of two wire, its for testing. So basically if I have the proper mosfet it will work as follows 24vdc >>Mosfet>>Lock >>24vdc and 9vdc >> Reader >> Arduino >> Mosfet

ok now I'm getting the following errors

sketch_feb11a.cpp:12:18: error: Tone.h: No such file or directory sketch_feb11a:28: error: 'Tone' does not name a type sketch_feb11a.cpp: In function 'void setup()': sketch_feb11a:33: error: 'tone1' was not declared in this scope sketch_feb11a.cpp: In function 'void loop()': sketch_feb11a:69: error: 'tone1' was not declared in this scope sketch_feb11a:69: error: 'NOTE_C5' was not declared in this scope sketch_feb11a:82: error: 'tone1' was not declared in this scope sketch_feb11a:82: error: 'NOTE_E2' was not declared in this scope

Show the whole sketch?

I copied your code verbatim in order to see if it works for me, I apologize if i’m doing something wrong this is my first time using the arduino

/*
RFID security system.

Author: Nick Gammon
Date:   5th August 2011

See: http://www.gammon.com.au/forum/?id=11283

Released into the public domain.
*/

#include <Tone.h>

#define DOORLOCK 7
#define SPEAKER 8
#define UNLOCK_TIME 2000   // milliseconds

// note, retype rather than copy and paste or you get a funny extra character
const char * ids [] =
{
  "2E3612010225",  // 1 - Tom
  "8E40736E6073",  // 2 - Dick
  "A609CA0E4311",  // 3 - Harry
  "A3EC57520837",  // 4 - visitor

  NULL  // end of table marker
};

Tone tone1;

void setup()
{
  Serial.begin(9600);
  tone1.begin(SPEAKER);
  pinMode (DOORLOCK, OUTPUT);
  digitalWrite (DOORLOCK, LOW);   // lock door initially
}


#define MAX_ID 20

char cur_id [MAX_ID] = "";
int len = 0;

void loop()
{
  char inByte;
  const char ** p = NULL;

  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();

    switch (inByte)
    {
    case 2:    // start of text
      len = 0;
      break;

    case 3:   // end of text
      cur_id [len] = 0;
      Serial.println (cur_id);

      for (p = ids; *p; p++)
      {
        if (strcmp (cur_id, *p) == 0)
        {
          Serial.println ("Accepted.");
          digitalWrite (DOORLOCK, HIGH);   // unlock door
          tone1.play(NOTE_C5, 100);
          delay (300);
          tone1.play(NOTE_C5, 100);
          delay (UNLOCK_TIME);
          digitalWrite (DOORLOCK, LOW);   // lock door again
          break;  // stop testing IDs
        }     
      } // end of for
      
      // no match?
      if (*p == NULL)
      {
        Serial.println ("REJECTED.");
        tone1.play(NOTE_E2, 300);
        delay (1000);
      }

      Serial.flush ();  
      len = 0;  
      break;

    case 10:   // newline
    case 13:   // carriage return
      break;

    default:
      if (len >= (MAX_ID - 1))
        break;

      cur_id [len++] = inByte;
      break;


    }  // end of switch

  }  // end of incoming data
}  // end of loop

Looks like you haven't installed the Tone library. Still that doesn't matter if you aren't using a speaker. Just comment-out the lines with "tone" in them.

Bingo Bango!! That did it, I'll give this a try Before I burn something out I'll tell you what I have and please let me know if i am understanding the schematic on your site.

5v and ground on Arduino go to RFID reader D0 on Arduino goes to data 1 on RFID reader D7 on Arduino goes to Gate on Mosfet Source on Mosfet goes to ground on 24v power supply Drain on Mosfet goes to ground on lock plate Positive on Lock Plate goes to Positive on 24v power supply.

I had D0 (Rx) on the Arduino to D0 on the RFID reader. But it wants to be whatever pin on the RFID reader sends the data. Looks like you have a different one to me.

Make sure you have the Grounds together (Arduino gnd and 24v ground).

I had a diode over the lock plate to stop any back current flowing from the coil back into the MOSFET.

I suggest the two resistors I had in the circuit. The 10K keeps the MOSFET off while the Arduino is booting. The 10 ohm reduces the current into the MOSFET gate.

Otherwise it looks OK.

right now I have just the RFID reader hooked up, it has two different wires for data, I’ve tried each and scanned one of my badges and it just beeps like it read it but nothing shows up on Tera Term or Putty when I’m connected to the Arduino

What have you got connected to what?

rfid pos to the 5v on arduino rfid grd to grd on arduino rfid data 0 or data 1 to D0 on arduino USB to PC

I have found a couple things but to be honest I'm not sure how to implement this idea

RFID Readers generally don't need any extra interface circuit. They can be RS232, RS485 or the more famous one Weigand format for interfacing. In case of the former 2 a transiever may be required to convert to the TTL level, but in case of Weigand format, the data is transmitted in TTL level. There are 2 pins Data0 and Data1 which are at logic level 1(5 v) in normal case. While sending data, Data0 goes low to send 0 and Data1 goes low to send 1. So what you can do is connect them to the 2 external interrupts pins, setting the pins to trigger an interrupt for a falling edge. Now with every interrupt you will get your bits; combine it to form your data which will the card id.

and then this article speaks of having two data connections from their RFID https://sites.google.com/site/handymaneric2/electronics/rfiddoorlocks

Could you possibly explain how to implement this into the coding of yours I am using?

jjackson81281: However I have a prebuilt RFID reader 2 actually (a. HID Miniprox with the following wires ...

Can you give the exact part number of what you have? It seems the Miniprox comes with a couple of different interfaces.

HID 5365EGP00 MINIPROX PROXIMITY READER (the one I'd prefer to use) or Ademco OmniProx OP30-FW

Ok so looking deeper into it these cards have whats called a wiegand interface
I found the following code which gets the data, not I just need to chop up yours and this one to make it work.
I’ll try today but any help you can give would be great

/*
 * HID RFID Reader Wiegand Interface for Arduino Uno
 * Written by Daniel Smith, 2012.01.30
 * www.pagemac.com
 *
 * This program will decode the wiegand data from a HID RFID Reader (or, theoretically,
 * any other device that outputs weigand data).
 * The Wiegand interface has two data lines, DATA0 and DATA1.  These lines are normall held
 * high at 5V.  When a 0 is sent, DATA0 drops to 0V for a few us.  When a 1 is sent, DATA1 drops
 * to 0V for a few us.  There is usually a few ms between the pulses.
 *
 * Your reader should have at least 4 connections (some readers have more).  Connect the Red wire 
 * to 5V.  Connect the black to ground.  Connect the green wire (DATA0) to Digital Pin 2 (INT0).  
 * Connect the white wire (DATA1) to Digital Pin 3 (INT1).  That's it!
 *
 * Operation is simple - each of the data lines are connected to hardware interrupt lines.  When
 * one drops low, an interrupt routine is called and some bits are flipped.  After some time of
 * of not receiving any bits, the Arduino will decode the data.  I've only added the 26 bit and
 * 35 bit formats, but you can easily add more.

*/


#define MAX_BITS 100                 // max number of bits 
#define WEIGAND_WAIT_TIME  3000      // time to wait for another weigand pulse.  

unsigned char databits[MAX_BITS];    // stores all of the data bits
unsigned char bitCount;              // number of bits currently captured
unsigned char flagDone;              // goes low when data is currently being captured
unsigned int weigand_counter;        // countdown until we assume there are no more bits

unsigned long facilityCode=0;        // decoded facility code
unsigned long cardCode=0;            // decoded card code

// interrupt that happens when INTO goes low (0 bit)
void ISR_INT0()
{
  //Serial.print("0");
  bitCount++;
  flagDone = 0;
  weigand_counter = WEIGAND_WAIT_TIME;  
  
}

// interrupt that happens when INT1 goes low (1 bit)
void ISR_INT1()
{
  //Serial.print("1");
  databits[bitCount] = 1;
  bitCount++;
  flagDone = 0;
  weigand_counter = WEIGAND_WAIT_TIME;  
}

void setup()
{
  pinMode(13, OUTPUT);  // LED
  pinMode(2, INPUT);     // DATA0 (INT0)
  pinMode(3, INPUT);     // DATA1 (INT1)
  
  Serial.begin(9600);
  Serial.println("RFID Readers");
  
  // binds the ISR functions to the falling edge of INTO and INT1
  attachInterrupt(0, ISR_INT0, FALLING);  
  attachInterrupt(1, ISR_INT1, FALLING);
  

  weigand_counter = WEIGAND_WAIT_TIME;
}

void loop()
{
  // This waits to make sure that there have been no more data pulses before processing data
  if (!flagDone) {
    if (--weigand_counter == 0)
      flagDone = 1;	
  }
  
  // if we have bits and we the weigand counter went out
  if (bitCount > 0 && flagDone) {
    unsigned char i;
    
    Serial.print("Read ");
    Serial.print(bitCount);
    Serial.print(" bits. ");
    
    // we will decode the bits differently depending on how many bits we have
    // see www.pagemac.com/azure/data_formats.php for mor info
    if (bitCount == 35)
    {
      // 35 bit HID Corporate 1000 format
      // facility code = bits 2 to 14
      for (i=2; i<14; i++)
      {
         facilityCode <<=1;
         facilityCode |= databits[i];
      }
      
      // card code = bits 15 to 34
      for (i=14; i<34; i++)
      {
         cardCode <<=1;
         cardCode |= databits[i];
      }
      
      printBits();
    }
    else if (bitCount == 26)
    {
      // standard 26 bit format
      // facility code = bits 2 to 9
      for (i=1; i<9; i++)
      {
         facilityCode <<=1;
         facilityCode |= databits[i];
      }
      
      // card code = bits 10 to 23
      for (i=9; i<25; i++)
      {
         cardCode <<=1;
         cardCode |= databits[i];
      }
      
      printBits();  
    }
    else {
      // you can add other formats if you want!
     Serial.println("Unable to decode."); 
    }

     // cleanup and get ready for the next card
     bitCount = 0;
     facilityCode = 0;
     cardCode = 0;
     for (i=0; i<MAX_BITS; i++) 
     {
       databits[i] = 0;
     }
  }
}

void printBits()
{
      // I really hope you can figure out what this function does
      Serial.print("FC = ");
      Serial.print(facilityCode);
      Serial.print(", CC = ");
      Serial.println(cardCode); 
}

ok i got the following code to read my serial number and disregard site code
however it isn’t sending a signal to the 13pin when the correct one is scanned.
I gave a led in pin 13 and then grounded

/* Crazy People
 * By Mike Cook April 2009
 * Three RFID readers outputing 26 bit Wiegand code to pins:-
 * Reader A (Head) Pins 2 & 3
 * Interrupt service routine gathers Wiegand pulses (zero or one) until 26 have been recieved
 * Then a sting is sent to processing
 */

int validSerialNumbers[] = {3627, 4133};// see if site code and serial number are in the lists...

volatile long reader1 = 0;
volatile int reader1Count = 0;

void reader1One(void) {
  reader1Count++;
  reader1 = reader1 << 1;
  reader1 |= 1;
}

void reader1Zero(void) {
  reader1Count++;
  reader1 = reader1 << 1;
}

void setup()
{
  Serial.begin(9600);
  // Attach pin change interrupt service routines from the Wiegand RFID readers
  attachInterrupt(0, reader1Zero, RISING);//DATA0 to pin 2
  attachInterrupt(1, reader1One, RISING); //DATA1 to pin 3
  delay(10);
  // the interrupt in the Atmel processor mises out the first negitave pulse as the inputs are already high,
  // so this gives a pulse to each reader input line to get the interrupts working properly.
  // Then clear out the reader variables.
  // The readers are open collector sitting normally at a one so this is OK
  for(int i = 2; i>4; i++){
  pinMode(i, OUTPUT);
   digitalWrite(i, HIGH); // enable internal pull up causing a one
  digitalWrite(i, LOW); // disable internal pull up causing zero and thus an interrupt
  pinMode(i, INPUT);
  digitalWrite(i, HIGH); // enable internal pull up
  }
  delay(10);
  // put the reader input variables to zero
  reader1 = 0;
  reader1Count = 0;
  //digitalWrite(13, HIGH);  // show Arduino has finished initilisation
}

void loop()
{
  if(reader1Count >=26){
//Serial.print(" Reader 1 ");
//Serial.println(reader1,HEX);
 // Serial.println("A");
 //Serial.println(reader1& 0xfffffff);
 int serialNumber=(reader1 >> 1) & 0x3fff;
 int siteCode= (reader1 >> 17) & 0x3ff;

 Serial.print(siteCode);
 Serial.print("  ");
 Serial.println(serialNumber);
  reader1 = 0;
  reader1Count = 0;
  }
else if(reader1Count <=25){
//Serial.print(" Reader 1 ");
//Serial.println(reader1,HEX);
 // Serial.println("A");
 //Serial.println(reader1& 0xfffffff);
 int serialNumber=(reader1 >> 1) & 0x3fff;
 int siteCode= (reader1 >> 10) & 0x3ff;



if(IsTagValid(serialNumber)
){
  digitalWrite(13,HIGH);
}
  else
    digitalWrite(13,LOW);
    delay(2000);
    digitalWrite(13,LOW);   // Open the door. It's cold out here!
}
     }

boolean IsTagValid( int serialNumber)
{
   boolean valid = false;

   // Determine how many valid tags there are
   int validTagCount = sizeof(validSerialNumbers)/sizeof(int);

   // Loop through the arrays to see if siteCode
   // and serialNumber are present

   for(int t=0; t<validTagCount; t++)
   {
	if(validSerialNumbers[t] == serialNumber)
	{
	    valid = true;
	    break;
	}
   }

   return valid;
}

I suggest some debugging prints, and seeing what they say. I haven't used the Wiegand interface personally.

I dont follow

You've got those Serial.print in there. Uncomment them, connect up to your serial monitor, wave the card, and see what happens.