Using UNO and 2 RFID Readers

Hi,

I am trying to make an the uno read from two RFID readers at the same time. Whilst it is possible with using the code I have, I have managed to make it read one at a time, due to the power (I think) When I put a pin from 5V to one it works, and then to the next it works - but when I try to run them from the same pin, it doesn’t!?

I’m fairly new to arduino, so any help would be great!

I’ve attached the setup I’ve created to make it work! Like I said, the arduino is reading from both fine, but it seems the power is not powering both up at the same time.

Hope you can help

I don't trust your diagram. Make a wiring list. List each pin by number, what you think that pin name is and what you have connected. Are you trying to run any code ? If so , post it using the "#" button.

raschemmel:
I don’t trust your diagram.
Make a wiring list.
List each pin by number, what you think that pin name is and what you have connected.
Are you trying to run any code ?
If so , post it using the “#” button.

That’s the setup I’m using - It works perfectly fine except the actual power.
Sorry, should have shared my code earlier:


#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println(“Hello, world?”);
}

void loop() // run over and over
{
byte readValue;

if (mySerial.available()) {
Serial.print(“1=”);
delay(40);
while (mySerial.available()) {
readValue = mySerial.read();
if (readValue>=9) {
Serial.write(readValue);
}
}
}

if (Serial.available()) {
Serial.print(“2=”);
delay(40);
while (Serial.available()) {
readValue = Serial.read();
if (readValue>=9) {
Serial.write(readValue);
}
}
}

}

If so , post it using the “#” button.

If you had done that , it would look like this…

 #include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()  
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  byte readValue;
  
  if (mySerial.available()) {
    Serial.print("1=");
    delay(40);
    while (mySerial.available()) {
      readValue = mySerial.read();
      if (readValue>=9) {
        Serial.write(readValue);
      }
    }
  }

  if (Serial.available()) {
    Serial.print("2=");
    delay(40);
    while (Serial.available()) {
      readValue = Serial.read();
      if (readValue>=9) {
        Serial.write(readValue);
      }
    }
  }
  
}

The RFID only draws 38mA. Your problem isn't related to power. You could prove that if you had a second arduino. You could connect them both to the same power source but read the data from separate uC. Your problem is more than likely a conflict between your default serial port (pin-0) and your Softserial port , (pin-2) but I haven't figured out why yet. A more experienced programmer would probably spot it in 2 minutes.

Find a way to monitor pin-10. When active , there should be a 3.3khz squarewave there. You can connect a led with a resistor to it and it should light when the device is active. If the led turns on for both devices when they share a common power source , then they are working and your inability to read the ASCII output is a separate issue. Once you confirm that they are in fact both working, regardless of your ability to read the ASCII, then you can focus on fixing the problem. You are not going to fix a serial port conflict as long as you are chasing a red herring with the power . Find out if they are working using leds. Ignore the serial port.

You can't use the hardware serial port to both read from your RFID reader and read from the serial monitor which is what you are doing because you seem to be writing to it.

Your problem is more than likely a conflict between your default serial port (pin-0) and your Softserial port , (pin-2) but I haven't figured out why yet. A more experienced programmer would probably spot it in 2 minutes.