Recent developments in radiotherapy have focused on the management of patient motion during treatment. Studies have shown that significant gains in treatment quality can be made by 'gating' certain treatments, simultaneously keeping target coverage, and increasing separation to nearby organs at risk (OAR). Motion phantoms can be used to simulate patient breathing motion and provide the means to perform quality control (QC) and quality assurance (QA) of gating functionality as well as to assess the dosimetric impact of motion on individual patient treatments. The aim of this study was to design and build a motion phantom that accurately reproduces the breathing motion of patients to enable end-to-end gating system quality control of various gating systems as well as patient specific quality assurance. A motion phantom based on a stepper motor driver circuit was designed. The phantom can be programmed with both real patient data from an external gating system and with custom signals. The phantom was programmed and evaluated with patient data and with a square wave signal to be tracked with a Sentinel™ (C-Rad, Uppsala, Sweden) motion monitoring system. Results were compared to the original curves with respect to amplitude and phase. The comparison of patient curve data showed a mean error value of -0.09 mm with a standard deviation of 0.24 mm and a mean absolute error of 0.29 mm. The square wave signals could be reproduced with a mean error value of -0.03 mm, a standard deviation of 0.04 mm and a mean absolute error of 0.13 mm. Breathing curve data acquired from an optical scanning system can be reproduced accurately with the help of the in-house built motion phantom. The phantom can also be programmed to follow user designed curve data. This offers the potential for QC of gating systems and various dosimetric quality control applications.