Stroke patient rehabilitation by treadmill tends to increase in recent years. The rehabilitation on treadmill needs more than two staffs per patient to control the process and protect them from falling. As a result, it takes too much time and resource to operate. To resolve this problem, this paper proposes to develop an automatic sensor that is simple and easy to use by using ultrasonic sensor and the Arduino board. The system senses patient's body on treadmill to calculate the suitable distance for setting an automatic switch. When patient' body triggers the first position, the treadmill will start moving then patient's body triggers the second distance or fall position, the treadmill will stop immediately. Although it is a simple concept, the commercial treadmill does not have this function which is necessary for looking after patients. The control system uses Arduino and C# languages. The findings suggest that the performance of the system is very satisfactory having accuracy which are measured in 2 states, on and off, at 94.32% and 94.83% respectively.