Read RFID reader data on Cerbuino Bee

I have 4 cables on my RFID reader:
12V (plugged on an external power source)
Gnd
D0
D1

Is it possible to receive the data read from the rfid reader through the pins on the board?

If so, could pls explain how?

Thank you.

PS: i wanted to use the usb host on the cerbuino with a usb rfid reader, but that’s not possible right now.

@ julien.pierre - A link to the datasheet would help, but at a guess D0 and D1 are possibly RX and TX for serial…

If they are serial then something like this should work…

Thanks for your reply.
I looked at the extender module doc and there is info on what are the pins for. It seems strange to guess that all pins are the same and I can plug my D0 & D1 anywhere.
Do you know some documentation, or you just know it by experience? :wink:

The extender is just really a “breakout” of any Gadgeteer socket. So if you plug it into an A socket, then the pin functions match the A socket definition. If you plug it into an X socket, the pin functions match an X. So in your case, because you are looking at a serial device, you want to plug it into a U socket. https://www.ghielectronics.com/docs/120/gadgeteer-sockets has the simple reference for the pin locations

Actually I have no extender module abd I was hoping I could plug my D0 & D1 on the Arduino compatible pins on the cerbuino bee board

@ julien.pierre.

You can connect direct to the Arduino style connections. I have done this myself with the UART and IO and it works fine.

Do you have a link to the RFID module you are using? It would really help to know what D0 and D1 are as you really don’t want to destroy your IO inputs if the voltages are not compatible.

I just checked the 12V powered RFID reader I have here and it uses RS232 levels marked as DO and DI which sounds similar to your unit. What does the datasheet say about your unit?

I purchased in a shop around the corner so no datasheet, I’m afraid :frowning:

I would be grateful if you could guide me through that.

Any part numbers on it or even a picture or the unit will help? I am sure someone will recognise it :slight_smile:

Please find attached a couple of pictures of the setup. There is no numbers at the front or back! :slight_smile:

Just as I thought. This is very likely RS232 output so DO NOT CONNECT to your Cerbuino. (But I see you have from the image)

You can confirm this by measuring the voltage with a multimeter.

D0 and D1 are inputs. They are connected to GND to switch the RED and GREEN LED on the device on.

The output is the purple wire, and this has the Wiegand output you need but it will be at ±12V levels. Check with a meter first. In the standby state it will be somewhere close to -12V.

If indeed it is 12V you need to use a level converter.

You also need a common GROUND connection otherwise it won’t work. Connect GND on the module to GND on the Cerbuino.

I put a common GND as seen on picture.
I measured the voltage on all other cables (green, white, purple) and they are all 5V.

Not sure what’s wrong :frowning:

But in the instance that we have some hardware working (maybe I’ll get another reader), is there are special .net class to read the data coming in?

I’ve been using InputPort, OutputPort so far and I cannot understand how I would read\receive serial data with an InputPort class.

Once I do searches on UART .Net MF, I always get SerialPort class.

Can you help please?

HI Julien,

The module outputs standard Weigand data via the UART. That should be on the purple wire according to the image you posted.

You need to use the SerialPort class to read it. It’s plain ASCII as I recall from the time I last used it.

DO and D1 are the LED inputs. If you connect these to ground, the LED on the front of the unit should light up. Try this. It should be RED and GREEN LEDs.

I am working on some serial port stuff for the Cerbuino on the same connections as you so once I get this working, I’ll post some code.

Ok I see, thanks for your help

I’m now using a different reader (see doc attached)
Which cable goes where?
Should I use TTL or RS323 interface?

Thanks for your help.

TTL will allow you to connect the RX of your device to the TX of your Fez, and vice-versa. If you don’t have to use RS232 you wouldn’t…

Ok, that would be Digital 0 and Digital 1 pins on my Cerbuino Bee board, right?

If I use the SerialPort class, which COM port correspond to the D0 and D1 on the board, then?

It’s working! Woohoo!

It turns out that Digital 0 and Digital 1 pins are the COM3 port. that’s the code:

public class Program
{
static SerialPort serialPort1;

public static void Main()
{
    serialPort1 = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
    serialPort1.DataReceived += new SerialDataReceivedEventHandler(ReceivedData);
    serialPort1.Open();

    while (true)
    {
        Thread.Sleep(100);
    }
}

static void ReceivedData(object sender, SerialDataReceivedEventArgs e)
{
    Thread.Sleep(100);

    int numberOfBytes = serialPort1.BytesToRead;

    byte[] tempData = new byte[numberOfBytes];

    serialPort1.Read(tempData, 0, numberOfBytes);

    string command = new string(Encoding.UTF8.GetChars(tempData));

    Debug.Print(command);
}

}

1 Like

Nice work. TTL is so much easier if your board has no RS232 level shifting.

I was just about to post about COM3 after I got my GSM modem and GPS system working this morning too.

One thing I discovered is that you can’t use some devices on socket 1 with COM3 in use. I had an N18 display in it and it failed to open COM3. :frowning:

Hi all,

Let demistify some things about RFID Reader interfaces.

Majorly, you will find WIEGAND and DATACLOCK interfaces that are known to be simple to use, however they only accept reading from the reader, and thus, do not require request/response plumb to be managed.

D0 and D1 Pins on a reader are respectively LOWLEVEL (0) and HIGHLEVEL (1). This means that when D0 comes to LOW, you have to interpret a 0, and when D1 comes to LOW, it is 1.

D0 and D1 are sequantial sets, and do not need any CLOCK to be synchronize. What you only need to read a WIEGAND sequence is 2 InterruptInput (one for D0 , one for D1) and sharing a common binary buffer.

With DATA CLOCK, there is a clock sync that tell you when to read the DATA value. In tthis case you need 1 InterruptInput (CLOCK) and 1 simple input (DATA) => When the CLOCK goes to LOW, you read the value on DATA, and so on.

Regarding to the size of the Buffer, this is given by the reader. Commonly it is WIEGAND 26 which means 26 bit, including 1 bit start, 24 bit for the UID, and 1 bit stop…But, it can be different to this standard if specified on the reader…

@ LouisCpro.

Interesting. The unit that Julien has is almost identical to the one I have but has a different interface. This would explain why he is seeing 5V on the IO connections and based on what you posted, I was wrong about the wiring. I guess we can still all keep learning new stuff :slight_smile:

The unit I have is a simple RS232 interface that outputs a serial ASCII stream.

Knowing what you just posted will be very helpful if I come across this again.