A detector for measuring and predicting the on/off state of cycling deep brain stimulation (DBS) was developed and tested in 6 patients. 3-electrode EKG measurements, amplified by a commercial bio-amplifier, were used as input for a custom electronics box (e-box). The e-box transformed the DBS waveforms into transistor-transistor logic (TTL) pulses and recorded their timing. Following locking to each patient’s individual waveform, the e-box was shown to predict stimulation onset with an average absolute error of 112ms, 30 minutes after disconnecting from the patients. Using this detector, stimulation can be accurately synchronized to fMRI acquisitions.