DIYRFIDReader

tried this source code
I have the following issues

I am getting the pure sinusoidal waveform of 125Khz
Also the the RFID tag is modulated
and able to see the waveforms in pin 13 used for monitoring

but do not get any thing in serail port
the serail port is not working when the timer1 is enabled
So i am not sure whether the arduino is reading my card or not
Any help!!
I could not find the author for this project
I could see only the original contributors
-laks

Without your code and maybe a photo of a block diagram of what you have I don't see how anyone can help you. With what you have given us the only response possible is "Duly noted."

Giving a link is customary.

Do you mean this project?
http://playground.arduino.cc/Main/DIYRFIDReader

So it sounds like the hardware is working. Maybe. You say you can see the waveform, what are you measuring it with? An oscilloscope? What does the signal look like at pin 1 of LM324?

You should post the actual code you are using, copied out of your Sketch. Make sure you use the Code tags. There may be some error that crept in.

Which Arduino are you using? Post a photo?

I was writing the same that polymorph writes. I believe that laks is referring to the project of Reference for RFID:
http://playground.arduino.cc/Main/DIYRFIDReader

@laksprecitron: Two identical posts deleted.

DO NOT CROSS-POST, IT WASTES TIME.

Polymorph /luisilva

I mean the following link only
http://playground.arduino.cc/Main/DIYRFIDReader

I did observe the waveform with the oscilloscope
at pin no 1 of LM324 i get a High (4 to 4.75V) when there is no tag
and a square wave when a RFID tag is brought in near the coil.

I do not get any serial print outs the serial port just not working

I tried by stoping the timer1 then i was able to see the serial prints
looks like timer1 interrupt at 8 micro second interval disturbs or disable the serial outputs…!!!

the complete source code used is as below
/* Arduino program for DIY FSK RFID Reader

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

*/

#include “TimerOne.h”

int ledPin = 13; // LED connected to digital pin 13
int inPin = 7; // sensing digital pin 7
int val;
int bitlenctr = 0;
int curState = 0;

#define maxBuf 1000 //reduce to 100 or so for debugging
#define debug 0

char raw[maxBuf];

int index = 0;
int bufnum = 0;
#define redLED 12
#define grnLED 11

void setup()
{
Serial.begin(9600);
Timer1.initialize(7); // initialize timer1, and set the frequency; this drives both the LC tank as well as the pulse timing clock
// note: modify this as needed to achieve resonance and good match with the desired tags
// the argument value is in microseconds per RF cycle, so 8us will yield RF of 125kHz, 7us → 143kHz, etc.

Timer1.pwm(9, 512); // setup pwm on pin 9, 50% duty cycle
Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt, once per RF cycle

pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output for scope monitoring
pinMode(inPin, INPUT); // sets the digital pin 7 as input to sense receiver input signal
pinMode(grnLED, OUTPUT);
pinMode(redLED, OUTPUT);
digitalWrite(grnLED, 0);
digitalWrite(redLED, 1);
}

void callback()
{
val = digitalRead(inPin);
digitalWrite(ledPin, val); // for monitoring
bitlenctr++;
if(val != curState) {
// got a transition
curState = val;
if(val == 1) {
// got a start of cycle (low to high transition)
if(index < maxBuf) {
raw[index++] = bitlenctr;
}
bitlenctr = 1;
}
}
}

void loop()
{
if(index >= maxBuf) {

Serial.print("got buf num: ");
Serial.println(bufnum);

if(debug) {
for(int i = 0; i < maxBuf;
i++) {
Serial.print((int)raw*);*

  • Serial.print("/");*
  • }*
  • Serial.println("///raw data");*
  • delay(2000);*
  • }*
  • // analyze this buffer*
  • // first convert pulse durations into raw bits*
  • int tot1 = 0;*
  • int tot0 = 0;*
  • int tote = 0;*
  • int totp = 0;*
  • raw[0] = 0;*
  • for(int i = 1; i < maxBuf; i++) {*
    _ int v = raw*;_
    _
    if(v == 4) {_
    _ raw = 0;
    tot0++;
    }
    else if(v == 5) {
    raw = raw[i - 1];
    totp++;
    }
    else if(v == 6 || v == 7) {
    raw = 1;
    tot1++;
    }
    else {
    raw = 101; // error code
    tote++;
    }
    }
    // next, search for a “start tag” of 15 high bits in a row*

    * int samecnt = 0;
    int start = -1;
    int lastv = 0;
    for(int i = 0; i < maxBuf; i++) {
    if(raw == lastv) {
    // inside one same bit pattern, keep scanning*

    * samecnt++;
    }
    else {
    // got new bit pattern*

    * if(samecnt >= 15 && lastv == 1) {
    // got a start tag prefix, record index and exit*

    * start = i;
    break;
    }
    // either group of 0s, or fewer than 15 1s, so not a valid tag, keep scanning*

    * samecnt = 1;
    lastv = raw;
    }
    }
    // if a valid prefix tag was found, process the buffer*

    if(start > 0 && start < (maxBuf - 590)) { //adjust to allow room for full dataset past start point_
    process_buf(start);
    _ }
    else {
    Serial.println(“no valid data found in buffer”);
    }
    if(debug) {
    for(int i = 0; i < maxBuf;
    i++) {
    Serial.print((int)raw);
    Serial.print("/");
    }
    Serial.print("///\nbuffer stats: zeroes:");
    Serial.print(tot0);
    Serial.print("/ones:");
    Serial.print(tot1);
    Serial.print("/prevs:");
    Serial.print(totp);
    Serial.print("/errs:");
    Serial.println(tote);
    delay(1000);
    }
    // start new buffer, reset all parameters*

    * bufnum++;
    curState = 0;
    index = 0;
    }
    else {
    delay(5);
    }
    }
    // process an input buffer with a valid start tag*

    // start argument is index to first 0 bit past prefix tag of 15+ ones
    void process_buf(int start) {
    * // first convert multi bit codes (11111100000…) into manchester bit codes*
    * int lastv = 0;
    int samecnt = 0;
    char manch[91];
    char final[45];
    int manchindex = 0;
    Serial.println(“got a valid prefix, processing data buffer…”);
    for(int i = start + 1; i < maxBuf && manchindex < 90; i++) {
    if(raw == lastv) {
    samecnt++;
    }
    else {
    // got a new bit value, process the last group*

    * if(samecnt >= 3 && samecnt <= 8) {
    manch[manchindex++] = lastv;
    }
    else if(samecnt >= 9 && samecnt <= 14) {
    // assume a double bit, so record as two separate bits*

    * manch[manchindex++] = lastv;
    manch[manchindex++] = lastv;
    }
    else if(samecnt >= 15 && lastv == 0) {
    Serial.println(“got end tag”);
    // got an end tag, exit*

    * break;
    }
    else {
    // last bit group was either too long or too short*

    Serial.print("got bad bit pattern in buffer, count: ");
    Serial.print(samecnt);

    Serial.print(", value: ");

    * Serial.println(lastv);_
    err_flash(3);
    _ return;
    }
    samecnt = 1;
    lastv = raw;
    } //new bit pattern*

    * }
    Serial.println(“converting manchester code to binary…”);
    // got manchester version, convert to final bits*

    * for(int i = 0, findex = 0; i < 90; i += 2, findex++) {
    if(manch == 1 && manch[i+1] == 0) {
    final[findex] = 1;
    }
    else if(manch == 0 && manch[i+1] == 1) {
    final[findex] = 0;
    }
    else {
    // invalid manchester code, exit*

    Serial.println("got invalid manchester code");_
    err_flash(3);

    _ return;

    * }
    }
    // convert bits 28 thru 28+16 into a 16 bit integer*

    * int code = 0;
    int par = 0;
    for(int i = 28, k = 15; i < 28+16; i++, k–) {
    code |= (int)final << k;
    }
    int paritybit = final[28+16];
    for(int i = 0; i < 45; i++) {
    par ^= final;
    }
    if(par) {
    Serial.print("got valid code: ");
    Serial.println((unsigned int)code);
    // do something here with the detected code…
    //
    //
    digitalWrite(redLED, 0);
    digitalWrite(grnLED, 1);
    delay(2000);
    digitalWrite(grnLED, 0);
    digitalWrite(redLED, 1);
    }
    else {
    Serial.println("parity error for retrieved code");_
    err_flash(3);

    _ }
    }

    // flash red for duration seconds*

    void err_flash(int duration) {
    * return;
    for(int i = 0; i < duration10; i++) {

    * digitalWrite(redLED, 0);
    delay(50);
    digitalWrite(redLED, 1);
    delay(50);
    }
    }*_

as per the routine callback() i could see the monitoring output from pin 13 of arduino

it exactly matches the RFID modulated square wave appears at pin 1 of LM 324

-laks

#define maxBuf 1000 //**reduce to 100 or so for debugging **

Did you try this ?

I did reduce the maxbuf value down to 52 which is the no of bits from the tag
same result

  #define debug  0
  if(debug) {

Did you change debug to "1" ?

Yes I made it debug =1