Hi,
sadly you missed to give values. Values with units we can calculate with.
Input is coming through electromechanical relay when the relay is open I am taking that as 0 V(Logic 0) condition , and when the Relay is close I am taking it as logic 1 condition.
Definitely to solve the problem of floating pin I will be making arduino pin pull up high.
Makes no sense for me. -->schow your schematic.
As mentioned above the input is coming through electromechanical relay hence the input won't be high frequency input , actually it would be like hardly once in a minute.
No timing information .. besides the "once a minute". This makes it hard to help.
Without values I can only give answers without values, too:
* You need to suppress unwanted frequencies to a uncritical low level, while you need to pass your wanted signal with your desried timing to a valid high level.
PCB layout I have already done many time in the past , and also did the PCB layout for this project and I thing I won't be facing any problem in it.
Many users wrote the same.... I have to believe.... but good to see that you don´t need help with this.
Many users before did not have enough experience with the very high frequency ESD / EMI / EMC signals. So even when they used suitable protection devices the protection was not given, resulting in unexpected resets and/or defective I/O pins.
Regarding Optocoupler , can you kinldy elaborate furhter on R D C circuit.
An optocoupler is an isolating device but you don´t use the isolation feature. An optocoupler is no protection device against ESD / EMC signals.
R = resistor mainly for current limiting (depending on the expected overvoltage signal a useful range is from simple 0603 chip resistor up to high voltage high power resistor)
D = Diode for voltage clamping (depending on the expected overvoltage signal a useful range is from smal signal diodes up to several kW transzorb)
C = capacitor, mainly used as low pass filter (depending on the expected overvoltage signal a useful range may be from "no capacitor at all" up to several microfarads, voltage rating depends additionally on circuit)
Klaus