Max. Length of cables

At 200m this will eventually clobber your Arduino.

Use opto isolators/couplers, they will do the job.