Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ID20/ID12 with Arduino

  • 30-01-2014 4:07pm
    #1
    Registered Users, Registered Users 2 Posts: 891 ✭✭✭


    So I have been using the ID12 and the ID20 without any issue following a very simple schematic. Cards and tags were being read and the ID's sent to the serial monitor, no issue.
    291492.PNG
    I dismantled the wiring on the breadboard to try something else and when I connected up the wiring again. Now all I get is a continuous 255 reading, with no header or footer information. I'm praying the id20 isn't banjaxed, but I have trawled the web and only found a single instance where someone else has had this problem. There was no reply to their request for help.

    Any ideas?

    This is the code. All very simple and straight forward.
    #include <SoftwareSerial.h>
    
    const int SerInToArdu=9; 
    const int SerOutFrmArdu=3; 
    
    SoftwareSerial mySerialPort(SerInToArdu,SerOutFrmArdu);
    
    void setup(){
    	Serial.begin(9600);
    	Serial.println("RFID Reader Ready...");
    	mySerialPort.begin(9600);
    
    };
    
    void loop() {
    int incomingByte=0;
    
    if (mySerialPort.available() > 0) {
    		incomingByte = mySerialPort.read();
    		Serial.print(incomingByte, DEC);
                    Serial.print(' ');
                    if (incomingByte==3) Serial.println();
         };
    }
    

    Pin 3 is used for an led and is required for the constructor, but isn't wired up or used. I'm not even looking for header information as that should only be sent if a valid RFID tag is placed in the readers proximity.

    All this is returning is a continuous stream of 255. I can't figure out whats wrong, please help.

    I'm following this tutorial.


Comments

  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Chet T16


    Firstly, this:

    wisdom_of_the_ancients.png

    255 is binary 11111111 or all high so it may well be that your Rx is just constantly high which the arduino is assuming is valid data. Have you a scope?

    Looking at those readers you can't see the pins when they are on a breadboard so its all too easy to get the wiring wrong. Take it completely apart and put it together step by step.


  • Registered Users, Registered Users 2 Posts: 891 ✭✭✭Mmmm_Lemony


    Chet T16 wrote: »
    Firstly, this:

    wisdom_of_the_ancients.png

    255 is binary 11111111 or all high so it may well be that your Rx is just constantly high which the arduino is assuming is valid data. Have you a scope?

    Looking at those readers you can't see the pins when they are on a breadboard so its all too easy to get the wiring wrong. Take it completely apart and put it together step by step.

    Very appropriate xkcd!

    The 255 makes sense now but still not sure whats causing it.

    I'm using the breakout board from sparkfun so the wiring is as simple as it gets. I've started from scratch and even tested the connections with a multimeter. I have tried connecting to the reset pin and toggling high and low, but it doesn't affect the result, a constant stream without ever having a tag nearby.


  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Chet T16


    On second thoughts the uart might idle high so 255 will be constant low although that doesn't really help.

    Can you try connecting you software serial port to the hardware port and verify that it is working correctly?


  • Registered Users, Registered Users 2 Posts: 891 ✭✭✭Mmmm_Lemony


    Chet T16 wrote: »
    On second thoughts the uart might idle high so 255 will be constant low although that doesn't really help.

    Can you try connecting you software serial port to the hardware port and verify that it is working correctly?

    I have no idea how to do that. As I understand it, pin 9 is returning a high/low at a rate of 9600. Looking at the datasheet here It looks like the issue isn't my wiring. The more I dig the more I see it's a common issue.

    Some commentators on this blog post have suggested that the incorrect reading may be as a result of a FC reset of some sort, and its stuck in Wiegand26 format. Others suggest using a 4k7 resistor between the serial input pin and the ID12/20. I will try check both of these options tomorrow.
    And again, a triple-post. But this time with the solution to the “ÿÿÿÿÿ”/FFFFFF problem; connect a 4K7 resistor between V+ (+5V on the schematic) and pin 9.

    I'm not sure what caused it, and the datasheet doesn't point out any issues with incorrect wiring less than the 5v the arduino supplies so not sure (if it is a hardware issue inside) what could have caused it to malfunction.


  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Chet T16


    The resistor would be acting as a pullup which helps the pin return to the idle state. I've never had to use one with software serial but it can depend on the other devices uart. Regardless, it used to work without.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 891 ✭✭✭Mmmm_Lemony


    Chet T16 wrote: »
    The resistor would be acting as a pullup which helps the pin return to the idle state. I've never had to use one with software serial but it can depend on the other devices uart. Regardless, it used to work without.

    Ok I've had another chance to have a look at it. I've attached an LED to pin 10 and when I moved a tag over it, the led lights up, so this suggests its recognizing tags correctly. However pin 9 is just a constant high reading.

    I connected pin 9 to pin 0 on the Arduino, and using the serial event instead of the rfid libraries 'rfid.begin(9600)', I am now successfully reading the tags. As you suggested, I didn't need an additional resistor.

    I am sure the fault is my own, but I'm still not sure why. Regardless, its reading tags now and displaying the values on the LCD as I wanted (which was a nightmare in itself).

    Thanks for the help.


  • Registered Users, Registered Users 2 Posts: 891 ✭✭✭Mmmm_Lemony


    Ok, so I have another issue. I want to use the Arduino to send the ID of the RFID tag to the PC. On the pc I will have a C# application that will use cmdMessenger to communicate. All very simple and straight forward.

    However, the communication with the C# application requires 'Serial.available()' to be called on from the loop. (At least this is the only way I know how). The issue is that as I am using 'serialEvent()' outside of the loop to get the ID and as soon as I reference anything from Serial.available(), the rfid reader will no longer read in any values. The led to pin 10 on the ID12 lights up but for some reason it wont send bytes to the Arduino.

    Secondly. I had hoped to use an additional rfid reader that runs at 13.56Mhz (ID12/20 is 125Khz), so that the finished product would be able to read both types of tag.

    I think the issue is that I don't understand fully how the devices are communicating. Any pointers to a good tutorial would be very helpful, as the Arduino library documentation is a little sparse.


  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Chet T16


    I hadn't even heard of cmdMessenger until you mentioned it there! Do you need to use this?

    As it happens i'm in the middle of working on a C# application (using VS Express) that communicates with an arduino over serial but i'm doing this directly with the serial port. What data are you looking to send back and forth?


  • Registered Users, Registered Users 2 Posts: 891 ✭✭✭Mmmm_Lemony


    Chet T16 wrote: »
    What data are you looking to send back and forth?

    Bare minimum, the ID of the tag will be sent to the C# application from the Arduino, which in turn will send to a web based API.

    Depending on the response from the API, I would like to display some information on the LCD display on the Arduino. But this display information can be hard coded into the Arduino, so static messages like 'Connected...' or 'Not found' etc...For this reason a single character or 2 digit code would be more than enough from the PC to Arduino.

    Ideally I would like to send other information back and forth so the C# app and the Arduino know that its counterpart is there and a comm path opened, but right now I will settle for the bare minimum.

    I don't NEED to use cmdMessenger, but it's what was recommended on a number of forums as it has a very easy to implement library specifically for C#. Just out of interest how are you communicating directly with the port?


Advertisement