Purpose: The swinging flashlight test (SFT) is widely used to diagnose any lesion in the afferent visual pathway which causes an asymmetric pupillary reaction in response to light, known as a relative afferent pupillary defect (RAPD). Due to the high subjectivity associated with traditional SFT, we propose an Arduino-based automated RAPD detection system. Methods: We utilized the Pupil Core device from Pupil Labs for pupil diameter data. To control the duration and intensity of illumination properly, we developed an Arduino-based lighting system for each eye and experimented with 0.3 and 0.6 log unit reduced illumination in each eye to create an artificial asymmetric pupillary response. We evaluated the score for each illumination level based on the difference in the pupil diameter amplitude and used linear regression to obtain the final score. 18 controls and 7 optic nerve patients with a history of RAPD participated in this study. Results: Our data analysis identifies the affected eye and the severity of RAPD, which is then converted to the Bells grading. Results from our experiments mirror the clinical records with 100% specificity and sensitivity. Our study suggests this approach has a precision level of less than 0.1 mm pupil diameter, which can considerably improve early detection. Conclusion: In addition to no human interaction in stimulation and data collection, our solution weighs similar to any wearing glasses proving to be more practical, objective and reliable.