Need Help on EM-18 reader module and arduino ||Want to read RFID continuously/ periodically

  • i am working with arduino and EM-18 Reader module. i have a code for reading different cards. But,it reads the card once and return the card data. i want to read the same card continuously or periodically using that module to detect the presence of the card on the reader module to do a specific task. simply, i want to get a high signal on a pin as long as there is a right a right card in the reader range .and the signal should be low if the card is away from the range of the reader.
    i have a code to read a card. for the operation that i mentioned above, what changes should i make in that code . or please provide a proper code. please Help !!!!!

    char input[12];                        
    int Number;
    void setup() {                       
    void loop() {                         
        int count = 0;
        while(Serial.available() && count < 12)
          input[count] =;
        if(input[0] == '6' && input[1] == 'D' && input[2] == '0' && input[3] == '0' &&
           input[4] == '9' && input[5] == '4' && input[6] == 'D' && input[7] == '4' &&
           input[8] == '8' && input[9] == '1' && input[10] == 'A' && input[11] == 'C' )  //if the card id read is 6D0094D481AC
          Serial.println("GROUP 1"); 
        else if(input[0] == '6' && input[1] == 'D' && input[2] == '0' && input[3] == '0' &&
           input[4] == '9' && input[5] == '4' && input[6] == 'D' && input[7] == '6' &&
           input[8] == 'F' && input[9] == 'F' && input[10] == 'D' && input[11] == '0' )    //if the read card id is 6D0094D6FFD0
          Serial.println("GROUP 2");
         else if(input[0] == '6' && input[1] == 'D' && input[2] == '0' && input[3] == '0' &&
           input[4] == '9' && input[5] == '4' && input[6] == '9' && input[7] == 'C' &&
           input[8] == 'B' && input[9] == 'B' && input[10] == 'D' && input[11] == 'E' )
          Serial.println("GROUP 3");
         else if(input[0] == '6' && input[1] == 'D' && input[2] == '0' && input[3] == '0' &&
           input[4] == '9' && input[5] == '4' && input[6] == 'B' && input[7] == '5' &&
           input[8] == 'E' && input[9] == 'B' && input[10] == 'A' && input[11] == '7' )
          Serial.println("GROUP 4");
         else if(input[0] == '6' && input[1] == 'D' && input[2] == '0' && input[3] == '0' &&
           input[4] == '9' && input[5] == '4' && input[6] == 'C' && input[7] == '0' &&
           input[8] == '2' && input[9] == '3' && input[10] == '1' && input[11] == 'A' )
          Serial.println("GROUP 5");

    ๐Ÿ˜• please Help

  • my thought is you can check the card availability by reading the card in a time interval, and you can run the function/task in between the time interval by assuming the card is there.

  • @shahidpk I have an idea, but don't know whether it works or not. Try to switch off and switch back on the module while keeping your card infront of the reader. If the detection time is very less then you can try to power off and power on the module rapidly and read the card data continously.

    But before trying this out, try how much time the module takes to initialize and read the card. if this time is too high then my method is waste to implement. As far as I read online, it is the protocol problem of the module. They are programmed to just output only once and other readings are internally masked. So, you need a module that is programmable and should be able to change it's firmware.

  • @salmanfaris ok, lemme try

  • @kowshik1729 yup. I had seen it somewhere

  • @kowshik1729 i am working on it. When vcc is reconnecting the module re-reads the card. It take about 1 seconds maximum to read it.

  • @shahidpk There we go. Now rapidly power off and power on the module to continously read the card data.

    Now I would like to tell a mistake which everyone does commonly whenever I tell to rapidly switch off and on the board. The first thought that gets in your mind is to connect the VCC of the Em-18 board directly to the Arduino's any of the digital pin and toggle that pin at a delay. Right? ๐Ÿ˜

    It is a bad thing to do so. Because we do not know how much current does EM-18 reader module sucks from power supply while powering on. So, if it sucks more than 40mA from the Arduino's digital pin then there is a huge chance that the board can get damaged and eventually your USB port too. So, what is the work around in this case?

    The best practice I would suggest is to "Take a MOSFET, and connect the Gate terminal to the digital pin of arduino. On the drain pin connnect the power supply and on the source pin connect the EM-18 module's VCC pin. This is how you will be able to short the Drain and source gates by giving Gate voltage from the arduino."

    In this way you can protect the EM-18, Arduino as well. So, please do try this method, as far as I thought this would do the job.

  • @salmanfaris i have tried in all my ways... when power on in the absence of card. Shows no card. And led connected to indicate it is low(set by program on arduino pin 3). When card is placed it reads card and led light up. BUT it stay on always till power off. And once the card is placed. Then there is any change if card is removed. I noticed that by placing an led on tx pin of module, there is always a high signal from module. And when card is placing a small blink is seen. I think data stream. ๐Ÿ˜Œ๐Ÿ˜“

  • @kowshik1729 a simple npn transistor such as BC547 is enough for this.No need of MOSFET. EM-18 module draws 50mA current. I already tried it. But, No luck. I think, any changes are needed in my code.

  • @shahidpk I see. Can you please share the code?

Log in to reply

Recent Posts

  • P

    @Anudeep Thanks a lot m8, I actually made a very silly mistake of including the https:// while entering FIREBASE_HOST, where I must have entered the Domain name alone and removed the https:// extension.

    Thanks again for replying that quick. Cheers.

    read more
  • A

    Hello @Palani, In the Firebase, there are two types of storage,

    Cloud Firestore (Very recent one & NoSQL database) Realtime Database (To which we upload the data using NodeMCU)

    In the Arduino Code, you can see that there is a variable named FIREBASE_AUTH.

    This variable should be assigned to the Database secret. This you can find in Project Settings -> Service accounts -> Database Secrets.

    My mistake is, i have mistakenly assigned thay to Web API key. This is found at Project Settings -> General.

    The error can also occur when u don't initialise a proper realtime database in Firebase. (This is not my case).

    read more
  • P

    @Anudeep Hello Anudeep could you please help me out by elaborating the fix to get rid of that error?
    Thanks in advance.

    read more
  • At Adobe, weโ€™re focused on bringing together the most intelligent, driven, diverse set of individuals and give them the freedom to nurture their intellectual curiosity. We provide them with the necessary resources and support to shape their ideas into tangible results.
    Through the Adobe India Women-in-Technology Scholarship, we are striving towards creating gender equality in science, technology and engineering domains by encouraging women to showcase their excellence in computing and technology and become future leaders and role models in the field.

    ๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—ฎ๐—ฝ๐—ฝ๐—น๐˜†?

    Applications must be submitted through their dedicated application portal which opens on August 20th, 2020 and will close on September 20th, 2020, 5 pm India time.

    ๐—”๐—ฝ๐—ฝ๐—น๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ฑ๐—ฒ๐—ฎ๐—ฑ๐—น๐—ถ๐—ป๐—ฒ:

    Application deadline: September 20th, 2020, 5 pm India time.


    read more
  • @kowshik1729 If you are using an external high-speed switch, there is only one one clock generator for both wifi and BLE and the high-speed switch you mentioned is Ultra-Wideband (UWB) 3โ€“8 GHz from its datasheet


    you also check this solution that I shared in the previous post.

    @salmanfaris said in BT and WiFi Dual Core simultaneous operation using ESP32?:

    There is a special option called โ€œSoftware controls WiFi/ Bluetooth coexistenceโ€ it can control the ESP32's Bluetooth and Wi-Fi coexistence using software, more details:

    read more