Devices and methods are disclosed that allow a patient to self-treat a medical condition, such as migraine headache and trigeminal neuralgia and the like, by noninvasive electrical stimulation of nerves of the head, particularly supraorbital, supratrochlear, infraorbital, and mental nerves in the vicinity of their foramen or notch. The system comprises a handheld mobile device, such as a smartphone, that is applied to the surface of the patient's head. One or more electrodes on the mobile device apply electrical impulses transcutaneously through the patient's skin to the targeted nerve to treat the medical condition. The system is designed to address problems that arise particularly during self-treatment, when a medical professional is not present.