Main Site Documentation

No data from RDM630 (RFID Reader)


#1

Hi Guys
Anyone have experience with the RDM630 RFID reader?
http://www.let-elektronik.dk/filer/produkter/tradlos_rfid_125_uart_module.pdf

I tried connecting it to my Fez Panda II on COM4.
Pin 1 on RDM630 to D31 on panda…
Pin 5 to 5V
Pin 4 to gnd

Main program:


RFID = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);
RFID.Handshake = Handshake.None;

var listenRFID = new Thread(listenForRfid);
listenRFID.Start();


private static void listenForRfid()
        {
            RFID.Open();
            RFID.DiscardInBuffer();
            RFID.Flush();
            if (RFID.IsOpen)
            {
                Debug.Print("RFID is open");
            }
            RFID.DataReceived += new SerialDataReceivedEventHandler(RFID_DataReceived);

            Thread.Sleep(Timeout.Infinite);
        }
public static void RFID_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            Debug.Print("data recieved");
            byte[] ReadBuffer = new byte[RFID.BytesToRead];

            RFID.Read(ReadBuffer, 0, ReadBuffer.Length);
            RFID.DiscardInBuffer();
            RFID.Flush();

            string data = bytesToString(ReadBuffer);
            Debug.Print(data);
        }

Ive tested the code, by sending serial command to the D31 port from my bus pirate. and it recieves it just fine…

But if i hook the RDM630 and place my rfid tag on top, nothing happens… det SerialDataReceivedEventHandler never trigger…
Ive got 2 of them, so i tried the other one, same results… am i doing somthing wrong?


#2

Have you got an antenna hooked up to it?


#3

also tried with the RX on, but since i dont need to transmit to the module i guessed it wasent needed.

And Antenna is hooked up aswell


#4

Try different com port on Panda II


#5

HI,
try to open the RFID in Main program and declare the RFID.DataReceived event handler in Main Program
Regards
Roland


#6

Effectively it not mandatory to use the RX on module side. I use a module like this one from ID Innovation. Worosk fine. You should try another COM Port, cause maybe the COM4 on your board need CTS as mandatory ? First Try a port where Flow control is not used…


#7

It is not a good idea to leave an input floating. If the input is not connected to something, then noise
can have an undesirable effect on the UART.


#8

As it is TTL compliant, it should not ? The behavior is as any input of the uP…


#9

An input configured without pullup or pulldown can “float” between ground and VCC, causing the peripheral to “see” data coming in that’s not really there.


#10

You’re right, but for this particular modules, they do not listen for datas ! They only send !


#11

Okay.
Ive connected it to COM1, and made a more simplefied version of the code… still nothing when i place my rfid tag on the antenna…
Current setup:
RDM630 -> Panda
Pin 1 -> D0 (COM1 In)
Pin 4 -> GND
Pin 5 -> 5V
Antenna connected.

public class Program
    {
        static SerialPort RFID;
        public static void Main()
        {
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, true);

            RFID = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
            RFID.Handshake = Handshake.None;

            //startSlave();
            RFID.Open();
            RFID.DiscardInBuffer();
            RFID.Flush();
            if (RFID.IsOpen)
            {
                Debug.Print("RFID is open");
            }
            RFID.DataReceived += new SerialDataReceivedEventHandler(RFID_DataReceived);

            Thread.Sleep(Timeout.Infinite);
        }

        public static void RFID_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            Debug.Print("data recieved");
            byte[] ReadBuffer = new byte[RFID.BytesToRead];

            RFID.Read(ReadBuffer, 0, ReadBuffer.Length);
            RFID.DiscardInBuffer();
            RFID.Flush();

            string data = bytesToString(ReadBuffer);
            Debug.Print(data);
        }

        public static string bytesToString(byte[] bytes)
        {
            string s = "";
            for (int i = 0; i < bytes.Length; ++i)
            {
                s += (char)bytes[i];
            }
            return s;
        }
    }

#12

Hi,
some more ideas.

  1. Try to read from COM1 in a separate thread instead of using the event handler.
  2. Connect for test RX and TX of COM1, write something to the port and see whether you can read it from the port.
  3. Do both devices use the same voltage? 5V or 3.3 Volt. Ist 5V suitable for the panda?
  4. Try to make the event handler, before you open the port.
    Regards
    Roland

#13

Can you show an example? on how i should read without eventhandler? not sure how …
Both are supported, 3.3 and 5, as far as i know.


#14

Time to go to bed. Perhaps next evening.


#15

@ Bekker -

Just a silly question : Is your RFID Tag compliant to the reader ? DId you buy it with the board itself ?

As you may know, however WIEGAND and RFID is called a “standard”, there are many and many different encodings and possibilities :

Example : 125KHZ and 13.56MHZ
Mifare, Prox, Marine, and so on…

Also regarding to WIEGAND, however it is often WIEGAND26, some have implemented 32, 40 and so on… Did you check that ?

As I see you module only comply for 125KHZ, WIEGAND26…


#16

I’ve bought this “125Khz, EM4100 standard” tag.
The place where i buy online, they write on the site that its compadible with the RDM630


#17

@ Bekker - OK.

Have you tried using the WIEGAND Interface ?


#18

No, not sure that works


#19

OK, if I was in this position, I’d try connecting this to a PC, to eliminate the unknown of my Fez-App. I’d connect it to a TTL-to-USB serial adapter and see if I can get it to talk via a simple terminal program.

But to me, the one thing that isn’t clear, is how to make the module switch from weigand to rs232 and back. Have you found anyone else’s project that uses this thing? I have the Seeed one, http://www.seeedstudio.com/depot/125khz-rfid-module-uart-p-171.html?cPath=144_153 and I can talk to it on the UART, and I think there’s actually a different module for weigand, ie it’s not “switchable”. Do you know forsure* that you have the UART model?


#20

Hi,
here an example for a spider with rs232 module



using System;
using System.Text;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp1
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            Debug.Print("Program Started");
            rs232.Initialize(9600, GT.Interfaces.Serial.SerialParity.None, GT.Interfaces.Serial.SerialStopBits.One, 8, GT.Interfaces.Serial.HardwareFlowControl.NotRequired);
            rs232.serialPort.Open();
            Thread ReadThread = new Thread(MyReadThread);
            ReadThread.Start();
        }
        void MyReadThread()
        {
            while (true)
            {
                if (rs232.serialPort.BytesToRead > 0)
                {
                    byte[] mybuffer = new byte[rs232.serialPort.BytesToRead];
                    rs232.serialPort.Read(mybuffer, 0, mybuffer.Length);
                    string str = "";
                    for (int i = 0; i < mybuffer.Length; i++)
                    {
                        str += (mybuffer[i].ToString() + "-");
                    }
                    Debug.Print("Number of received bytes =: " + mybuffer.Length + "  " + "Data in dezimal: " + str);
                }
                else
                {
                    Debug.Print("Nothing received");
                    Thread.Sleep(2000);
                }
            }
        }
    }
}