Arduino Uno - Multiple modules for HDMI switch device I have an Arduino Uno device that uses the following modules:


16 PIN LED w/ Backlight
RFID - RC522 (RFID Reader)
HR911105A (LAN Module - HanRun)


These three modules use every digital pin available in the Uno (2-13) and
it works correctly. The problem is that I want to add a relay to this board. I am new to Arduino so I use tutorials and right now I do not fully understand how this works. So I have connected the IN pin of the relay to Uno pin 8 and the NO pin of the relay to Uno pin 13.

The problem is that when I don't use other modules the relay works correctly (using this code).

int relay_pin = 8;
int led_pin = 13;

void setup() {
  pinMode(relay_pin,OUTPUT);
  pinMode(led_pin,OUTPUT);
  digitalWrite(led_pin,HIGH);
}

void loop() {
  digitalWrite(relay_pin,HIGH);
  delay(5000);
  digitalWrite(relay_pin,LOW);
  delay(5000);
}


The remaining ports are 1 and 0, which I assume are TX/RX, and can't be used for relay (am I wrong?).

So obviously I should not be using those pins but I wonder which pins I am allowed to use simultaneously when using two or three modules at the same time.

Does it depend on the modules or are there some instructions?
The relay wiring diagram you are following is just plain bizarre and the strangest one I have ever seen.

Ignore it. It is completely incorrect.

You only need one pin to control a relay, so disconnect it from pin 13. 

The switched side can connect to anywhere where you would normally use a switch - such as to switch power to an LED connected between +5V and GND with a suitable current limiting resistor.

You can use any available pin to control the relay, and that includes pins 0 or 1 if you aren't using serial communication.  Note that with the relay connected to one of those pins it will most likely activate and buzz while you upload a sketch - best to disconnect it at that point and reconnect it afterwards.



Devices like relays and LEDs need their own dedicated pin. They can't be shared with other functions or each other.

The only devices that can share pins are devices which connect to a bus, such as SPI or I2C.