Pages: [1]   Go Down
Author Topic: Texas Instruments RFID reader - getting serial data  (Read 2782 times)
0 Members and 1 Guest are viewing this topic.
New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I'm very new to arduino, so please excuse any silly comments or mistakes below!

I'm trying to use an arduino uno as a datalogger - I want it to read serial data coming from a Texas Instruments RFID reader and log it to a file.
I have an arduino uno, with a sparkfun microSD shield (https://www.sparkfun.com/products/9802?), and am using a sparkfun max3232 breakout (https://www.sparkfun.com/products/11189?

I'm connecting the max3232 breakout to the RX and TX pins, and initially am looking at using SerialEvent to do this. Connected to my PC via USB (with the RX and TX pins connecting to the max3232 on the arduino unplugged) and using the arduino serial monitor to send text, it works great and things are logged to the SD card. Connected to my PC via the serial port I've wired to the max3232 also works fine

My code is below

Code:
#include <SD.h>

// SPI settings
// MOSI, MISO, SCLK set by default
// CS = ChipSelect
// pow_pin = power for SD card shield
int CS_pin = 8;
int pow_pin = 10;

String inputString = "";          // a string to hold incoming data
boolean stringComplete = false;   // whether the string is complete



void setup()
{
  Serial.begin(9600);
  inputString.reserve(200);
   
  Serial.println("Initializing card");
  // CS Pin as output
  pinMode(CS_pin, OUTPUT);
 
  // power PIN for SD card
  pinMode(pow_pin, OUTPUT);
  digitalWrite(pow_pin, HIGH);
 
  // Check if card is ready
  if(!SD.begin(CS_pin))
  {
    Serial.println("Card failed");
    return; // return ends the program right here!
  }
  Serial.println("Card ready");

  // open the log file
  // if you don't specify FILE_WRITE it will open the file read-only
}
void loop()
{

 
  // print the string when a newline arrives:
  if (stringComplete) {
    Serial.println(inputString);
    File logFile = SD.open("log.txt", FILE_WRITE); // open the log file
    logFile.println(inputString);
    logFile.close();
    // clear the string:
    inputString = "";
    stringComplete = false;
  }
}

void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

The problem is, when I connect the serial port to the TI RFID reader, I get absolutely nothing!! written to the SD card

Connecting the RFID reader to my PC, and using serial port settings 9600-8-1-N everything works fine. Here is an example of what it spits out

Code:
LI
LI
LI
LI
LI
LI
LI
LI
LI
LI
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523
LR 0113 0379091200509523

LI just seems to be a default, the LR lines are actual reads of a RFID tag

Can anyone help me out? I'm really not sure what to do from here smiley-sad

Thanks!
Dylan
Logged

New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry I've had to edit this as I was wrong - having talked to the person I'm trying to do this for, we can change the configuration of the RFID reader - so it now has flow control disabled.

I'm still not getting any data from the RFID module smiley-sad
To test my max3232 I set it up as a softwareserial and used this example code to talk between my serial ports: http://arduino.cc/en/Tutorial/SoftwareSerialExample
This works as expected :-)

On my max3232 breakout I have:
T1Out -> PIN2 of a male serial port
R2In -> PIN3
GND  -> PIN5

Then on the arduino side
T1In -> PIN7
R1Out -> PIN8

(in the softwareserial example I linked to above I've edited the code like this:

Code:
SoftwareSerial mySerial(6, 7); // RX, TX
« Last Edit: September 22, 2012, 03:37:36 pm by dylanbaars » Logged

Melbourne, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there Dylan, did you note this...

"If you want to run the Control module in a 3-wire connection (RXD, TXD, and GND), without remote
controlled activation, Jumper 5 (JP5) must be closed. This connects DSR and DTR together."


Just to be sure you do have the module configured correctly for 3 wire operation, it would be a good idea to isolate all other signals electrically and try again with the pc to make sure the module is in fact configured correctly for operation in this mode.

Logged

The support team, GorillaBuilderz.
www.GorillaBuilderz.com

New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Dale,

thanks for your reply. Yes I had noted that and jumper 5 is closed.

I have made a 3 wire serial cable, so there are only 3 wires connecting the reader to the serial port of the PC - is this what you mean by isolating all other signals?

Thanks again
Dylan
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What reader are you using?
Logged

New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm using an S2000 reader - RI-CTL-MB2B-30 + RI-RFM-008B-30
(the S2000 is a combination of the two modules listed)

Dylan
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 611
Posts: 49092
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm using an S2000 reader - RI-CTL-MB2B-30 + RI-RFM-008B-30
(the S2000 is a combination of the two modules listed)
You want US to google that for you. I'll pass.
Logged

New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Paul,

sorry I thought I had actually included the link to the PDF for the module in question further up, as it turns out I haven't! My mistake - here it is!
http://www.ti.com/lit/ug/scbu044/scbu044.pdf

I don't expect anyone to google anything for me, what a strange reply :-)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 611
Posts: 49092
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, that device appears to be an RS232C device. RS232C devices are not compatible with TTL serial data. You need a MAX232 chip, or equivalent, between the Arduino and the RFID device, before you destroy your Arduino.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello  dylanbaars.... how did your project finish up with the union of Arduino and the TI Reader.

I have an interest in doing something similar.

Kind Regards
Ray
Logged

Pages: [1]   Go Up
Jump to: