RFID reader & writer module - How do I make it beep?

I got a RFID module for my Arduino.

On the backside it says "RFID_Module_v1.1", but no label or anything saying who made it or whatever, so I'm asking for guidance here.

The project is about blind people. I want to place a RFID chip under a milk carton and then I hooked up a beeper to my Arduino. When the blind person moves the milk over the RFID reader it should beep as many days there's left untill it expire. For example, if it's good for 3 days, it should beep 3 times.

There's 4 outputs on the module. GND VCC RXD TXD

So far I've hooked GND to ground on my Arduino UNO, and the VCC to 5 volt. I got an idea that RXD and TXD is the reader and writer outputs, but where should I connect them?

Can anyone hook me up with some coding that will allow this module to beep when the card is over it? If you have questions regarding this, feel free to ask and I'll answer :)

Thanks in advance!

I suggest you contact whoever you got it from and ask for the data sheet. The only one I found that relates to your description is http://www.parallax.com/dl/docs/prod/audiovis/RFID-Reader-v1.1.pdf but it appears to have a different interface.

Yeah.. I contacted him, but I still need the coding which will make my buzzer buzz ;)

Then you need to provide a link to the datasheet.

I have no idea how that looks...

But this is what I did:

GND -> Arduino GND VCC -> 5v on Arduino RXD -> Pin 0 on Arduino (it says RX so I hope it's the right spot) TXD -> Pin 1 on Arduino (it says TX)

Then I put a buzzer in GND and pin number 8 (it fits right onto Arduino).

Now I want the buzzer to buzz everytime I move a chipcard over the RFID reader ;)

but I still need the coding which will make my buzzer buzz

So why not learn to write it yourself?

This is an odd problem because the RFID will not give you information about how long the milk has got left. In order to do that you will have to match the RFID number with the expiry date, store that in EEPROM so it is saved over power down cycles. Then you need to have a real time clock so the aruino can read the date from it in order to decide how many times to bleep. The bleeping itself is simple, just use a flashing LED sketch only change the LED switching commands to calls to the tone() function.

I doubt if anyone has done that before so hoping to find some code that already does that I would say would be impossible.

RXD -> Pin 0 on Arduino (it says RX so I hope it's the right spot) TXD -> Pin 1 on Arduino (it says TX)

I doubt it. If the reader has an TX pin, it is likely that it is the pin that sends out data, so that should be connected to the arduino's RX pin to recieve that data. However you need to check this with a scope to be sure.

Grumpy_Mike:

RXD -> Pin 0 on Arduino (it says RX so I hope it's the right spot) TXD -> Pin 1 on Arduino (it says TX)

I doubt it. If the reader has an TX pin, it is likely that it is the pin that sends out data, so that should be connected to the arduino's RX pin to recieve that data. However you need to check this with a scope to be sure.

I was actually just thinking about that, and you're totally right... How can it be done otherwise then? The project is about how to make blind people know if the milk has expired... Guess the only way would be to beep the date it expires? Like if it expires the 15th... it would beep 15 times? Can you think of something that would make it better?

Grumpy_Mike: If the reader has an TX pin

On the module it says "TXD".. Is that a TX pin?

Guess the only way would be to beep the date it expires?

All that would do is to get rid of you needing a real time clock, you would still have to set it up matching the RFID number with the expire data.

On the module it says "TXD".. Is that a TX pin?

Yes but whether it is a TX output or TX input depends on if they classify it as DET or DCE equipment:- http://en.wikipedia.org/wiki/Data_terminal_equipment In the absence of a data sheet all you can do is measure it.

However your biggest problem will be that the reader might need initialising with sone numbers before it will start reading and without the data sheet there is no way of knowing what those numbers are.

I can't help you read from the RFID reader or make beeping noises, but hopefully you can figure out how to do both of those things; they don't seem especially difficult.

In terms of overall system design, I'd approach it like this:

Have a switch, an RFID reader and an RTC on the Arduino.

When the button is down and the Arduino detects an RFID tag, it registers the tag by saving the current date and the RFID identity in the EEPROM. The semantics are 'this tag is attached to some milk which is fresh today'.

When it sees an RFID tag when the button is not down, this means somebody is trying to see how old the milk is. If the RFID corresponds to an identity which has been registered in the last 3 days, it beeps the number of days remaining before the tag is out of date. If the tag is unrecognised or was registered more than 3 days ago it does something else - for example a different beep.

Does that work for you?

The outstanding issues are how to interface with the RFID reader (for which you really need the datasheet) and how to make a beep (which needs a buzzer you can power via your Arduino + amp, or a speaker you can pulse via your Arduino + amp.

PeterH: I can't help you read from the RFID reader or make beeping noises, but hopefully you can figure out how to do both of those things; they don't seem especially difficult.

In terms of overall system design, I'd approach it like this:

Have a switch, an RFID reader and an RTC on the Arduino.

When the button is down and the Arduino detects an RFID tag, it registers the tag by saving the current date and the RFID identity in the EEPROM. The semantics are 'this tag is attached to some milk which is fresh today'.

When it sees an RFID tag when the button is not down, this means somebody is trying to see how old the milk is. If the RFID corresponds to an identity which has been registered in the last 3 days, it beeps the number of days remaining before the tag is out of date. If the tag is unrecognised or was registered more than 3 days ago it does something else - for example a different beep.

Does that work for you?

The outstanding issues are how to interface with the RFID reader (for which you really need the datasheet) and how to make a beep (which needs a buzzer you can power via your Arduino + amp, or a speaker you can pulse via your Arduino + amp.

Thanks for that, I could might use it :)

PeterH: I can't help you read from the RFID reader or make beeping noises, but hopefully you can figure out how to do both of those things; they don't seem especially difficult.

In terms of overall system design, I'd approach it like this:

Have a switch, an RFID reader and an RTC on the Arduino.

When the button is down and the Arduino detects an RFID tag, it registers the tag by saving the current date and the RFID identity in the EEPROM. The semantics are 'this tag is attached to some milk which is fresh today'.

When it sees an RFID tag when the button is not down, this means somebody is trying to see how old the milk is. If the RFID corresponds to an identity which has been registered in the last 3 days, it beeps the number of days remaining before the tag is out of date. If the tag is unrecognised or was registered more than 3 days ago it does something else - for example a different beep.

Does that work for you?

The outstanding issues are how to interface with the RFID reader (for which you really need the datasheet) and how to make a beep (which needs a buzzer you can power via your Arduino + amp, or a speaker you can pulse via your Arduino + amp.

I am working on the issue with him, and we actually have a data sheet for it (He just didn't know ;)) Data Sheet Additionally I have written a small piece of code to test it out. The data sheet tells us that we have to send 3 bytes to the reader in order to make it read. 1st byte is the header (AB), 2nd byte is the command length (02) and the 3rd byte will be the "compact command" (Which is 01 to search for cards), so I tried to first initiate it with Serial.begin(9600); (The datasheet says the default baud rate is 9600bps). I pasted the whole program in pastebin to make it a little bit easier to view... http://pastebin.com/Q0UbUiDk

Honestly I feel the error is either the bytes I send (Because of the spaces) or the actual command I send...

The datasheet does not make it clear how to send the commands but I'm pretty sure that this is wrong:

        Serial.write("AB 02 01");

I think you need to send each pair of hex digits as one byte, like this:

  Serial.write(0xAB);
  Serial.write(0x02);
  Serial.write(0x01);

It would also help immensely if your code to read data back from the chip actually tried to read something. There's no Serial.read in the loop.

Pete

el_supremo: The datasheet does not make it clear how to send the commands but I'm pretty sure that this is wrong:

        Serial.write("AB 02 01");

I think you need to send each pair of hex digits as one byte, like this:

  Serial.write(0xAB);
  Serial.write(0x02);
  Serial.write(0x01);

It would also help immensely if your code to read data back from the chip actually tried to read something. There's no Serial.read in the loop.

Pete

Didn't work either.

el_supremo: The datasheet does not make it clear how to send the commands but I'm pretty sure that this is wrong:

        Serial.write("AB 02 01");

I think you need to send each pair of hex digits as one byte, like this:

  Serial.write(0xAB);
  Serial.write(0x02);
  Serial.write(0x01);

It would also help immensely if your code to read data back from the chip actually tried to read something. There's no Serial.read in the loop.

Pete

As far as I could read on the official reference, Serial.available() returns true if data is waiting to be recieved. I suppose that's wrong then?

[quote author=Time Sheep link=topic=86618.msg649679#msg649679 date=1326315791]

el_supremo: It would also help immensely if your code to read data back from the chip actually tried to read something. There's no Serial.read in the loop.

Pete

As far as I could read on the official reference, Serial.available() returns true if data is waiting to be recieved. I suppose that's wrong then? [/quote]

Are we looking at two different sets of code? Do you believe you are calling Serial.read() in the loop?

Stepping back ...

Are you connecting the RFID reader to the physical Rx/Tx pins and accessing them using the predefined Serial object, or using SoftwareSerial set up on some different pins? Perhaps you'd better post all your code and explain how you've got it all wired up.

Just to quote myself:

I pasted the whole program in pastebin to make it a little bit easier to view... http://pastebin.com/Q0UbUiDk

No, I did not use a read function, at first I just tried to make it blink whenever any information is recieved. This was to test the connection to see if we used the correct pins :/

Okay, it seems we can now interface with the reader, and we can make it write to cards and read from cards etc. So what we should just do is to send the 3 bytes one at a time within 5 seconds. We tried using advanced serial port terminal 6, and it worked like a dream. So we just have to use Serial.write() in order to make it work. The question now is, when we read a byte, will the next byte then be recieved upon the second call of Serial.read()?

will the next byte then be recieved upon the second call of Serial.read()?

Yes. Bytes received go into a FIFO buffer, (First In First Out) so you read them in the order they were written.